diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-07-13 17:27:23 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-07-22 21:58:42 -0400 |
commit | be1c9de98d8904c75a5ab8b2a0d97bea0f7c07cc (patch) | |
tree | 43c1f3632a3b8be20cae5db77bdcd2f0852acdd7 | |
parent | b9eb179fe6d9acc11a54194d2df147e991f049aa (diff) |
ACPI / PCI: Make bus registration and unregistration symmetric
Since acpi_pci_slot_enumerate() and acpiphp_enumerate_slots() can get
the ACPI device handle they need from bus->bridge, it is not
necessary to pass that handle to them as an argument.
Drop the second argument of acpi_pci_slot_enumerate() and
acpiphp_enumerate_slots(), rework them to obtain the ACPI handle
from bus->bridge and make acpi_pci_add_bus() and
acpi_pci_remove_bus() entirely symmetrical.
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Yinghai Lu <yinghai@kernel.org>
-rw-r--r-- | drivers/acpi/pci_slot.c | 14 | ||||
-rw-r--r-- | drivers/pci/hotplug/acpiphp_glue.c | 6 | ||||
-rw-r--r-- | drivers/pci/pci-acpi.c | 16 | ||||
-rw-r--r-- | include/linux/pci-acpi.h | 10 |
4 files changed, 21 insertions, 25 deletions
diff --git a/drivers/acpi/pci_slot.c b/drivers/acpi/pci_slot.c index 033d1179bdb5..d678a180ca2a 100644 --- a/drivers/acpi/pci_slot.c +++ b/drivers/acpi/pci_slot.c | |||
@@ -159,12 +159,16 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv) | |||
159 | return AE_OK; | 159 | return AE_OK; |
160 | } | 160 | } |
161 | 161 | ||
162 | void acpi_pci_slot_enumerate(struct pci_bus *bus, acpi_handle handle) | 162 | void acpi_pci_slot_enumerate(struct pci_bus *bus) |
163 | { | 163 | { |
164 | mutex_lock(&slot_list_lock); | 164 | acpi_handle handle = ACPI_HANDLE(bus->bridge); |
165 | acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1, | 165 | |
166 | register_slot, NULL, bus, NULL); | 166 | if (handle) { |
167 | mutex_unlock(&slot_list_lock); | 167 | mutex_lock(&slot_list_lock); |
168 | acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1, | ||
169 | register_slot, NULL, bus, NULL); | ||
170 | mutex_unlock(&slot_list_lock); | ||
171 | } | ||
168 | } | 172 | } |
169 | 173 | ||
170 | void acpi_pci_slot_remove(struct pci_bus *bus) | 174 | void acpi_pci_slot_remove(struct pci_bus *bus) |
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 8bfad0dc29ab..a203ba529fef 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
@@ -1147,14 +1147,16 @@ static void handle_hotplug_event_func(acpi_handle handle, u32 type, | |||
1147 | * Create hotplug slots for the PCI bus. | 1147 | * Create hotplug slots for the PCI bus. |
1148 | * It should always return 0 to avoid skipping following notifiers. | 1148 | * It should always return 0 to avoid skipping following notifiers. |
1149 | */ | 1149 | */ |
1150 | void acpiphp_enumerate_slots(struct pci_bus *bus, acpi_handle handle) | 1150 | void acpiphp_enumerate_slots(struct pci_bus *bus) |
1151 | { | 1151 | { |
1152 | acpi_handle handle; | ||
1152 | struct acpiphp_bridge *bridge; | 1153 | struct acpiphp_bridge *bridge; |
1153 | 1154 | ||
1154 | if (acpiphp_disabled) | 1155 | if (acpiphp_disabled) |
1155 | return; | 1156 | return; |
1156 | 1157 | ||
1157 | if (detect_ejectable_slots(handle) <= 0) | 1158 | handle = ACPI_HANDLE(bus->bridge); |
1159 | if (!handle || detect_ejectable_slots(handle) <= 0) | ||
1158 | return; | 1160 | return; |
1159 | 1161 | ||
1160 | bridge = kzalloc(sizeof(struct acpiphp_bridge), GFP_KERNEL); | 1162 | bridge = kzalloc(sizeof(struct acpiphp_bridge), GFP_KERNEL); |
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index dbdc5f7e2b29..c78cc432edab 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -290,24 +290,16 @@ static struct pci_platform_pm_ops acpi_pci_platform_pm = { | |||
290 | 290 | ||
291 | void acpi_pci_add_bus(struct pci_bus *bus) | 291 | void acpi_pci_add_bus(struct pci_bus *bus) |
292 | { | 292 | { |
293 | acpi_handle handle = NULL; | 293 | if (acpi_pci_disabled || !bus->bridge) |
294 | |||
295 | if (bus->bridge) | ||
296 | handle = ACPI_HANDLE(bus->bridge); | ||
297 | if (acpi_pci_disabled || handle == NULL) | ||
298 | return; | 294 | return; |
299 | 295 | ||
300 | acpi_pci_slot_enumerate(bus, handle); | 296 | acpi_pci_slot_enumerate(bus); |
301 | acpiphp_enumerate_slots(bus, handle); | 297 | acpiphp_enumerate_slots(bus); |
302 | } | 298 | } |
303 | 299 | ||
304 | void acpi_pci_remove_bus(struct pci_bus *bus) | 300 | void acpi_pci_remove_bus(struct pci_bus *bus) |
305 | { | 301 | { |
306 | /* | 302 | if (acpi_pci_disabled || !bus->bridge) |
307 | * bus->bridge->acpi_node.handle has already been reset to NULL | ||
308 | * when acpi_pci_remove_bus() is called, so don't check ACPI handle. | ||
309 | */ | ||
310 | if (acpi_pci_disabled) | ||
311 | return; | 303 | return; |
312 | 304 | ||
313 | acpiphp_remove_slots(bus); | 305 | acpiphp_remove_slots(bus); |
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h index 170447977278..d006f0ca60f4 100644 --- a/include/linux/pci-acpi.h +++ b/include/linux/pci-acpi.h | |||
@@ -47,24 +47,22 @@ void acpi_pci_remove_bus(struct pci_bus *bus); | |||
47 | 47 | ||
48 | #ifdef CONFIG_ACPI_PCI_SLOT | 48 | #ifdef CONFIG_ACPI_PCI_SLOT |
49 | void acpi_pci_slot_init(void); | 49 | void acpi_pci_slot_init(void); |
50 | void acpi_pci_slot_enumerate(struct pci_bus *bus, acpi_handle handle); | 50 | void acpi_pci_slot_enumerate(struct pci_bus *bus); |
51 | void acpi_pci_slot_remove(struct pci_bus *bus); | 51 | void acpi_pci_slot_remove(struct pci_bus *bus); |
52 | #else | 52 | #else |
53 | static inline void acpi_pci_slot_init(void) { } | 53 | static inline void acpi_pci_slot_init(void) { } |
54 | static inline void acpi_pci_slot_enumerate(struct pci_bus *bus, | 54 | static inline void acpi_pci_slot_enumerate(struct pci_bus *bus) { } |
55 | acpi_handle handle) { } | ||
56 | static inline void acpi_pci_slot_remove(struct pci_bus *bus) { } | 55 | static inline void acpi_pci_slot_remove(struct pci_bus *bus) { } |
57 | #endif | 56 | #endif |
58 | 57 | ||
59 | #ifdef CONFIG_HOTPLUG_PCI_ACPI | 58 | #ifdef CONFIG_HOTPLUG_PCI_ACPI |
60 | void acpiphp_init(void); | 59 | void acpiphp_init(void); |
61 | void acpiphp_enumerate_slots(struct pci_bus *bus, acpi_handle handle); | 60 | void acpiphp_enumerate_slots(struct pci_bus *bus); |
62 | void acpiphp_remove_slots(struct pci_bus *bus); | 61 | void acpiphp_remove_slots(struct pci_bus *bus); |
63 | void acpiphp_check_host_bridge(acpi_handle handle); | 62 | void acpiphp_check_host_bridge(acpi_handle handle); |
64 | #else | 63 | #else |
65 | static inline void acpiphp_init(void) { } | 64 | static inline void acpiphp_init(void) { } |
66 | static inline void acpiphp_enumerate_slots(struct pci_bus *bus, | 65 | static inline void acpiphp_enumerate_slots(struct pci_bus *bus) { } |
67 | acpi_handle handle) { } | ||
68 | static inline void acpiphp_remove_slots(struct pci_bus *bus) { } | 66 | static inline void acpiphp_remove_slots(struct pci_bus *bus) { } |
69 | static inline void acpiphp_check_host_bridge(acpi_handle handle) { } | 67 | static inline void acpiphp_check_host_bridge(acpi_handle handle) { } |
70 | #endif | 68 | #endif |