351-0004-brcmfmac-Fix-did-not-remove-int-handler-warning.patch 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. From: Christian Daudt <csd@broadcom.com>
  2. Date: Wed, 11 May 2016 15:06:49 -0700
  3. Subject: [PATCH] brcmfmac: Fix 'did not remove int handler' warning
  4. brcmf_sdiod_intr_unregister call that removes both func1 and
  5. func2 interrupt handlers only called when brcmf_ops_sdio_remove
  6. is called for func 1 (which is the 2nd call) but sdio is expecting
  7. it to be removed at the end of each sdio_remove call.
  8. This is causing 'rmmod bcmrfmac' on a 4356-sdio chip to complain
  9. with:
  10. WARNING: driver brcmfmac did not remove its interrupt handler!
  11. The modification makes calling brcmf_sdiod_intr_unregister multiple
  12. times harmless by clearing the variables that track if interrupt
  13. handlers have been installed, and then calls it on every
  14. brcmf_ops_sdio_remove call instead of just remove for func 1.
  15. Signed-off-by: Christian Daudt <csd@broadcom.com>
  16. Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17. ---
  18. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  19. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  20. @@ -172,7 +172,7 @@ int brcmf_sdiod_intr_register(struct brc
  21. return 0;
  22. }
  23. -int brcmf_sdiod_intr_unregister(struct brcmf_sdio_dev *sdiodev)
  24. +void brcmf_sdiod_intr_unregister(struct brcmf_sdio_dev *sdiodev)
  25. {
  26. brcmf_dbg(SDIO, "Entering oob=%d sd=%d\n",
  27. @@ -195,6 +195,7 @@ int brcmf_sdiod_intr_unregister(struct b
  28. }
  29. free_irq(pdata->oob_irq_nr, &sdiodev->func[1]->dev);
  30. sdiodev->irq_en = false;
  31. + sdiodev->oob_irq_requested = false;
  32. }
  33. if (sdiodev->sd_irq_requested) {
  34. @@ -202,9 +203,8 @@ int brcmf_sdiod_intr_unregister(struct b
  35. sdio_release_irq(sdiodev->func[2]);
  36. sdio_release_irq(sdiodev->func[1]);
  37. sdio_release_host(sdiodev->func[1]);
  38. + sdiodev->sd_irq_requested = false;
  39. }
  40. -
  41. - return 0;
  42. }
  43. void brcmf_sdiod_change_state(struct brcmf_sdio_dev *sdiodev,
  44. @@ -1201,12 +1201,17 @@ static void brcmf_ops_sdio_remove(struct
  45. brcmf_dbg(SDIO, "sdio device ID: 0x%04x\n", func->device);
  46. brcmf_dbg(SDIO, "Function: %d\n", func->num);
  47. - if (func->num != 1)
  48. - return;
  49. -
  50. bus_if = dev_get_drvdata(&func->dev);
  51. if (bus_if) {
  52. sdiodev = bus_if->bus_priv.sdio;
  53. +
  54. + /* start by unregistering irqs */
  55. + brcmf_sdiod_intr_unregister(sdiodev);
  56. +
  57. + if (func->num != 1)
  58. + return;
  59. +
  60. + /* only proceed with rest of cleanup if func 1 */
  61. brcmf_sdiod_remove(sdiodev);
  62. dev_set_drvdata(&sdiodev->func[1]->dev, NULL);
  63. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
  64. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
  65. @@ -294,7 +294,7 @@ struct sdpcmd_regs {
  66. /* Register/deregister interrupt handler. */
  67. int brcmf_sdiod_intr_register(struct brcmf_sdio_dev *sdiodev);
  68. -int brcmf_sdiod_intr_unregister(struct brcmf_sdio_dev *sdiodev);
  69. +void brcmf_sdiod_intr_unregister(struct brcmf_sdio_dev *sdiodev);
  70. /* sdio device register access interface */
  71. u8 brcmf_sdiod_regrb(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret);