From 8e1cea9e05ca21899bca2ef655305e15eafba7fb Mon Sep 17 00:00:00 2001 From: "Kumar Prasanth (CSTIPL CSS ICW APP ETG WIFI)" Date: Tue, 10 May 2022 04:55:13 +0000 Subject: [PATCH 093/296] non-upstream: Fix lspci not enumerating wifi device after reboot --- .../broadcom/brcm80211/brcmfmac/common.c | 21 +++++++++++++++++++ .../broadcom/brcm80211/brcmfmac/core.c | 2 +- .../broadcom/brcm80211/brcmfmac/core.h | 2 +- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c index 3ed454edff66..cc94ec948549 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c @@ -23,6 +23,9 @@ #include "defs.h" #include "fweh.h" #include +#include +#include +#include "pcie.h" MODULE_AUTHOR("Broadcom Corporation"); MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver."); @@ -92,6 +95,12 @@ MODULE_PARM_DESC(fw_ap_select, "Allow FW for AP selection"); static struct brcmfmac_platform_data *brcmfmac_pdata; struct brcmf_mp_global_t brcmf_mp_global; +static int brcmf_reboot_callback(struct notifier_block *this, unsigned long code, void *unused); +static struct notifier_block brcmf_reboot_notifier = { + .notifier_call = brcmf_reboot_callback, + .priority = 1, +}; + void brcmf_c_set_joinpref_default(struct brcmf_if *ifp) { struct brcmf_pub *drvr = ifp->drvr; @@ -642,6 +651,15 @@ void brcmf_release_module_param(struct brcmf_mp_device *module_param) kfree(module_param); } +static int +brcmf_reboot_callback(struct notifier_block *this, unsigned long code, void *unused) +{ + brcmf_dbg(INFO, "code = %ld\n", code); + if (code == SYS_RESTART) + brcmf_core_exit(); + return NOTIFY_DONE; +} + static int __init brcmf_common_pd_probe(struct platform_device *pdev) { brcmf_dbg(INFO, "Enter\n"); @@ -688,6 +706,8 @@ static int __init brcmfmac_module_init(void) if (err) { if (brcmfmac_pdata) platform_driver_unregister(&brcmf_pd); + } else { + register_reboot_notifier(&brcmf_reboot_notifier); } return err; @@ -696,6 +716,7 @@ static int __init brcmfmac_module_init(void) static void __exit brcmfmac_module_exit(void) { brcmf_core_exit(); + unregister_reboot_notifier(&brcmf_reboot_notifier); if (brcmfmac_pdata) platform_driver_unregister(&brcmf_pd); } diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c index c23fba5c5062..6133d5065eb9 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c @@ -1582,7 +1582,7 @@ int __init brcmf_core_init(void) return err; } -void __exit brcmf_core_exit(void) +void brcmf_core_exit(void) { brcmf_sdio_exit(); brcmf_usb_exit(); diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h index 9b750aa072f8..fc24876b033a 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h @@ -241,7 +241,7 @@ void brcmf_net_detach(struct net_device *ndev, bool locked); int brcmf_net_mon_attach(struct brcmf_if *ifp); void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on); int __init brcmf_core_init(void); -void __exit brcmf_core_exit(void); +void brcmf_core_exit(void); int brcmf_pktfilter_add_remove(struct net_device *ndev, int filter_num, bool add); int brcmf_pktfilter_enable(struct net_device *ndev, bool enable); -- 2.25.1