Skip to content

Commit

Permalink
ACPI: Properly clear flags on false-positives and send uevent on sudd…
Browse files Browse the repository at this point in the history
…en unplug

Some devices emit a ACPI_NOTIFY_DEVICE_CHECK while physically unplugging
even if the software undock has already been done and dock_present() check
fails. However, the internal flags need to be cleared (complete_undock()).

Also, even notify userspace if the dock station suddently went away
without proper software undocking.

This happens on a Acer TravelMate 3000

Signed-off-by: Holger Macht <hmacht@suse.de>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
  • Loading branch information
Holger Macht authored and Andi Kleen committed Aug 15, 2008
1 parent b635ace commit afd7301
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions drivers/acpi/dock.c
Original file line number Diff line number Diff line change
Expand Up @@ -563,18 +563,23 @@ EXPORT_SYMBOL_GPL(unregister_hotplug_dock_device);
*/
static int handle_eject_request(struct dock_station *ds, u32 event)
{
if (!dock_present(ds))
return -ENODEV;

if (dock_in_progress(ds))
return -EBUSY;

/*
* here we need to generate the undock
* event prior to actually doing the undock
* so that the device struct still exists.
* Also, even send the dock event if the
* device is not present anymore
*/
dock_event(ds, event, UNDOCK_EVENT);

if (!dock_present(ds)) {
complete_undock(ds);
return -ENODEV;
}

hotplug_dock_devices(ds, ACPI_NOTIFY_EJECT_REQUEST);
undock(ds);
eject_dock(ds);
Expand Down

0 comments on commit afd7301

Please sign in to comment.