352-v5.4-0002-brcmfmac-change-the-order-of-things-in-brcmf_detach.patch 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. From 14fcfd1cc0c05ea58f47dd693fdd13f25dfe995e Mon Sep 17 00:00:00 2001
  2. From: Arend van Spriel <arend.vanspriel@broadcom.com>
  3. Date: Thu, 11 Jul 2019 11:05:07 +0200
  4. Subject: [PATCH] brcmfmac: change the order of things in brcmf_detach()
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. When brcmf_detach() from the bus layer upon rmmod we can no longer
  9. communicate. Hence we will set the bus state to DOWN and cleanup
  10. the event and protocol layer. The network interfaces need to be
  11. deleted before brcmf_cfg80211_detach() because the latter does the
  12. wiphy_unregister() which issues a warning if there are still network
  13. devices linked to the wiphy instance.
  14. Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  15. Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  16. Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  17. Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  18. Tested-by: Rafał Miłecki <rafal@milecki.pl>
  19. Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  20. ---
  21. .../broadcom/brcm80211/brcmfmac/core.c | 27 ++++++++++---------
  22. 1 file changed, 14 insertions(+), 13 deletions(-)
  23. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  24. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  25. @@ -1287,26 +1287,27 @@ void brcmf_detach(struct device *dev)
  26. unregister_inet6addr_notifier(&drvr->inet6addr_notifier);
  27. #endif
  28. - /* stop firmware event handling */
  29. - brcmf_fweh_detach(drvr);
  30. - if (drvr->config)
  31. - brcmf_p2p_detach(&drvr->config->p2p);
  32. -
  33. brcmf_bus_change_state(bus_if, BRCMF_BUS_DOWN);
  34. -
  35. - /* make sure primary interface removed last */
  36. - for (i = BRCMF_MAX_IFS-1; i > -1; i--)
  37. - brcmf_remove_interface(drvr->iflist[i], false);
  38. -
  39. - brcmf_cfg80211_detach(drvr->config);
  40. - drvr->config = NULL;
  41. -
  42. brcmf_bus_stop(drvr->bus_if);
  43. + brcmf_fweh_detach(drvr);
  44. brcmf_proto_detach(drvr);
  45. -
  46. brcmf_debug_detach(drvr);
  47. +
  48. + /* make sure primary interface removed last */
  49. + for (i = BRCMF_MAX_IFS - 1; i > -1; i--) {
  50. + if (drvr->iflist[i])
  51. + brcmf_del_if(drvr, drvr->iflist[i]->bsscfgidx, false);
  52. + }
  53. +
  54. + if (drvr->config) {
  55. + brcmf_p2p_detach(&drvr->config->p2p);
  56. + brcmf_cfg80211_detach(drvr->config);
  57. + drvr->config = NULL;
  58. + }
  59. +
  60. bus_if->drvr = NULL;
  61. +
  62. wiphy_free(drvr->wiphy);
  63. }