335-brcmfmac-Fix-oops-when-SDIO-device-is-removed.patch 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. From: Hante Meuleman <[email protected]>
  2. Date: Fri, 6 Mar 2015 18:40:38 +0100
  3. Subject: [PATCH] brcmfmac: Fix oops when SDIO device is removed.
  4. On removal of SDIO card both functions of card will be getting
  5. a remove call. When the first is hanging in ctrl frame xmit then
  6. the second will cause oops. This patch fixes the xmit ctrl
  7. handling in case of serious errors and also limits the handling
  8. for remove to function 1 only.
  9. Reviewed-by: Arend Van Spriel <[email protected]>
  10. Reviewed-by: Franky (Zhenhui) Lin <[email protected]>
  11. Reviewed-by: Pieter-Paul Giesberts <[email protected]>
  12. Reviewed-by: Daniel (Deognyoun) Kim <[email protected]>
  13. Signed-off-by: Hante Meuleman <[email protected]>
  14. Signed-off-by: Arend van Spriel <[email protected]>
  15. Signed-off-by: Kalle Valo <[email protected]>
  16. ---
  17. --- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  18. +++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  19. @@ -1194,7 +1194,7 @@ static void brcmf_ops_sdio_remove(struct
  20. brcmf_dbg(SDIO, "sdio device ID: 0x%04x\n", func->device);
  21. brcmf_dbg(SDIO, "Function: %d\n", func->num);
  22. - if (func->num != 1 && func->num != 2)
  23. + if (func->num != 1)
  24. return;
  25. bus_if = dev_get_drvdata(&func->dev);
  26. --- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  27. +++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  28. @@ -2740,6 +2740,11 @@ static void brcmf_sdio_dpc(struct brcmf_
  29. if ((bus->sdiodev->state != BRCMF_SDIOD_DATA) || (err != 0)) {
  30. brcmf_err("failed backplane access over SDIO, halting operation\n");
  31. atomic_set(&bus->intstatus, 0);
  32. + if (bus->ctrl_frame_stat) {
  33. + bus->ctrl_frame_err = -ENODEV;
  34. + bus->ctrl_frame_stat = false;
  35. + brcmf_sdio_wait_event_wakeup(bus);
  36. + }
  37. } else if (atomic_read(&bus->intstatus) ||
  38. atomic_read(&bus->ipend) > 0 ||
  39. (!atomic_read(&bus->fcstate) &&