PNP / ACPI: Use ACPI_COMPANION_SET() during initialization

pnpacpi_add_device() calls acpi_bind_one() on an already registered
device, which is a mistake, but it can initialize the ACPI companion
field of the struct device to be registered using ACPI_COMPANION_SET()
instead, so make it do that.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
This commit is contained in:
Rafael J. Wysocki 2015-03-13 01:45:49 +01:00
parent 06e5801b8c
commit 2eb1eb02dd

View File

@ -248,6 +248,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
if (!dev) if (!dev)
return -ENOMEM; return -ENOMEM;
ACPI_COMPANION_SET(&dev->dev, device);
dev->data = device; dev->data = device;
/* .enabled means the device can decode the resources */ /* .enabled means the device can decode the resources */
dev->active = device->status.enabled; dev->active = device->status.enabled;
@ -290,11 +291,9 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
return error; return error;
} }
error = acpi_bind_one(&dev->dev, device);
num++; num++;
return error; return 0;
} }
static acpi_status __init pnpacpi_add_device_handler(acpi_handle handle, static acpi_status __init pnpacpi_add_device_handler(acpi_handle handle,