From: Rafael J. Wysocki Date: Wed, 16 Jun 2021 14:24:30 +0000 (+0200) Subject: ACPI: scan: Reorganize acpi_device_add() X-Git-Tag: accepted/tizen/unified/20230118.172025~6966^2~4^3~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c6a493a1b603ed216ce69d1faac3f0ddc6a2f8eb;p=platform%2Fkernel%2Flinux-rpi.git 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 Reviewed-by: Hans de Goede --- diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index b0bdd9b..c62ce28 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -633,23 +633,32 @@ static int acpi_device_set_name(struct acpi_device *device, 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, void (*release)(struct device *)) { struct acpi_device_bus_id *acpi_device_bus_id; int result; - if (device->handle) { - acpi_status status; - - 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; - } - } + result = acpi_tie_acpi_dev(device); + if (result) + return result; /* * Linkage