aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/acpiphp_glue.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-07-04 21:03:25 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-07-14 19:33:12 -0400
commitf09ce741a03ad7de591aa47e760fbeee28567b63 (patch)
tree2cbbd5f36902f161102ca5e9348bb6bdae62600f /drivers/pci/hotplug/acpiphp_glue.c
parente6c215f15a1cbf4cdd6996d95fba0c0d6c0f3ccc (diff)
ACPI / dock / PCI: Drop ACPI dock notifier chain
The only user of the ACPI dock notifier chain is the ACPI-based PCI hotplug (acpiphp) driver that uses it to carry out post-dock fixups needed by some systems with broken _DCK. However, it is not necessary to use a separate notifier chain for that, as it can be simply replaced with a new callback in struct acpi_dock_ops. For this reason, add a new .fixup() callback to struct acpi_dock_ops and make hotplug_dock_devices() execute it for all dock devices with hotplug operations registered. Accordingly, make acpiphp point that callback to the function carrying out the post-dock fixups and do not register a separate dock notifier for each device registering dock operations. Finally, drop the ACPI dock notifier chain that has no more users. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/pci/hotplug/acpiphp_glue.c')
-rw-r--r--drivers/pci/hotplug/acpiphp_glue.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index a0a7133a1d12..8bfad0dc29ab 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -119,15 +119,14 @@ static void free_bridge(struct kref *kref)
119 * TBD - figure out a way to only call fixups for 119 * TBD - figure out a way to only call fixups for
120 * systems that require them. 120 * systems that require them.
121 */ 121 */
122static int post_dock_fixups(struct notifier_block *nb, unsigned long val, 122static void post_dock_fixups(acpi_handle not_used, u32 event, void *data)
123 void *v)
124{ 123{
125 struct acpiphp_func *func = container_of(nb, struct acpiphp_func, nb); 124 struct acpiphp_func *func = data;
126 struct pci_bus *bus = func->slot->bridge->pci_bus; 125 struct pci_bus *bus = func->slot->bridge->pci_bus;
127 u32 buses; 126 u32 buses;
128 127
129 if (!bus->self) 128 if (!bus->self)
130 return NOTIFY_OK; 129 return;
131 130
132 /* fixup bad _DCK function that rewrites 131 /* fixup bad _DCK function that rewrites
133 * secondary bridge on slot 132 * secondary bridge on slot
@@ -143,11 +142,11 @@ static int post_dock_fixups(struct notifier_block *nb, unsigned long val,
143 | ((unsigned int)(bus->busn_res.end) << 16); 142 | ((unsigned int)(bus->busn_res.end) << 16);
144 pci_write_config_dword(bus->self, PCI_PRIMARY_BUS, buses); 143 pci_write_config_dword(bus->self, PCI_PRIMARY_BUS, buses);
145 } 144 }
146 return NOTIFY_OK;
147} 145}
148 146
149 147
150static const struct acpi_dock_ops acpiphp_dock_ops = { 148static const struct acpi_dock_ops acpiphp_dock_ops = {
149 .fixup = post_dock_fixups,
151 .handler = hotplug_event_func, 150 .handler = hotplug_event_func,
152}; 151};
153 152
@@ -315,14 +314,6 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv)
315 &acpiphp_dock_ops, newfunc, 314 &acpiphp_dock_ops, newfunc,
316 acpiphp_dock_init, acpiphp_dock_release)) 315 acpiphp_dock_init, acpiphp_dock_release))
317 dbg("failed to register dock device\n"); 316 dbg("failed to register dock device\n");
318
319 /* we need to be notified when dock events happen
320 * outside of the hotplug operation, since we may
321 * need to do fixups before we can hotplug.
322 */
323 newfunc->nb.notifier_call = post_dock_fixups;
324 if (register_dock_notifier(&newfunc->nb))
325 dbg("failed to register a dock notifier");
326 } 317 }
327 318
328 /* install notify handler */ 319 /* install notify handler */
@@ -472,7 +463,6 @@ static void cleanup_bridge(struct acpiphp_bridge *bridge)
472 list_for_each_entry(func, &slot->funcs, sibling) { 463 list_for_each_entry(func, &slot->funcs, sibling) {
473 if (is_dock_device(func->handle)) { 464 if (is_dock_device(func->handle)) {
474 unregister_hotplug_dock_device(func->handle); 465 unregister_hotplug_dock_device(func->handle);
475 unregister_dock_notifier(&func->nb);
476 } 466 }
477 if (!(func->flags & FUNC_HAS_DCK)) { 467 if (!(func->flags & FUNC_HAS_DCK)) {
478 status = acpi_remove_notify_handler(func->handle, 468 status = acpi_remove_notify_handler(func->handle,