[PATCH 2/6] ACPI: Change the ordering of PCI root bridge driver registrarion

From: Rafael J. Wysocki
Date: Sun Dec 09 2012 - 18:00:58 EST


From: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>

Devices created by acpi_create_platform_device() sometimes may need
to be added to the device hierarchy as children of PCI bridges. For
this purpose, however, the struct pci_dev objects representing those
bridges need to exist before the platform devices in question are
added, but this is only possible if the PCI root bridge driver is
registered before the initial scanning of the ACPI namespace
(that driver's .add() routine creates the required struct pci_dev
objects).

For this reason, call acpi_pci_root_init() from acpi_scan_init()
before scanning the ACPI namespace for the first time instead of
running it from a separate subsys initcall. Since the previous patch
has changed the ACPI namespace scanning algorithm, this change does
not affect the PCI root bridge driver's functionality during boot.
It also makes the situation during boot more similar to the situation
during hot-plug (in which the PCI root bridge driver is always
present) and so it helps to reduce arbitary differences between
the hot-plug and boot PCI root bridge code.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
---
drivers/acpi/internal.h | 1 +
drivers/acpi/pci_root.c | 4 +---
drivers/acpi/scan.c | 1 +
3 files changed, 3 insertions(+), 3 deletions(-)

Index: linux/drivers/acpi/internal.h
===================================================================
--- linux.orig/drivers/acpi/internal.h
+++ linux/drivers/acpi/internal.h
@@ -67,6 +67,7 @@ struct acpi_ec {

extern struct acpi_ec *first_ec;

+int acpi_pci_root_init(void);
int acpi_ec_init(void);
int acpi_ec_ecdt_probe(void);
int acpi_boot_ec_enable(void);
Index: linux/drivers/acpi/pci_root.c
===================================================================
--- linux.orig/drivers/acpi/pci_root.c
+++ linux/drivers/acpi/pci_root.c
@@ -674,7 +674,7 @@ static int acpi_pci_root_remove(struct a
return 0;
}

-static int __init acpi_pci_root_init(void)
+int __init acpi_pci_root_init(void)
{
acpi_hest_init();

@@ -687,5 +687,3 @@ static int __init acpi_pci_root_init(voi

return 0;
}
-
-subsys_initcall(acpi_pci_root_init);
Index: linux/drivers/acpi/scan.c
===================================================================
--- linux.orig/drivers/acpi/scan.c
+++ linux/drivers/acpi/scan.c
@@ -1828,6 +1828,7 @@ int __init acpi_scan_init(void)
}

acpi_power_init();
+ acpi_pci_root_init();

/*
* Enumerate devices in the ACPI namespace.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/