aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/pci_root.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2012-12-20 18:36:45 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-01-03 07:09:38 -0500
commit47525cda88f5cc4dbe24de1cc05617c08e2d7c4a (patch)
treef9dd5a239d338045e49894c190bc3a540693f40d /drivers/acpi/pci_root.c
parent4002bf384cc567a843a7d16c95db54a7d77b16c6 (diff)
ACPI / PCI: Fold acpi_pci_root_start() into acpi_pci_root_add()
Move the code from the ACPI PCI root bridge's .start() callback routine, acpi_pci_root_start(), directly into acpi_pci_root_add() and drop acpi_pci_root_start(). It is safe to do that, because it is now always guaranteed that when struct pci_dev objects are created, their companion struct acpi_device objects are already present, so it is not necessary to wait for them to be created before calling pci_bus_add_devices(). This change was previously proposed in a different form by Yinghai Lu. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Yinghai Lu <yinghai@kernel.org> Acked-by: Toshi Kani <toshi.kani@hp.com>
Diffstat (limited to 'drivers/acpi/pci_root.c')
-rw-r--r--drivers/acpi/pci_root.c32
1 files changed, 11 insertions, 21 deletions
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index a233fe93dfac..0e593a203ff8 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -47,7 +47,6 @@ ACPI_MODULE_NAME("pci_root");
47#define ACPI_PCI_ROOT_DEVICE_NAME "PCI Root Bridge" 47#define ACPI_PCI_ROOT_DEVICE_NAME "PCI Root Bridge"
48static int acpi_pci_root_add(struct acpi_device *device); 48static int acpi_pci_root_add(struct acpi_device *device);
49static int acpi_pci_root_remove(struct acpi_device *device, int type); 49static int acpi_pci_root_remove(struct acpi_device *device, int type);
50static int acpi_pci_root_start(struct acpi_device *device);
51 50
52#define ACPI_PCIE_REQ_SUPPORT (OSC_EXT_PCI_CONFIG_SUPPORT \ 51#define ACPI_PCIE_REQ_SUPPORT (OSC_EXT_PCI_CONFIG_SUPPORT \
53 | OSC_ACTIVE_STATE_PWR_SUPPORT \ 52 | OSC_ACTIVE_STATE_PWR_SUPPORT \
@@ -67,7 +66,6 @@ static struct acpi_driver acpi_pci_root_driver = {
67 .ops = { 66 .ops = {
68 .add = acpi_pci_root_add, 67 .add = acpi_pci_root_add,
69 .remove = acpi_pci_root_remove, 68 .remove = acpi_pci_root_remove,
70 .start = acpi_pci_root_start,
71 }, 69 },
72}; 70};
73 71
@@ -453,6 +451,7 @@ static int acpi_pci_root_add(struct acpi_device *device)
453 struct acpi_pci_root *root; 451 struct acpi_pci_root *root;
454 acpi_handle handle; 452 acpi_handle handle;
455 struct acpi_device *child; 453 struct acpi_device *child;
454 struct acpi_pci_driver *driver;
456 u32 flags, base_flags; 455 u32 flags, base_flags;
457 bool is_osc_granted = false; 456 bool is_osc_granted = false;
458 457
@@ -632,24 +631,6 @@ static int acpi_pci_root_add(struct acpi_device *device)
632 if (device->wakeup.flags.run_wake) 631 if (device->wakeup.flags.run_wake)
633 device_set_run_wake(root->bus->bridge, true); 632 device_set_run_wake(root->bus->bridge, true);
634 633
635 return 0;
636
637out_del_root:
638 mutex_lock(&acpi_pci_root_lock);
639 list_del(&root->node);
640 mutex_unlock(&acpi_pci_root_lock);
641
642 acpi_pci_irq_del_prt(root->segment, root->secondary.start);
643end:
644 kfree(root);
645 return result;
646}
647
648static int acpi_pci_root_start(struct acpi_device *device)
649{
650 struct acpi_pci_root *root = acpi_driver_data(device);
651 struct acpi_pci_driver *driver;
652
653 if (system_state != SYSTEM_BOOTING) 634 if (system_state != SYSTEM_BOOTING)
654 pci_assign_unassigned_bus_resources(root->bus); 635 pci_assign_unassigned_bus_resources(root->bus);
655 636
@@ -664,8 +645,17 @@ static int acpi_pci_root_start(struct acpi_device *device)
664 pci_enable_bridges(root->bus); 645 pci_enable_bridges(root->bus);
665 646
666 pci_bus_add_devices(root->bus); 647 pci_bus_add_devices(root->bus);
667
668 return 0; 648 return 0;
649
650out_del_root:
651 mutex_lock(&acpi_pci_root_lock);
652 list_del(&root->node);
653 mutex_unlock(&acpi_pci_root_lock);
654
655 acpi_pci_irq_del_prt(root->segment, root->secondary.start);
656end:
657 kfree(root);
658 return result;
669} 659}
670 660
671static int acpi_pci_root_remove(struct acpi_device *device, int type) 661static int acpi_pci_root_remove(struct acpi_device *device, int type)