Skip to contentSkip to conversation

PNP / ACPI: Use ACPI_COMPANION_SET() during initialization

PATCH In review Rafael J. Wysocki 2 participants 2 messages Mar 13, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PNP / ACPI: Use ACPI_COMPANION_SET() during initialization

From: Rafael J. Wysocki <[email protected]>

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.

---
 drivers/pnp/pnpacpi/core.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/pnp/pnpacpi/core.c +2 -3
Index: linux-pm/drivers/pnp/pnpacpi/core.c
===================================================================
@@ -248,6 +248,7 @@ static int __init pnpacpi_add_device(str
 	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;
@@ -290,11 +291,9 @@ static int __init pnpacpi_add_device(str
 		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,
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

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.

Makes sense.