@@ -160,7 +160,7 @@ struct brcmf_usbdev_info {
160
160
161
161
struct usb_device * usbdev ;
162
162
struct device * dev ;
163
- struct mutex dev_init_lock ;
163
+ struct completion dev_init_done ;
164
164
165
165
int ctl_in_pipe , ctl_out_pipe ;
166
166
struct urb * ctl_urb ; /* URB for control endpoint */
@@ -1192,11 +1192,11 @@ static void brcmf_usb_probe_phase2(struct device *dev, int ret,
1192
1192
if (ret )
1193
1193
goto error ;
1194
1194
1195
- mutex_unlock (& devinfo -> dev_init_lock );
1195
+ complete (& devinfo -> dev_init_done );
1196
1196
return ;
1197
1197
error :
1198
1198
brcmf_dbg (TRACE , "failed: dev=%s, err=%d\n" , dev_name (dev ), ret );
1199
- mutex_unlock (& devinfo -> dev_init_lock );
1199
+ complete (& devinfo -> dev_init_done );
1200
1200
device_release_driver (dev );
1201
1201
}
1202
1202
@@ -1242,7 +1242,7 @@ static int brcmf_usb_probe_cb(struct brcmf_usbdev_info *devinfo)
1242
1242
if (ret )
1243
1243
goto fail ;
1244
1244
/* we are done */
1245
- mutex_unlock (& devinfo -> dev_init_lock );
1245
+ complete (& devinfo -> dev_init_done );
1246
1246
return 0 ;
1247
1247
}
1248
1248
bus -> chip = bus_pub -> devid ;
@@ -1303,11 +1303,10 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
1303
1303
1304
1304
devinfo -> usbdev = usb ;
1305
1305
devinfo -> dev = & usb -> dev ;
1306
- /* Take an init lock , to protect for disconnect while still loading.
1306
+ /* Init completion , to protect for disconnect while still loading.
1307
1307
* Necessary because of the asynchronous firmware load construction
1308
1308
*/
1309
- mutex_init (& devinfo -> dev_init_lock );
1310
- mutex_lock (& devinfo -> dev_init_lock );
1309
+ init_completion (& devinfo -> dev_init_done );
1311
1310
1312
1311
usb_set_intfdata (intf , devinfo );
1313
1312
@@ -1385,7 +1384,7 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
1385
1384
return 0 ;
1386
1385
1387
1386
fail :
1388
- mutex_unlock (& devinfo -> dev_init_lock );
1387
+ complete (& devinfo -> dev_init_done );
1389
1388
kfree (devinfo );
1390
1389
usb_set_intfdata (intf , NULL );
1391
1390
return ret ;
@@ -1400,7 +1399,7 @@ brcmf_usb_disconnect(struct usb_interface *intf)
1400
1399
devinfo = (struct brcmf_usbdev_info * )usb_get_intfdata (intf );
1401
1400
1402
1401
if (devinfo ) {
1403
- mutex_lock (& devinfo -> dev_init_lock );
1402
+ wait_for_completion (& devinfo -> dev_init_done );
1404
1403
/* Make sure that devinfo still exists. Firmware probe routines
1405
1404
* may have released the device and cleared the intfdata.
1406
1405
*/
0 commit comments