aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/dock.c
diff options
context:
space:
mode:
authorHolger Macht <hmacht@suse.de>2009-01-20 06:18:24 -0500
committerLen Brown <len.brown@intel.com>2009-02-06 22:08:15 -0500
commitfc5a9f8841ee87d93376ada5d73117d4d6a373ea (patch)
treeca1098636b4918c00a49faf34c4e0d6e99852296 /drivers/acpi/dock.c
parent9e3a9d1ed8cc8db93e5c53e9a5b09065bd95de8b (diff)
ACPI: dock: Don't eval _STA on every show_docked sysfs read
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>
Diffstat (limited to 'drivers/acpi/dock.c')
-rw-r--r--drivers/acpi/dock.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c
index 5b30b8d91d71..afd5db3c7562 100644
--- a/drivers/acpi/dock.c
+++ b/drivers/acpi/dock.c
@@ -855,10 +855,14 @@ fdd_out:
855static ssize_t show_docked(struct device *dev, 855static ssize_t show_docked(struct device *dev,
856 struct device_attribute *attr, char *buf) 856 struct device_attribute *attr, char *buf)
857{ 857{
858 struct acpi_device *tmp;
859
858 struct dock_station *dock_station = *((struct dock_station **) 860 struct dock_station *dock_station = *((struct dock_station **)
859 dev->platform_data); 861 dev->platform_data);
860 return snprintf(buf, PAGE_SIZE, "%d\n", dock_present(dock_station));
861 862
863 if (ACPI_SUCCESS(acpi_bus_get_device(dock_station->handle, &tmp)))
864 return snprintf(buf, PAGE_SIZE, "1\n");
865 return snprintf(buf, PAGE_SIZE, "0\n");
862} 866}
863static DEVICE_ATTR(docked, S_IRUGO, show_docked, NULL); 867static DEVICE_ATTR(docked, S_IRUGO, show_docked, NULL);
864 868