From 4012f8da70689385635208465b085feeec497c81 Mon Sep 17 00:00:00 2001 From: Rongjun Chen Date: Tue, 23 May 2017 18:27:27 +0800 Subject: [PATCH] wifi: add CONFIG_DHD_USE_STATIC_BUF support and fix suspend issue Change-Id: Idcdcf1762dac7e339ff5709d403ce302d3137d4a --- bcmdhd-usb.1.363.110.17.x/Makefile | 2 +- bcmdhd-usb.1.363.110.17.x/dbus_usb_linux.c | 8 +++++--- bcmdhd-usb.1.363.110.17.x/dhd_gpio.c | 16 ++++++++++++++++ 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/bcmdhd-usb.1.363.110.17.x/Makefile b/bcmdhd-usb.1.363.110.17.x/Makefile index b98c38b..7d93a11 100644 --- a/bcmdhd-usb.1.363.110.17.x/Makefile +++ b/bcmdhd-usb.1.363.110.17.x/Makefile @@ -34,7 +34,7 @@ DHDOFILES += dhd_gpio.o DHDCFLAGS += -DCUSTOMER_HW -DDHD_OF_SUPPORT ifeq ($(CONFIG_DHD_USE_STATIC_BUF),y) -obj-m += dhd_static_buf.o +#obj-m += dhd_static_buf.o DHDCFLAGS += -DSTATIC_WL_PRIV_STRUCT -DENHANCED_STATIC_BUF -DCONFIG_DHD_USE_STATIC_BUF endif diff --git a/bcmdhd-usb.1.363.110.17.x/dbus_usb_linux.c b/bcmdhd-usb.1.363.110.17.x/dbus_usb_linux.c index f97ac4a..a4b89ce 100644 --- a/bcmdhd-usb.1.363.110.17.x/dbus_usb_linux.c +++ b/bcmdhd-usb.1.363.110.17.x/dbus_usb_linux.c @@ -422,8 +422,9 @@ static void dbus_usbos_disconnect(struct usb_interface *intf); static int dbus_usbos_resume(struct usb_interface *intf); static int dbus_usbos_suspend(struct usb_interface *intf, pm_message_t message); /* at the moment, used for full dongle host driver only */ +#if defined(USB_SUSPEND_AVAILABLE) static int dbus_usbos_reset_resume(struct usb_interface *intf); -//#endif /* USB_SUSPEND_AVAILABLE */ +#endif /* USB_SUSPEND_AVAILABLE */ #else /* KERNEL26 */ static void *dbus_usbos_probe(struct usb_device *usb, unsigned int ifnum, const struct usb_device_id *id); @@ -479,8 +480,8 @@ static struct usb_driver dbus_usbdev = { //#if defined(USB_SUSPEND_AVAILABLE) suspend: dbus_usbos_suspend, resume: dbus_usbos_resume, - reset_resume: dbus_usbos_reset_resume, #if defined(USB_SUSPEND_AVAILABLE) + reset_resume: dbus_usbos_reset_resume, /* Linux USB core will allow autosuspend for devices bound to this driver */ supports_autosuspend: 1 #endif /* USB_SUSPEND_AVAILABLE */ @@ -1256,6 +1257,7 @@ static int dbus_usbos_resume(struct usb_interface *intf) * This function is directly called by the Linux kernel, when the suspended device has been reset * instead of being resumed */ +#if defined(USB_SUSPEND_AVAILABLE) static int dbus_usbos_reset_resume(struct usb_interface *intf) { DBUSERR(("%s Device reset resumed\n", __FUNCTION__)); @@ -1266,7 +1268,7 @@ static int dbus_usbos_reset_resume(struct usb_interface *intf) return 0; } -//#endif /* USB_SUSPEND_AVAILABLE */ +#endif /* USB_SUSPEND_AVAILABLE */ /** * Called by Linux kernel at initialization time, kernel wants to know if our driver will accept the diff --git a/bcmdhd-usb.1.363.110.17.x/dhd_gpio.c b/bcmdhd-usb.1.363.110.17.x/dhd_gpio.c index 8218d58..78235cf 100644 --- a/bcmdhd-usb.1.363.110.17.x/dhd_gpio.c +++ b/bcmdhd-usb.1.363.110.17.x/dhd_gpio.c @@ -21,6 +21,22 @@ static int dhd_wlan_get_mac_addr(unsigned char *buf) return err; } +#ifdef CONFIG_DHD_USE_STATIC_BUF +extern void *bcmdhd_mem_prealloc(int section, unsigned long size); +void* dhd_wlan_mem_prealloc(int section, unsigned long size) +{ + void *alloc_ptr = NULL; + alloc_ptr = bcmdhd_mem_prealloc(section, size); + if (alloc_ptr) { + printf("success alloc section %d, size %ld\n", section, size); + if (size != 0L) + bzero(alloc_ptr, size); + return alloc_ptr; + } + printf("can't alloc section %d\n", section); + return NULL; +} +#endif #if !defined(WL_WIRELESS_EXT) struct cntry_locales_custom { -- 2.20.1