[PATCH master 2/3] efi: acpi: add SDT resource before registering device

Ahmad Fatoum ahmad at a3f.at
Mon Jan 9 00:35:59 PST 2023


Registering a device may end up probing the device if a driver is
readily available. This necessitates the device having its resources
assigned before doing the registration.

Signed-off-by: Ahmad Fatoum <ahmad at a3f.at>
---
 drivers/bus/acpi.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/bus/acpi.c b/drivers/bus/acpi.c
index 354a6119b92f..f69789200633 100644
--- a/drivers/bus/acpi.c
+++ b/drivers/bus/acpi.c
@@ -122,18 +122,12 @@ static void acpi_devinfo(struct device *dev)
 
 static int acpi_register_device(struct device *dev, struct acpi_sdt *sdt)
 {
-	int ret;
-
-	ret = register_device(dev);
-	if (ret)
-		return ret;
-
 	device_add_resource(dev, "SDT", (resource_size_t)sdt, sdt->len,
 		IORESOURCE_MEM | IORESOURCE_ROM_COPY | IORESOURCE_ROM_BIOS_COPY);
 
-	dev_dbg(dev, "registered as ACPI device\n");
+	dev_dbg(dev, "registering as ACPI device\n");
 
-	return 0;
+	return register_device(dev);
 }
 
 static struct device *acpi_add_device(struct bus_type *bus,
-- 
2.38.1




More information about the barebox mailing list