Commit 62b3d544 authored by Lee, Chun-Yi's avatar Lee, Chun-Yi Committed by Khalid Elmously

platform/x86: acer-wmi: setup accelerometer when ACPI device was found

BugLink: https://bugs.launchpad.net/bugs/1883918

commit f9ac89f5 upstream.

The 98d610c3 patch was introduced since v4.11-rc1 that it causes
that the accelerometer input device will not be created on workable
machines because the HID string comparing logic is wrong.

And, the patch doesn't prevent that the accelerometer input device
be created on the machines that have no BST0001. That's because
the acpi_get_devices() returns success even it didn't find any
match device.

This patch fixed the HID string comparing logic of BST0001 device.
And, it also makes sure that the acpi_get_devices() returns
acpi_handle for BST0001.

Fixes: 98d610c3 ("acer-wmi: setup accelerometer when machine has appropriate notify event")
Reference: https://bugzilla.kernel.org/show_bug.cgi?id=193761Reported-by: default avatarSamuel Sieb <samuel-kbugs@sieb.net>
Signed-off-by: default avatar"Lee, Chun-Yi" <jlee@suse.com>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent 13ccaea7
......@@ -1827,7 +1827,7 @@ static acpi_status __init acer_wmi_get_handle_cb(acpi_handle ah, u32 level,
if (!strcmp(ctx, "SENR")) {
if (acpi_bus_get_device(ah, &dev))
return AE_OK;
if (!strcmp(ACER_WMID_ACCEL_HID, acpi_device_hid(dev)))
if (strcmp(ACER_WMID_ACCEL_HID, acpi_device_hid(dev)))
return AE_OK;
} else
return AE_OK;
......@@ -1848,8 +1848,7 @@ static int __init acer_wmi_get_handle(const char *name, const char *prop,
handle = NULL;
status = acpi_get_devices(prop, acer_wmi_get_handle_cb,
(void *)name, &handle);
if (ACPI_SUCCESS(status)) {
if (ACPI_SUCCESS(status) && handle) {
*ah = handle;
return 0;
} else {
......@@ -2200,8 +2199,8 @@ static int __init acer_wmi_init(void)
if (err)
return err;
err = acer_wmi_accel_setup();
if (err)
return err;
if (err && err != -ENODEV)
pr_warn("Cannot enable accelerometer\n");
}
err = platform_driver_register(&acer_platform_driver);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment