Skip to content

Commit

Permalink
brcm80211: fmac: remove firmware requests from init_module syscall
Browse files Browse the repository at this point in the history
As indicated in [1] on netdev mailing list drivers should not block
on the init_module() syscall. This patch defers the actual driver
registration to a workqueue so the init_module() syscall can complete
without delay.

[1] http://article.gmane.org/gmane.linux.network/217729/

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Arend van Spriel authored and John W. Linville committed Mar 5, 2012
1 parent 549040a commit e64a4b7
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -1181,19 +1181,29 @@ int brcmf_write_to_file(struct brcmf_pub *drvr, const u8 *buf, int size)
}
#endif /* DEBUG */

static int __init brcmfmac_init(void)
static void brcmf_driver_init(struct work_struct *work)
{
#ifdef CONFIG_BRCMFMAC_SDIO
brcmf_sdio_init();
#endif
#ifdef CONFIG_BRCMFMAC_USB
brcmf_usb_init();
#endif
}
static DECLARE_WORK(brcmf_driver_work, brcmf_driver_init);

static int __init brcmfmac_module_init(void)
{
if (!schedule_work(&brcmf_driver_work))
return -EBUSY;

return 0;
}

static void __exit brcmfmac_exit(void)
static void __exit brcmfmac_module_exit(void)
{
cancel_work_sync(&brcmf_driver_work);

#ifdef CONFIG_BRCMFMAC_SDIO
brcmf_sdio_exit();
#endif
Expand All @@ -1202,5 +1212,5 @@ static void __exit brcmfmac_exit(void)
#endif
}

module_init(brcmfmac_init);
module_exit(brcmfmac_exit);
module_init(brcmfmac_module_init);
module_exit(brcmfmac_module_exit);

0 comments on commit e64a4b7

Please sign in to comment.