aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-01-30 08:27:37 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-01-30 08:27:37 -0500
commit4daeaf68379f75dedd120582add5206c7c5ad72e (patch)
tree14f6d18fa3070e44dae62b1fc9d2688906e14ab4
parent00c43b9682507dc622c03172fde1032e2a216e9d (diff)
ACPI / PCI: Make PCI IRQ link driver use struct acpi_scan_handler
Make the ACPI PCI IRQ link driver use struct acpi_scan_handler for representing the object used to set up ACPI interrupt links and to remove data structures used for this purpose before unregistering the corresponding 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>
-rw-r--r--drivers/acpi/internal.h1
-rw-r--r--drivers/acpi/pci_link.c47
-rw-r--r--drivers/acpi/scan.c1
3 files changed, 16 insertions, 33 deletions
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h
index 8310ba010176..e5a65217e480 100644
--- a/drivers/acpi/internal.h
+++ b/drivers/acpi/internal.h
@@ -26,6 +26,7 @@
26int init_acpi_device_notify(void); 26int init_acpi_device_notify(void);
27int acpi_scan_init(void); 27int acpi_scan_init(void);
28void acpi_pci_root_init(void); 28void acpi_pci_root_init(void);
29void acpi_pci_link_init(void);
29int acpi_sysfs_init(void); 30int acpi_sysfs_init(void);
30void acpi_csrt_init(void); 31void acpi_csrt_init(void);
31 32
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
index b6592797f5b2..ab764ed34a50 100644
--- a/drivers/acpi/pci_link.c
+++ b/drivers/acpi/pci_link.c
@@ -53,23 +53,19 @@ ACPI_MODULE_NAME("pci_link");
53#define ACPI_PCI_LINK_FILE_STATUS "state" 53#define ACPI_PCI_LINK_FILE_STATUS "state"
54#define ACPI_PCI_LINK_MAX_POSSIBLE 16 54#define ACPI_PCI_LINK_MAX_POSSIBLE 16
55 55
56static int acpi_pci_link_add(struct acpi_device *device); 56static int acpi_pci_link_add(struct acpi_device *device,
57static int acpi_pci_link_remove(struct acpi_device *device); 57 const struct acpi_device_id *not_used);
58static void acpi_pci_link_remove(struct acpi_device *device);
58 59
59static const struct acpi_device_id link_device_ids[] = { 60static const struct acpi_device_id link_device_ids[] = {
60 {"PNP0C0F", 0}, 61 {"PNP0C0F", 0},
61 {"", 0}, 62 {"", 0},
62}; 63};
63MODULE_DEVICE_TABLE(acpi, link_device_ids);
64 64
65static struct acpi_driver acpi_pci_link_driver = { 65static struct acpi_scan_handler pci_link_handler = {
66 .name = "pci_link",
67 .class = ACPI_PCI_LINK_CLASS,
68 .ids = link_device_ids, 66 .ids = link_device_ids,
69 .ops = { 67 .attach = acpi_pci_link_add,
70 .add = acpi_pci_link_add, 68 .detach = acpi_pci_link_remove,
71 .remove = acpi_pci_link_remove,
72 },
73}; 69};
74 70
75/* 71/*
@@ -692,7 +688,8 @@ int acpi_pci_link_free_irq(acpi_handle handle)
692 Driver Interface 688 Driver Interface
693 -------------------------------------------------------------------------- */ 689 -------------------------------------------------------------------------- */
694 690
695static int acpi_pci_link_add(struct acpi_device *device) 691static int acpi_pci_link_add(struct acpi_device *device,
692 const struct acpi_device_id *not_used)
696{ 693{
697 int result; 694 int result;
698 struct acpi_pci_link *link; 695 struct acpi_pci_link *link;
@@ -746,7 +743,7 @@ static int acpi_pci_link_add(struct acpi_device *device)
746 if (result) 743 if (result)
747 kfree(link); 744 kfree(link);
748 745
749 return result; 746 return result < 0 ? result : 1;
750} 747}
751 748
752static int acpi_pci_link_resume(struct acpi_pci_link *link) 749static int acpi_pci_link_resume(struct acpi_pci_link *link)
@@ -766,7 +763,7 @@ static void irqrouter_resume(void)
766 } 763 }
767} 764}
768 765
769static int acpi_pci_link_remove(struct acpi_device *device) 766static void acpi_pci_link_remove(struct acpi_device *device)
770{ 767{
771 struct acpi_pci_link *link; 768 struct acpi_pci_link *link;
772 769
@@ -777,7 +774,6 @@ static int acpi_pci_link_remove(struct acpi_device *device)
777 mutex_unlock(&acpi_link_lock); 774 mutex_unlock(&acpi_link_lock);
778 775
779 kfree(link); 776 kfree(link);
780 return 0;
781} 777}
782 778
783/* 779/*
@@ -874,20 +870,10 @@ static struct syscore_ops irqrouter_syscore_ops = {
874 .resume = irqrouter_resume, 870 .resume = irqrouter_resume,
875}; 871};
876 872
877static int __init irqrouter_init_ops(void) 873void __init acpi_pci_link_init(void)
878{
879 if (!acpi_disabled && !acpi_noirq)
880 register_syscore_ops(&irqrouter_syscore_ops);
881
882 return 0;
883}
884
885device_initcall(irqrouter_init_ops);
886
887static int __init acpi_pci_link_init(void)
888{ 874{
889 if (acpi_noirq) 875 if (acpi_noirq)
890 return 0; 876 return;
891 877
892 if (acpi_irq_balance == -1) { 878 if (acpi_irq_balance == -1) {
893 /* no command line switch: enable balancing in IOAPIC mode */ 879 /* no command line switch: enable balancing in IOAPIC mode */
@@ -896,11 +882,6 @@ static int __init acpi_pci_link_init(void)
896 else 882 else
897 acpi_irq_balance = 0; 883 acpi_irq_balance = 0;
898 } 884 }
899 885 register_syscore_ops(&irqrouter_syscore_ops);
900 if (acpi_bus_register_driver(&acpi_pci_link_driver) < 0) 886 acpi_scan_add_handler(&pci_link_handler);
901 return -ENODEV;
902
903 return 0;
904} 887}
905
906subsys_initcall(acpi_pci_link_init);
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 1453cd0672fb..c2821699bc49 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -1774,6 +1774,7 @@ int __init acpi_scan_init(void)
1774 } 1774 }
1775 1775
1776 acpi_pci_root_init(); 1776 acpi_pci_root_init();
1777 acpi_pci_link_init();
1777 acpi_csrt_init(); 1778 acpi_csrt_init();
1778 1779
1779 /* 1780 /*