freebsd_network: Move up Giant ownership during attach.
device_attach can be recursed for MIIbus drivers, so avoid the complexity and lock Giant from init_drivers() instead.
This commit is contained in:
parent
c6c03b01c3
commit
d621ee6564
@ -481,9 +481,6 @@ device_attach(device_t device)
|
||||
|| device->methods.attach == NULL)
|
||||
return B_ERROR;
|
||||
|
||||
// Always hold the giant lock during attach.
|
||||
mtx_lock(&Giant);
|
||||
|
||||
result = device->methods.attach(device);
|
||||
|
||||
if (result == 0)
|
||||
@ -492,7 +489,6 @@ device_attach(device_t device)
|
||||
if (result == 0 && HAIKU_DRIVER_REQUIRES(FBSD_WLAN_FEATURE))
|
||||
result = start_wlan(device);
|
||||
|
||||
mtx_unlock(&Giant);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -310,6 +310,9 @@ _fbsd_init_drivers()
|
||||
if (status < B_OK)
|
||||
goto err6;
|
||||
|
||||
// Always hold the giant lock during attach.
|
||||
mtx_lock(&Giant);
|
||||
|
||||
for (int p = 0; sProbedDevices[p].bus != BUS_INVALID; p++) {
|
||||
device_t root, device = NULL;
|
||||
status = init_root_device(&root, sProbedDevices[p].bus);
|
||||
@ -341,6 +344,8 @@ _fbsd_init_drivers()
|
||||
device_delete_child(NULL, root);
|
||||
}
|
||||
|
||||
mtx_unlock(&Giant);
|
||||
|
||||
if (gDeviceCount > 0)
|
||||
return B_OK;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user