aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/pci_root.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-01-30 08:27:33 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-01-30 08:27:33 -0500
commit00c43b9682507dc622c03172fde1032e2a216e9d (patch)
treec863a94c5370d734532c7161f72f8ced4cd4498d /drivers/acpi/pci_root.c
parentca589f9469641916f4f9bd6a820012a27102ef63 (diff)
ACPI / PCI: Make PCI root driver use struct acpi_scan_handler
Make the ACPI PCI root bridge driver use struct acpi_scan_handler for representing the object used to enumerate the PCI busses under PCI host bridges found in the ACPI namespace (and to tear down data structures representing the bus and devices on it before unregistering the host bridges' ACPI device nodes). This simplifies the code slightly and reduces the kernel's memory footprint by avoiding the registration of a struct device_driver object with the driver core and creation of its sysfs directory which is unnecessary. 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.c38
1 files changed, 15 insertions, 23 deletions
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index 8890775e8b25..b3cc69c5caf1 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -45,8 +45,9 @@
45ACPI_MODULE_NAME("pci_root"); 45ACPI_MODULE_NAME("pci_root");
46#define ACPI_PCI_ROOT_CLASS "pci_bridge" 46#define ACPI_PCI_ROOT_CLASS "pci_bridge"
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); 49 const struct acpi_device_id *not_used);
50static void acpi_pci_root_remove(struct acpi_device *device);
50 51
51#define ACPI_PCIE_REQ_SUPPORT (OSC_EXT_PCI_CONFIG_SUPPORT \ 52#define ACPI_PCIE_REQ_SUPPORT (OSC_EXT_PCI_CONFIG_SUPPORT \
52 | OSC_ACTIVE_STATE_PWR_SUPPORT \ 53 | OSC_ACTIVE_STATE_PWR_SUPPORT \
@@ -57,16 +58,11 @@ static const struct acpi_device_id root_device_ids[] = {
57 {"PNP0A03", 0}, 58 {"PNP0A03", 0},
58 {"", 0}, 59 {"", 0},
59}; 60};
60MODULE_DEVICE_TABLE(acpi, root_device_ids);
61 61
62static struct acpi_driver acpi_pci_root_driver = { 62static struct acpi_scan_handler pci_root_handler = {
63 .name = "pci_root",
64 .class = ACPI_PCI_ROOT_CLASS,
65 .ids = root_device_ids, 63 .ids = root_device_ids,
66 .ops = { 64 .attach = acpi_pci_root_add,
67 .add = acpi_pci_root_add, 65 .detach = acpi_pci_root_remove,
68 .remove = acpi_pci_root_remove,
69 },
70}; 66};
71 67
72/* Lock to protect both acpi_pci_roots and acpi_pci_drivers lists */ 68/* Lock to protect both acpi_pci_roots and acpi_pci_drivers lists */
@@ -428,7 +424,8 @@ out:
428} 424}
429EXPORT_SYMBOL(acpi_pci_osc_control_set); 425EXPORT_SYMBOL(acpi_pci_osc_control_set);
430 426
431static int acpi_pci_root_add(struct acpi_device *device) 427static int acpi_pci_root_add(struct acpi_device *device,
428 const struct acpi_device_id *not_used)
432{ 429{
433 unsigned long long segment, bus; 430 unsigned long long segment, bus;
434 acpi_status status; 431 acpi_status status;
@@ -614,7 +611,7 @@ static int acpi_pci_root_add(struct acpi_device *device)
614 pci_enable_bridges(root->bus); 611 pci_enable_bridges(root->bus);
615 612
616 pci_bus_add_devices(root->bus); 613 pci_bus_add_devices(root->bus);
617 return 0; 614 return 1;
618 615
619out_del_root: 616out_del_root:
620 mutex_lock(&acpi_pci_root_lock); 617 mutex_lock(&acpi_pci_root_lock);
@@ -627,7 +624,7 @@ end:
627 return result; 624 return result;
628} 625}
629 626
630static int acpi_pci_root_remove(struct acpi_device *device) 627static void acpi_pci_root_remove(struct acpi_device *device)
631{ 628{
632 acpi_status status; 629 acpi_status status;
633 acpi_handle handle; 630 acpi_handle handle;
@@ -655,19 +652,14 @@ static int acpi_pci_root_remove(struct acpi_device *device)
655 list_del(&root->node); 652 list_del(&root->node);
656 mutex_unlock(&acpi_pci_root_lock); 653 mutex_unlock(&acpi_pci_root_lock);
657 kfree(root); 654 kfree(root);
658 return 0;
659} 655}
660 656
661int __init acpi_pci_root_init(void) 657void __init acpi_pci_root_init(void)
662{ 658{
663 acpi_hest_init(); 659 acpi_hest_init();
664 660
665 if (acpi_pci_disabled) 661 if (!acpi_pci_disabled) {
666 return 0; 662 pci_acpi_crs_quirks();
667 663 acpi_scan_add_handler(&pci_root_handler);
668 pci_acpi_crs_quirks(); 664 }
669 if (acpi_bus_register_driver(&acpi_pci_root_driver) < 0)
670 return -ENODEV;
671
672 return 0;
673} 665}