Skip to content

Commit c6a493a

Browse files
committed
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 <[email protected]> Reviewed-by: Hans de Goede <[email protected]>
1 parent dc61248 commit c6a493a

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

drivers/acpi/scan.c

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -633,23 +633,32 @@ static int acpi_device_set_name(struct acpi_device *device,
633633
return 0;
634634
}
635635

636+
static int acpi_tie_acpi_dev(struct acpi_device *adev)
637+
{
638+
acpi_handle handle = adev->handle;
639+
acpi_status status;
640+
641+
if (!handle)
642+
return 0;
643+
644+
status = acpi_attach_data(handle, acpi_scan_drop_device, adev);
645+
if (ACPI_FAILURE(status)) {
646+
acpi_handle_err(handle, "Unable to attach device data\n");
647+
return -ENODEV;
648+
}
649+
650+
return 0;
651+
}
652+
636653
int acpi_device_add(struct acpi_device *device,
637654
void (*release)(struct device *))
638655
{
639656
struct acpi_device_bus_id *acpi_device_bus_id;
640657
int result;
641658

642-
if (device->handle) {
643-
acpi_status status;
644-
645-
status = acpi_attach_data(device->handle, acpi_scan_drop_device,
646-
device);
647-
if (ACPI_FAILURE(status)) {
648-
acpi_handle_err(device->handle,
649-
"Unable to attach device data\n");
650-
return -ENODEV;
651-
}
652-
}
659+
result = acpi_tie_acpi_dev(device);
660+
if (result)
661+
return result;
653662

654663
/*
655664
* Linkage

0 commit comments

Comments
 (0)