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