| Subject: move acpi to use device_init_and_add |
| |
| --- |
| drivers/acpi/scan.c | 13 ++++++------- |
| 1 file changed, 6 insertions(+), 7 deletions(-) |
| |
| --- a/drivers/acpi/scan.c |
| +++ b/drivers/acpi/scan.c |
| @@ -423,6 +423,7 @@ static int acpi_device_register(struct a |
| int result; |
| struct acpi_device_bus_id *acpi_device_bus_id, *new_bus_id; |
| int found = 0; |
| + struct device *dev_parent = NULL; |
| /* |
| * Linkage |
| * ------- |
| @@ -458,23 +459,21 @@ static int acpi_device_register(struct a |
| acpi_device_bus_id->instance_no = 0; |
| list_add_tail(&acpi_device_bus_id->node, &acpi_bus_id_list); |
| } |
| - dev_set_name(&device->dev, "%s:%02x", acpi_device_bus_id->bus_id, acpi_device_bus_id->instance_no); |
| |
| if (device->parent) { |
| list_add_tail(&device->node, &device->parent->children); |
| list_add_tail(&device->g_list, &device->parent->g_list); |
| + dev_parent = &parent->dev; |
| } else |
| list_add_tail(&device->g_list, &acpi_device_list); |
| if (device->wakeup.flags.valid) |
| list_add_tail(&device->wakeup_list, &acpi_wakeup_device_list); |
| spin_unlock(&acpi_device_lock); |
| |
| - if (device->parent) |
| - device->dev.parent = &parent->dev; |
| - device->dev.bus = &acpi_bus_type; |
| - device_initialize(&device->dev); |
| - device->dev.release = &acpi_device_release; |
| - result = device_add(&device->dev); |
| + result = device_init_and_add(&device->dev, dev_parent, &acpi_bus_type, |
| + &acpi_device_release, "%s:%02x", |
| + acpi_device_bus_id->bus_id, |
| + acpi_device_bus_id->instance_no); |
| if(result) { |
| dev_err(&device->dev, "Error adding device\n"); |
| goto end; |