MLK-11065-7 bcmdhd: call wifi_card_detect in wifi_platform_bus_enumerate
authorDong Aisheng <b29396@freescale.com>
Thu, 9 Apr 2015 08:36:06 +0000 (16:36 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:49:01 +0000 (14:49 -0500)
Without this, WiFi can not work when re-insmod module because
the card is not reset in rmmod.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
(cherry picked from commit 25ce53802b419f3b2002c5345abee1b85827c688)

drivers/net/wireless/bcmdhd/dhd_linux_platdev.c

index 5e8a57f..a4bbb83 100644 (file)
@@ -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)
 {