diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-01-30 08:27:37 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-01-30 08:27:37 -0500 |
commit | 4daeaf68379f75dedd120582add5206c7c5ad72e (patch) | |
tree | 14f6d18fa3070e44dae62b1fc9d2688906e14ab4 | |
parent | 00c43b9682507dc622c03172fde1032e2a216e9d (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.h | 1 | ||||
-rw-r--r-- | drivers/acpi/pci_link.c | 47 | ||||
-rw-r--r-- | drivers/acpi/scan.c | 1 |
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 @@ | |||
26 | int init_acpi_device_notify(void); | 26 | int init_acpi_device_notify(void); |
27 | int acpi_scan_init(void); | 27 | int acpi_scan_init(void); |
28 | void acpi_pci_root_init(void); | 28 | void acpi_pci_root_init(void); |
29 | void acpi_pci_link_init(void); | ||
29 | int acpi_sysfs_init(void); | 30 | int acpi_sysfs_init(void); |
30 | void acpi_csrt_init(void); | 31 | void 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 | ||
56 | static int acpi_pci_link_add(struct acpi_device *device); | 56 | static int acpi_pci_link_add(struct acpi_device *device, |
57 | static int acpi_pci_link_remove(struct acpi_device *device); | 57 | const struct acpi_device_id *not_used); |
58 | static void acpi_pci_link_remove(struct acpi_device *device); | ||
58 | 59 | ||
59 | static const struct acpi_device_id link_device_ids[] = { | 60 | static const struct acpi_device_id link_device_ids[] = { |
60 | {"PNP0C0F", 0}, | 61 | {"PNP0C0F", 0}, |
61 | {"", 0}, | 62 | {"", 0}, |
62 | }; | 63 | }; |
63 | MODULE_DEVICE_TABLE(acpi, link_device_ids); | ||
64 | 64 | ||
65 | static struct acpi_driver acpi_pci_link_driver = { | 65 | static 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 | ||
695 | static int acpi_pci_link_add(struct acpi_device *device) | 691 | static 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 | ||
752 | static int acpi_pci_link_resume(struct acpi_pci_link *link) | 749 | static 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 | ||
769 | static int acpi_pci_link_remove(struct acpi_device *device) | 766 | static 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 | ||
877 | static int __init irqrouter_init_ops(void) | 873 | void __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 | |||
885 | device_initcall(irqrouter_init_ops); | ||
886 | |||
887 | static 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 | |||
906 | subsys_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 | /* |