MLK-10717 bcmdhd: fix rmmod warnings when associated with AP
authorDong Aisheng <b29396@freescale.com>
Wed, 20 May 2015 09:14:41 +0000 (17:14 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:49:01 +0000 (14:49 -0500)
Should call cfg80211_disconnected() when do rmmod if associcated with AP before..

root@imx7d_all:~# modprobe -r bcmdhd
dhd_prot_ioctl : bus is down. we have nothing to do
dhd_wlfc_deinit():3268, ampdu_hostreorder get failed Err = -1
dhd_prot_ioctl : bus is down. we have nothing to do
dhd_wlfc_deinit():3291 failed to enable/disable bdcv2 tlv signaling Err = -1
CFG80211-ERROR) wl_cfg80211_disconnect : Reason 3
dhd_prot_ioctl : bus is down. we have nothing to do
CFG80211-ERROR) wl_cfg80211_disconnect : error (-1)
------------[ cut here ]------------
WARNING: CPU: 1 PID: 1057 at net/wireless/core.c:953 cfg80211_netdev_notifier_call+0x3f4/0x468()
Modules linked in: bcmdhd(-) evbug
CPU: 1 PID: 1057 Comm: modprobe Not tainted 3.14.38-02140-g3418ee9 #1074
[<80014a40>] (unwind_backtrace) from [<80011698>] (show_stack+0x10/0x14)
[<80011698>] (show_stack) from [<80705f90>] (dump_stack+0x7c/0xbc)
[<80705f90>] (dump_stack) from [<8002fbe0>] (warn_slowpath_common+0x6c/0x88)
[<8002fbe0>] (warn_slowpath_common) from [<8002fc98>] (warn_slowpath_null+0x1c/0x24)
[<8002fc98>] (warn_slowpath_null) from [<806b2d4c>] (cfg80211_netdev_notifier_call+0x3f4/0x468)
[<806b2d4c>] (cfg80211_netdev_notifier_call) from [<8004e044>] (notifier_call_chain+0x44/0x84)
[<8004e044>] (notifier_call_chain) from [<8004e148>] (raw_notifier_call_chain+0x18/0x20)
[<8004e148>] (raw_notifier_call_chain) from [<8059b218>] (rollback_registered_many+0x1dc/0x340)
[<8059b218>] (rollback_registered_many) from [<8059b3a4>] (rollback_registered+0x28/0x3c)
[<8059b3a4>] (rollback_registered) from [<8059c658>] (unregister_netdevice_queue+0x54/0xb0)
[<8059c658>] (unregister_netdevice_queue) from [<8059c6cc>] (unregister_netdev+0x18/0x20)
[<8059c6cc>] (unregister_netdev) from [<7f00ef84>] (dhd_detach+0x238/0x474 [bcmdhd])
[<7f00ef84>] (dhd_detach [bcmdhd]) from [<7f05621c>] (dhdsdio_release+0x40/0x1c0 [bcmdhd])
[<7f05621c>] (dhdsdio_release [bcmdhd]) from [<7f0569fc>] (dhdsdio_disconnect+0x3c/0x94 [bcmdhd])
[<7f0569fc>] (dhdsdio_disconnect [bcmdhd]) from [<7f0493a8>] (bcmsdh_remove+0x3c/0x60 [bcmdhd])
[<7f0493a8>] (bcmsdh_remove [bcmdhd]) from [<7f04ade8>] (bcmsdh_sdmmc_remove+0x4c/0x64 [bcmdhd])
[<7f04ade8>] (bcmsdh_sdmmc_remove [bcmdhd]) from [<804baff8>] (sdio_bus_remove+0x30/0xf8)
[<804baff8>] (sdio_bus_remove) from [<80346c94>] (__device_release_driver+0x70/0xcc)
[<80346c94>] (__device_release_driver) from [<803473bc>] (driver_detach+0xac/0xb0)
[<803473bc>] (driver_detach) from [<80346994>] (bus_remove_driver+0x4c/0xa0)
[<80346994>] (bus_remove_driver) from [<7f05f930>] (dhd_module_cleanup+0x2c/0x3c [bcmdhd])
[<7f05f930>] (dhd_module_cleanup [bcmdhd]) from [<80084c54>] (SyS_delete_module+0x11c/0x17c)
[<80084c54>] (SyS_delete_module) from [<8000e3e0>] (ret_fast_syscall+0x0/0x30)
---[ end trace 89522c1a1370465d ]---
dhd_detach(): thread:dhd_watchdog_thread:291 terminated OK
dhd_dpc_thread: Unexpected up_cnt 0
dhd_detach(): thread:dhd_dpc:292 terminated OK
CFG80211-ERROR) wl_event_handler : was terminated
wl_destroy_event_handler(): thread:wl_event_handler:290 terminated OK
unregister wifi platform drivers
wifi_platform_bus_enumerate device present 0
mmc1: card 0001 removed

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

drivers/net/wireless/bcmdhd/dhd_linux.c
drivers/net/wireless/bcmdhd/wl_cfg80211.c

index 5057eda..37a786a 100644 (file)
@@ -5328,6 +5328,10 @@ void dhd_detach(dhd_pub_t *dhdp)
                OSL_SLEEP(100);
        }
 
+#ifdef WL_CFG80211
+       wl_cfg80211_down(NULL);
+#endif /* WL_CFG80211 */
+
        if (dhd->dhd_state & DHD_ATTACH_STATE_PROT_ATTACH) {
                dhd_bus_detach(dhdp);
 
index 700ea52..5768045 100644 (file)
@@ -7909,6 +7909,11 @@ wl_notify_connect_status(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev,
                                                MAC2STRDBG(curbssid), MAC2STRDBG((u8*)(&e->addr))));
                                        return 0;
                                }
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0))
+                               cfg80211_disconnected(ndev, reason, NULL, 0, false, GFP_KERNEL);
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) */
+
                                wl_clr_drv_status(cfg, CONNECTED, ndev);
                                if (! wl_get_drv_status(cfg, DISCONNECTING, ndev)) {
                                        /* To make sure disconnect, explictly send dissassoc
@@ -10906,6 +10911,11 @@ static s32 __wl_cfg80211_down(struct bcm_cfg80211 *cfg)
 #endif /* PROP_TXSTATUS_VSDB */
        }
 
+       /* Check if cfg80211 interface is already down */
+       if (!wl_get_drv_status(cfg, READY, ndev)) {
+               WL_DBG(("cfg80211 interface is already down"));
+               return err;     /* it is even not ready */
+       }
 
        /* If primary BSS is operational (for e.g SoftAP), bring it down */
        if (!(wl_cfgp2p_find_idx(cfg, ndev, &bssidx)) &&
@@ -10914,9 +10924,6 @@ static s32 __wl_cfg80211_down(struct bcm_cfg80211 *cfg)
                        WL_ERR(("BSS down failed \n"));
        }
 
-       /* Check if cfg80211 interface is already down */
-       if (!wl_get_drv_status(cfg, READY, ndev))
-               return err;     /* it is even not ready */
        for_each_ndev(cfg, iter, next)
                wl_set_drv_status(cfg, SCAN_ABORTING, iter->ndev);
 
@@ -10933,6 +10940,11 @@ static s32 __wl_cfg80211_down(struct bcm_cfg80211 *cfg)
        spin_unlock_irqrestore(&cfg->cfgdrv_lock, flags);
 
        for_each_ndev(cfg, iter, next) {
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0))
+               if (wl_get_drv_status(cfg, CONNECTED, iter->ndev)) {
+                       cfg80211_disconnected(iter->ndev, 0, NULL, 0, false, GFP_KERNEL);
+               }
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) */
                wl_clr_drv_status(cfg, READY, iter->ndev);
                wl_clr_drv_status(cfg, SCANNING, iter->ndev);
                wl_clr_drv_status(cfg, SCAN_ABORTING, iter->ndev);
@@ -11021,7 +11033,7 @@ int wl_cfg80211_hang(struct net_device *dev, u16 reason)
 
        WL_ERR(("In : chip crash eventing\n"));
        wl_add_remove_pm_enable_work(cfg, FALSE, WL_HANDLER_DEL);
-       cfg80211_disconnected(dev, reason, NULL, 0, GFP_KERNEL);
+       cfg80211_disconnected(dev, reason, NULL, 0, false, GFP_KERNEL);
        if (cfg != NULL) {
                wl_link_down(cfg);
        }