diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-02-14 19:29:06 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-02-14 19:29:06 -0500 |
commit | ab62f9cd7b5ecdf853f1612fe1e983cb7cbbac3e (patch) | |
tree | cd8ab25556dfba0213ecd85b1756756996eed5b1 | |
parent | 0a8e5c3d5f0f4929761e6a5bef5358f0ccd8810c (diff) |
ACPI / dock: Make 'docked' sysfs attribute work as documented
After recent ACPI core changes acpi_bus_get_device() will always
succeed for dock station ACPI device objects, so show_docked()
should not use that function's return value as an indicator of
whether or not the dock device is present.
Make it use acpi_device_enumerated() for this purpose.
Fixes: 202317a573b2 (ACPI / scan: Add acpi_device objects for all device nodes in the namespace)
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/acpi/dock.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c index e9b3081c4fe9..5bfd769fc91f 100644 --- a/drivers/acpi/dock.c +++ b/drivers/acpi/dock.c | |||
@@ -713,13 +713,11 @@ static acpi_status __init find_dock_devices(acpi_handle handle, u32 lvl, | |||
713 | static ssize_t show_docked(struct device *dev, | 713 | static ssize_t show_docked(struct device *dev, |
714 | struct device_attribute *attr, char *buf) | 714 | struct device_attribute *attr, char *buf) |
715 | { | 715 | { |
716 | struct acpi_device *tmp; | ||
717 | |||
718 | struct dock_station *dock_station = dev->platform_data; | 716 | struct dock_station *dock_station = dev->platform_data; |
717 | struct acpi_device *adev = NULL; | ||
719 | 718 | ||
720 | if (!acpi_bus_get_device(dock_station->handle, &tmp)) | 719 | acpi_bus_get_device(dock_station->handle, &adev); |
721 | return snprintf(buf, PAGE_SIZE, "1\n"); | 720 | return snprintf(buf, PAGE_SIZE, "%u\n", acpi_device_enumerated(adev)); |
722 | return snprintf(buf, PAGE_SIZE, "0\n"); | ||
723 | } | 721 | } |
724 | static DEVICE_ATTR(docked, S_IRUGO, show_docked, NULL); | 722 | static DEVICE_ATTR(docked, S_IRUGO, show_docked, NULL); |
725 | 723 | ||