提交 ab62f9cd 编写于 作者: R Rafael J. Wysocki

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: 202317a5 (ACPI / scan: Add acpi_device objects for all device nodes in the namespace)
Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
上级 0a8e5c3d
...@@ -713,13 +713,11 @@ static acpi_status __init find_dock_devices(acpi_handle handle, u32 lvl, ...@@ -713,13 +713,11 @@ static acpi_status __init find_dock_devices(acpi_handle handle, u32 lvl,
static ssize_t show_docked(struct device *dev, static ssize_t show_docked(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct acpi_device *tmp;
struct dock_station *dock_station = dev->platform_data; struct dock_station *dock_station = dev->platform_data;
struct acpi_device *adev = NULL;
if (!acpi_bus_get_device(dock_station->handle, &tmp)) acpi_bus_get_device(dock_station->handle, &adev);
return snprintf(buf, PAGE_SIZE, "1\n"); return snprintf(buf, PAGE_SIZE, "%u\n", acpi_device_enumerated(adev));
return snprintf(buf, PAGE_SIZE, "0\n");
} }
static DEVICE_ATTR(docked, S_IRUGO, show_docked, NULL); static DEVICE_ATTR(docked, S_IRUGO, show_docked, NULL);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册