Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Arend van Spriel and committed by
John W. Linville
b0c359b2 e64a4b70

+19 -12
+19 -12
drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
··· 1169 1169 /** 1170 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, 1173 - * and if so, performs a brcms_attach() on it. 1174 - * 1172 + * This function is scheduled upon module initialization and 1173 + * does the driver registration, which result in brcms_bcma_probe() 1174 + * call resulting in the driver bringup. 1175 1175 */ 1176 + static void brcms_driver_init(struct work_struct *work) 1177 + { 1178 + int error; 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 + 1176 1187 static int __init brcms_module_init(void) 1177 1188 { 1178 - int error = -ENODEV; 1179 - 1180 1189 #ifdef DEBUG 1181 1190 if (msglevel != 0xdeadbeef) 1182 1191 brcm_msg_level = msglevel; 1183 - #endif /* DEBUG */ 1192 + #endif 1193 + if (!schedule_work(&brcms_driver_work)) 1194 + return -EBUSY; 1184 1195 1185 - error = bcma_driver_register(&brcms_bcma_driver); 1186 - pr_err("%s: register returned %d\n", __func__, error); 1187 - if (!error) 1188 - return 0; 1189 - 1190 - return error; 1196 + return 0; 1191 1197 } 1192 1198 1193 1199 /** ··· 1205 1199 */ 1206 1200 static void __exit brcms_module_exit(void) 1207 1201 { 1202 + cancel_work_sync(&brcms_driver_work); 1208 1203 bcma_driver_unregister(&brcms_bcma_driver); 1209 1204 } 1210 1205