ACPI: scan: Reorganize acpi_device_add()
Move the invocation of acpi_attach_data() in acpi_device_add() into a separate function. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
dc612486c9
commit
c6a493a1b6
|
@ -633,23 +633,32 @@ static int acpi_device_set_name(struct acpi_device *device,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int acpi_tie_acpi_dev(struct acpi_device *adev)
|
||||||
|
{
|
||||||
|
acpi_handle handle = adev->handle;
|
||||||
|
acpi_status status;
|
||||||
|
|
||||||
|
if (!handle)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
status = acpi_attach_data(handle, acpi_scan_drop_device, adev);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
acpi_handle_err(handle, "Unable to attach device data\n");
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int acpi_device_add(struct acpi_device *device,
|
int acpi_device_add(struct acpi_device *device,
|
||||||
void (*release)(struct device *))
|
void (*release)(struct device *))
|
||||||
{
|
{
|
||||||
struct acpi_device_bus_id *acpi_device_bus_id;
|
struct acpi_device_bus_id *acpi_device_bus_id;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
if (device->handle) {
|
result = acpi_tie_acpi_dev(device);
|
||||||
acpi_status status;
|
if (result)
|
||||||
|
return result;
|
||||||
status = acpi_attach_data(device->handle, acpi_scan_drop_device,
|
|
||||||
device);
|
|
||||||
if (ACPI_FAILURE(status)) {
|
|
||||||
acpi_handle_err(device->handle,
|
|
||||||
"Unable to attach device data\n");
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Linkage
|
* Linkage
|
||||||
|
|
Loading…
Reference in New Issue