forked from luck/tmp_suning_uos_patched
ACPI / scan: Change ordering of locks for device hotplug
Change the ordering of device hotplug locks in scan.c so that acpi_scan_lock is always acquired after device_hotplug_lock. This will make it possible to use device_hotplug_lock around some code paths that acquire acpi_scan_lock safely (most importantly system suspend and hibernation). Apart from that, acpi_scan_lock is platform-specific and device_hotplug_lock is general, so the new ordering appears to be more appropriate from the overall design viewpoint. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Toshi Kani <toshi.kani@hp.com>
This commit is contained in:
parent
f943db40c2
commit
e0ae8fee0e
@ -207,8 +207,6 @@ static int acpi_scan_hot_remove(struct acpi_device *device)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
lock_device_hotplug();
|
||||
|
||||
/*
|
||||
* Carry out two passes here and ignore errors in the first pass,
|
||||
* because if the devices in question are memory blocks and
|
||||
@ -239,9 +237,6 @@ static int acpi_scan_hot_remove(struct acpi_device *device)
|
||||
ACPI_UINT32_MAX,
|
||||
acpi_bus_online_companions, NULL,
|
||||
NULL, NULL);
|
||||
|
||||
unlock_device_hotplug();
|
||||
|
||||
put_device(&device->dev);
|
||||
return -EBUSY;
|
||||
}
|
||||
@ -252,8 +247,6 @@ static int acpi_scan_hot_remove(struct acpi_device *device)
|
||||
|
||||
acpi_bus_trim(device);
|
||||
|
||||
unlock_device_hotplug();
|
||||
|
||||
/* Device node has been unregistered. */
|
||||
put_device(&device->dev);
|
||||
device = NULL;
|
||||
@ -309,6 +302,7 @@ static void acpi_bus_device_eject(void *context)
|
||||
u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE;
|
||||
int error;
|
||||
|
||||
lock_device_hotplug();
|
||||
mutex_lock(&acpi_scan_lock);
|
||||
|
||||
acpi_bus_get_device(handle, &device);
|
||||
@ -332,6 +326,7 @@ static void acpi_bus_device_eject(void *context)
|
||||
|
||||
out:
|
||||
mutex_unlock(&acpi_scan_lock);
|
||||
unlock_device_hotplug();
|
||||
return;
|
||||
|
||||
err_out:
|
||||
@ -346,8 +341,8 @@ static void acpi_scan_bus_device_check(acpi_handle handle, u32 ost_source)
|
||||
u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE;
|
||||
int error;
|
||||
|
||||
mutex_lock(&acpi_scan_lock);
|
||||
lock_device_hotplug();
|
||||
mutex_lock(&acpi_scan_lock);
|
||||
|
||||
if (ost_source != ACPI_NOTIFY_BUS_CHECK) {
|
||||
acpi_bus_get_device(handle, &device);
|
||||
@ -373,9 +368,9 @@ static void acpi_scan_bus_device_check(acpi_handle handle, u32 ost_source)
|
||||
kobject_uevent(&device->dev.kobj, KOBJ_ONLINE);
|
||||
|
||||
out:
|
||||
unlock_device_hotplug();
|
||||
acpi_evaluate_hotplug_ost(handle, ost_source, ost_code, NULL);
|
||||
mutex_unlock(&acpi_scan_lock);
|
||||
unlock_device_hotplug();
|
||||
}
|
||||
|
||||
static void acpi_scan_bus_check(void *context)
|
||||
@ -466,6 +461,7 @@ void acpi_bus_hot_remove_device(void *context)
|
||||
acpi_handle handle = device->handle;
|
||||
int error;
|
||||
|
||||
lock_device_hotplug();
|
||||
mutex_lock(&acpi_scan_lock);
|
||||
|
||||
error = acpi_scan_hot_remove(device);
|
||||
@ -475,6 +471,7 @@ void acpi_bus_hot_remove_device(void *context)
|
||||
NULL);
|
||||
|
||||
mutex_unlock(&acpi_scan_lock);
|
||||
unlock_device_hotplug();
|
||||
kfree(context);
|
||||
}
|
||||
EXPORT_SYMBOL(acpi_bus_hot_remove_device);
|
||||
|
Loading…
Reference in New Issue
Block a user