]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/suse-2.6.27.39/patches.arch/acpi-dock-don-t-eval-_sta-on-every-show_docked-sysfs-read.patch
Fix oinkmaster patch.
[ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.arch / acpi-dock-don-t-eval-_sta-on-every-show_docked-sysfs-read.patch
CommitLineData
2cb7cef9
BS
1From 1d672ef324e78a467603ef55aa4558cac9f895ba Mon Sep 17 00:00:00 2001
2From: Holger Macht <hmacht@suse.de>
3Date: Tue, 20 Jan 2009 12:18:24 +0100
4Subject: ACPI: dock: Don't eval _STA on every show_docked sysfs read
5
6From: Holger Macht <hmacht@suse.de>
7
8commit fc5a9f8841ee87d93376ada5d73117d4d6a373ea upstream.
9
10Some devices trigger a DEVICE_CHECK on every evalutation of _STA. This
11can also be seen in commit 8b59560a3baf2e7c24e0fb92ea5d09eca92805db
12(ACPI: dock: avoid check _STA method). If an undock is processed, the
13dock driver sends a uevent and userspace might read the show_docked
14property in sysfs. This causes an evaluation of _STA of the particular
15device which causes the dock driver to immediately dock again.
16
17In any case, evaluation of _STA (show_docked) does not necessarily mean
18that we are docked, so check with the internal device structure.
19
20http://bugzilla.kernel.org/show_bug.cgi?id=12360
21
22Signed-off-by: Holger Macht <hmacht@suse.de>
23Signed-off-by: Len Brown <len.brown@intel.com>
24Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
25
26---
27 drivers/acpi/dock.c | 8 +++++++-
28 1 file changed, 7 insertions(+), 1 deletion(-)
29
30--- a/drivers/acpi/dock.c
31+++ b/drivers/acpi/dock.c
32@@ -854,8 +854,14 @@ fdd_out:
33 static ssize_t show_docked(struct device *dev,
34 struct device_attribute *attr, char *buf)
35 {
36- return snprintf(buf, PAGE_SIZE, "%d\n", dock_present(dock_station));
37+ struct acpi_device *tmp;
38
39+ struct dock_station *dock_station = *((struct dock_station **)
40+ dev->platform_data);
41+
42+ if (ACPI_SUCCESS(acpi_bus_get_device(dock_station->handle, &tmp)))
43+ return snprintf(buf, PAGE_SIZE, "1\n");
44+ return snprintf(buf, PAGE_SIZE, "0\n");
45 }
46 static DEVICE_ATTR(docked, S_IRUGO, show_docked, NULL);
47