diff options
| author | Arend van Spriel <arend@broadcom.com> | 2012-03-02 16:55:50 -0500 |
|---|---|---|
| committer | John W. Linville <linville@tuxdriver.com> | 2012-03-05 15:54:01 -0500 |
| commit | b0c359b2f68e982ac9334a5f2c04c3a67dee4d50 (patch) | |
| tree | 00a8a3928f61e9addfd5faba6fec90cc8d06681c | |
| parent | e64a4b708fd5b719b54f7f969895b66bcba71486 (diff) | |
brcm80211: smac: remove firmware requests from init_module syscall
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: Alwin Beukers <alwin@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
| -rw-r--r-- | drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c index fec0f10773e5..569ab8abd2a1 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c | |||
| @@ -1169,25 +1169,31 @@ static struct bcma_driver brcms_bcma_driver = { | |||
| 1169 | /** | 1169 | /** |
| 1170 | * This is the main entry point for the brcmsmac driver. | 1170 | * This is the main entry point for the brcmsmac driver. |
| 1171 | * | 1171 | * |
| 1172 | * This function determines if a device pointed to by pdev is a WL device, | 1172 | * This function is scheduled upon module initialization and |
| 1173 | * and if so, performs a brcms_attach() on it. | 1173 | * does the driver registration, which result in brcms_bcma_probe() |
| 1174 | * | 1174 | * call resulting in the driver bringup. |
| 1175 | */ | 1175 | */ |
| 1176 | static int __init brcms_module_init(void) | 1176 | static void brcms_driver_init(struct work_struct *work) |
| 1177 | { | 1177 | { |
| 1178 | int error = -ENODEV; | 1178 | int error; |
| 1179 | 1179 | ||
| 1180 | error = bcma_driver_register(&brcms_bcma_driver); | ||
| 1181 | if (error) | ||
| 1182 | pr_err("%s: register returned %d\n", __func__, error); | ||
| 1183 | } | ||
| 1184 | |||
| 1185 | static DECLARE_WORK(brcms_driver_work, brcms_driver_init); | ||
| 1186 | |||
| 1187 | static int __init brcms_module_init(void) | ||
| 1188 | { | ||
| 1180 | #ifdef DEBUG | 1189 | #ifdef DEBUG |
| 1181 | if (msglevel != 0xdeadbeef) | 1190 | if (msglevel != 0xdeadbeef) |
| 1182 | brcm_msg_level = msglevel; | 1191 | brcm_msg_level = msglevel; |
| 1183 | #endif /* DEBUG */ | 1192 | #endif |
| 1184 | 1193 | if (!schedule_work(&brcms_driver_work)) | |
| 1185 | error = bcma_driver_register(&brcms_bcma_driver); | 1194 | return -EBUSY; |
| 1186 | pr_err("%s: register returned %d\n", __func__, error); | ||
| 1187 | if (!error) | ||
| 1188 | return 0; | ||
| 1189 | 1195 | ||
| 1190 | return error; | 1196 | return 0; |
| 1191 | } | 1197 | } |
| 1192 | 1198 | ||
| 1193 | /** | 1199 | /** |
| @@ -1199,6 +1205,7 @@ static int __init brcms_module_init(void) | |||
| 1199 | */ | 1205 | */ |
| 1200 | static void __exit brcms_module_exit(void) | 1206 | static void __exit brcms_module_exit(void) |
| 1201 | { | 1207 | { |
| 1208 | cancel_work_sync(&brcms_driver_work); | ||
| 1202 | bcma_driver_unregister(&brcms_bcma_driver); | 1209 | bcma_driver_unregister(&brcms_bcma_driver); |
| 1203 | } | 1210 | } |
| 1204 | 1211 | ||
