Skip to content

Commit

Permalink
PNP / ACPI: Use ACPI_COMPANION_SET() during initialization
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Mika Westerberg <[email protected]>
  • Loading branch information
rafaeljw committed Mar 16, 2015
1 parent 06e5801 commit 2eb1eb0
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/pnp/pnpacpi/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
if (!dev)
return -ENOMEM;

ACPI_COMPANION_SET(&dev->dev, device);
dev->data = device;
/* .enabled means the device can decode the resources */
dev->active = device->status.enabled;
Expand Down Expand Up @@ -290,11 +291,9 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
return error;
}

error = acpi_bind_one(&dev->dev, device);

num++;

return error;
return 0;
}

static acpi_status __init pnpacpi_add_device_handler(acpi_handle handle,
Expand Down

0 comments on commit 2eb1eb0

Please sign in to comment.