@@ -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 */
@@ -1194,11 +1194,11 @@ static void brcmf_usb_probe_phase2(struct device *dev, int ret,
1194
1194
if (ret )
1195
1195
goto error ;
1196
1196
1197
- mutex_unlock (& devinfo -> dev_init_lock );
1197
+ complete (& devinfo -> dev_init_done );
1198
1198
return ;
1199
1199
error :
1200
1200
brcmf_dbg (TRACE , "failed: dev=%s, err=%d\n" , dev_name (dev ), ret );
1201
- mutex_unlock (& devinfo -> dev_init_lock );
1201
+ complete (& devinfo -> dev_init_done );
1202
1202
device_release_driver (dev );
1203
1203
}
1204
1204
@@ -1266,7 +1266,7 @@ static int brcmf_usb_probe_cb(struct brcmf_usbdev_info *devinfo)
1266
1266
if (ret )
1267
1267
goto fail ;
1268
1268
/* we are done */
1269
- mutex_unlock (& devinfo -> dev_init_lock );
1269
+ complete (& devinfo -> dev_init_done );
1270
1270
return 0 ;
1271
1271
}
1272
1272
bus -> chip = bus_pub -> devid ;
@@ -1326,11 +1326,10 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
1326
1326
1327
1327
devinfo -> usbdev = usb ;
1328
1328
devinfo -> dev = & usb -> dev ;
1329
- /* Take an init lock , to protect for disconnect while still loading.
1329
+ /* Init completion , to protect for disconnect while still loading.
1330
1330
* Necessary because of the asynchronous firmware load construction
1331
1331
*/
1332
- mutex_init (& devinfo -> dev_init_lock );
1333
- mutex_lock (& devinfo -> dev_init_lock );
1332
+ init_completion (& devinfo -> dev_init_done );
1334
1333
1335
1334
usb_set_intfdata (intf , devinfo );
1336
1335
@@ -1408,7 +1407,7 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
1408
1407
return 0 ;
1409
1408
1410
1409
fail :
1411
- mutex_unlock (& devinfo -> dev_init_lock );
1410
+ complete (& devinfo -> dev_init_done );
1412
1411
kfree (devinfo );
1413
1412
usb_set_intfdata (intf , NULL );
1414
1413
return ret ;
@@ -1423,7 +1422,7 @@ brcmf_usb_disconnect(struct usb_interface *intf)
1423
1422
devinfo = (struct brcmf_usbdev_info * )usb_get_intfdata (intf );
1424
1423
1425
1424
if (devinfo ) {
1426
- mutex_lock (& devinfo -> dev_init_lock );
1425
+ wait_for_completion (& devinfo -> dev_init_done );
1427
1426
/* Make sure that devinfo still exists. Firmware probe routines
1428
1427
* may have released the device and cleared the intfdata.
1429
1428
*/
0 commit comments