860-brcmfmac-register-wiphy-s-during-module_init.patch 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <[email protected]>
  2. Date: Mon, 8 Jun 2015 16:11:40 +0200
  3. Subject: [PATCH] brcmfmac: register wiphy(s) during module_init
  4. MIME-Version: 1.0
  5. Content-Type: text/plain; charset=UTF-8
  6. Content-Transfer-Encoding: 8bit
  7. This is needed by OpenWrt which expects all PHYs to be created after
  8. module loads successfully.
  9. Signed-off-by: Rafał Miłecki <[email protected]>
  10. ---
  11. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  12. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  13. @@ -459,6 +459,7 @@ struct brcmf_fw {
  14. u32 curpos;
  15. unsigned int board_index;
  16. void (*done)(struct device *dev, int err, struct brcmf_fw_request *req);
  17. + struct completion *completion;
  18. };
  19. #ifdef CONFIG_EFI
  20. @@ -686,6 +687,8 @@ static void brcmf_fw_request_done(const
  21. fwctx->req = NULL;
  22. }
  23. fwctx->done(fwctx->dev, ret, fwctx->req);
  24. + if (fwctx->completion)
  25. + complete(fwctx->completion);
  26. kfree(fwctx);
  27. }
  28. @@ -751,6 +754,8 @@ int brcmf_fw_get_firmwares(struct device
  29. {
  30. struct brcmf_fw_item *first = &req->items[0];
  31. struct brcmf_fw *fwctx;
  32. + struct completion completion;
  33. + unsigned long time_left;
  34. char *alt_path = NULL;
  35. int ret;
  36. @@ -768,6 +773,9 @@ int brcmf_fw_get_firmwares(struct device
  37. fwctx->dev = dev;
  38. fwctx->req = req;
  39. fwctx->done = fw_cb;
  40. +
  41. + init_completion(&completion);
  42. + fwctx->completion = &completion;
  43. /* First try alternative board-specific path if any */
  44. if (fwctx->req->board_types[0])
  45. @@ -787,6 +795,12 @@ int brcmf_fw_get_firmwares(struct device
  46. if (ret < 0)
  47. brcmf_fw_request_done(NULL, fwctx);
  48. +
  49. + time_left = wait_for_completion_timeout(&completion,
  50. + msecs_to_jiffies(5000));
  51. + if (!time_left && fwctx)
  52. + fwctx->completion = NULL;
  53. +
  54. return 0;
  55. }