From 0912b18c8ea1e4c0dd2a4476457c0d4c4be647b6 Mon Sep 17 00:00:00 2001 From: Dong Aisheng Date: Thu, 9 Apr 2015 16:36:06 +0800 Subject: [PATCH] MLK-11065-7 bcmdhd: call wifi_card_detect in wifi_platform_bus_enumerate Without this, WiFi can not work when re-insmod module because the card is not reset in rmmod. Signed-off-by: Dong Aisheng (cherry picked from commit 25ce53802b419f3b2002c5345abee1b85827c688) --- .../net/wireless/bcmdhd/dhd_linux_platdev.c | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/net/wireless/bcmdhd/dhd_linux_platdev.c b/drivers/net/wireless/bcmdhd/dhd_linux_platdev.c index 5e8a57fb4780..a4bbb83695aa 100644 --- a/drivers/net/wireless/bcmdhd/dhd_linux_platdev.c +++ b/drivers/net/wireless/bcmdhd/dhd_linux_platdev.c @@ -201,6 +201,37 @@ int wifi_platform_set_power(wifi_adapter_info_t *adapter, bool on, unsigned long return err; } +#if 1 +/* Murata debug: this function is re-worked because "wifi_plat_data" is NULL. */ +/* Need to investigate how this pointer/data is being passed into probe function. */ +/* "wifi_plat_data" used to be "wifi_ctrl". */ +/* All this code is done for only one reason -- calling mmc_detect_change() in /drivers/mmc/core/core.c. */ +extern void wifi_card_detect(void); +int wifi_platform_bus_enumerate(wifi_adapter_info_t *adapter, bool device_present) +{ + int err = 0; + struct wifi_platform_data *plat_data; + + if (!adapter) { + pr_err("!!!! %s: failed! adapter variable is NULL!!!!!\n", __FUNCTION__); + return -EINVAL; + } + + DHD_ERROR(("%s device present %d\n", __FUNCTION__, device_present)); + + if (!adapter->wifi_plat_data) { + wifi_card_detect(); /* hook for card_detect */ + } else { + plat_data = adapter->wifi_plat_data; + if (plat_data->set_carddetect) + err = plat_data->set_carddetect(device_present); + } + + return 0; /* force success status returned */ +} + +#else + int wifi_platform_bus_enumerate(wifi_adapter_info_t *adapter, bool device_present) { int err = 0; @@ -217,6 +248,7 @@ int wifi_platform_bus_enumerate(wifi_adapter_info_t *adapter, bool device_presen return err; } +#endif int wifi_platform_get_mac_addr(wifi_adapter_info_t *adapter, unsigned char *buf) { -- 2.17.1