]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ACPI: dock: Don't eval _STA on every show_docked sysfs read
authorHolger Macht <hmacht@suse.de>
Tue, 20 Jan 2009 11:18:24 +0000 (12:18 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 12 Feb 2009 17:30:59 +0000 (09:30 -0800)
commit fc5a9f8841ee87d93376ada5d73117d4d6a373ea upstream.

Some devices trigger a DEVICE_CHECK on every evalutation of _STA. This
can also be seen in commit 8b59560a3baf2e7c24e0fb92ea5d09eca92805db
(ACPI: dock: avoid check _STA method).  If an undock is processed, the
dock driver sends a uevent and userspace might read the show_docked
property in sysfs. This causes an evaluation of _STA of the particular
device which causes the dock driver to immediately dock again.

In any case, evaluation of _STA (show_docked) does not necessarily mean
that we are docked, so check with the internal device structure.

http://bugzilla.kernel.org/show_bug.cgi?id=12360

Signed-off-by: Holger Macht <hmacht@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/acpi/dock.c

index e28469ec2da78b61385f0eec218d0d0ed5fcd912..eab790fbb69ada3176c0e0e164135b8491b9402f 100644 (file)
@@ -691,8 +691,14 @@ fdd_out:
 static ssize_t show_docked(struct device *dev,
                           struct device_attribute *attr, char *buf)
 {
-       return snprintf(buf, PAGE_SIZE, "%d\n", dock_present(dock_station));
+       struct acpi_device *tmp;
+
+       struct dock_station *dock_station = *((struct dock_station **)
+               dev->platform_data);
 
+       if (ACPI_SUCCESS(acpi_bus_get_device(dock_station->handle, &tmp)))
+               return snprintf(buf, PAGE_SIZE, "1\n");
+       return snprintf(buf, PAGE_SIZE, "0\n");
 }
 static DEVICE_ATTR(docked, S_IRUGO, show_docked, NULL);