diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-02-20 19:10:18 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-02-20 19:10:18 -0500 |
commit | edf5bf34d40804fbef32f240a79b74ffc69a658b (patch) | |
tree | cc254893c5eb42fd4bc35b2098be614006f68d1a /drivers/acpi/dock.c | |
parent | 3b52b21fa1f44c8956e21dfba645eda959111b5e (diff) |
ACPI / dock: Use callback pointers from devices' ACPI hotplug contexts
Instead of requiring a set of special dock operations to be registered
via register_hotplug_dock_device() for each ACPI dock device, it is
much more straightforward to use callback pointers from the devices'
hotplug contexts if available.
For this reason, modify dock_hotplug_event() to use callback pointers
from the hotplug contexts of ACPI devices and fall back to using the
special dock operarions only if those callbacks are missing. Also
make the ACPI-based PCI hotplug (ACPIPHP) subsystem set the .fixup
callback pointer in the hotplug contexts of devices handled by it to
a new function, acpiphp_post_dock_fixup(), so that the dock station
driver can use the callbacks from those contexts instead of special
dock operations registered via register_hotplug_dock_device().
Along with the above changes drop the ACPIPHP's dock operations that
are not necessary any more.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/dock.c')
-rw-r--r-- | drivers/acpi/dock.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c index 8c3967cb4830..78c4ee7a422e 100644 --- a/drivers/acpi/dock.c +++ b/drivers/acpi/dock.c | |||
@@ -185,9 +185,38 @@ static void dock_release_hotplug(struct dock_dependent_device *dd) | |||
185 | static void dock_hotplug_event(struct dock_dependent_device *dd, u32 event, | 185 | static void dock_hotplug_event(struct dock_dependent_device *dd, u32 event, |
186 | enum dock_callback_type cb_type) | 186 | enum dock_callback_type cb_type) |
187 | { | 187 | { |
188 | struct acpi_device *adev = dd->adev; | ||
188 | acpi_notify_handler cb = NULL; | 189 | acpi_notify_handler cb = NULL; |
189 | bool run = false; | 190 | bool run = false; |
190 | 191 | ||
192 | acpi_lock_hp_context(); | ||
193 | |||
194 | if (!adev->hp) | ||
195 | goto no_context; | ||
196 | |||
197 | if (cb_type == DOCK_CALL_FIXUP) { | ||
198 | void (*fixup)(struct acpi_device *); | ||
199 | |||
200 | fixup = adev->hp->fixup; | ||
201 | if (fixup) { | ||
202 | acpi_unlock_hp_context(); | ||
203 | fixup(adev); | ||
204 | return; | ||
205 | } | ||
206 | } else { | ||
207 | int (*notify)(struct acpi_device *, u32); | ||
208 | |||
209 | notify = adev->hp->event; | ||
210 | if (notify) { | ||
211 | acpi_unlock_hp_context(); | ||
212 | notify(adev, event); | ||
213 | return; | ||
214 | } | ||
215 | } | ||
216 | |||
217 | no_context: | ||
218 | acpi_unlock_hp_context(); | ||
219 | |||
191 | mutex_lock(&hotplug_lock); | 220 | mutex_lock(&hotplug_lock); |
192 | 221 | ||
193 | if (dd->hp_context) { | 222 | if (dd->hp_context) { |