linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] acer-wmi: setup accelerometer when appropriate acpi device was found
@ 2017-04-28  8:23 Lee, Chun-Yi
  2017-04-28 18:30 ` Samuel Sieb
  2017-04-28 18:58 ` Andy Shevchenko
  0 siblings, 2 replies; 3+ messages in thread
From: Lee, Chun-Yi @ 2017-04-28  8:23 UTC (permalink / raw)
  To: Darren Hart; +Cc: platform-driver-x86, linux-kernel, Lee, Chun-Yi

The 98d610c3739a 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: 98d610c3739a ("acer-wmi: setup accelerometer when machine has appropriate notify event")
Reference: https://bugzilla.kernel.org/show_bug.cgi?id=193761
Reported-by: Samuel Sieb <samuel-kbugs@sieb.net>
Signed-off-by: "Lee, Chun-Yi" <jlee@suse.com>
---
 drivers/platform/x86/acer-wmi.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index dac0fbe..dbb4e6e 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -1896,7 +1896,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;
@@ -1917,8 +1917,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 {
@@ -2290,8 +2289,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);
-- 
2.6.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] acer-wmi: setup accelerometer when appropriate acpi device was found
  2017-04-28  8:23 [PATCH] acer-wmi: setup accelerometer when appropriate acpi device was found Lee, Chun-Yi
@ 2017-04-28 18:30 ` Samuel Sieb
  2017-04-28 18:58 ` Andy Shevchenko
  1 sibling, 0 replies; 3+ messages in thread
From: Samuel Sieb @ 2017-04-28 18:30 UTC (permalink / raw)
  To: Lee, Chun-Yi, Darren Hart; +Cc: platform-driver-x86, linux-kernel, Lee, Chun-Yi

On 04/28/2017 01:23 AM, Lee, Chun-Yi wrote:
> Fixes: 98d610c3739a ("acer-wmi: setup accelerometer when machine has appropriate notify event")
> Reference: https://bugzilla.kernel.org/show_bug.cgi?id=193761
> Reported-by: Samuel Sieb <samuel-kbugs@sieb.net>
> Signed-off-by: "Lee, Chun-Yi" <jlee@suse.com>

I have verified that this fixes the issue.
If you're going to include my name here, then please use my normal email 
address (samuel@sieb.net) instead of this one.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] acer-wmi: setup accelerometer when appropriate acpi device was found
  2017-04-28  8:23 [PATCH] acer-wmi: setup accelerometer when appropriate acpi device was found Lee, Chun-Yi
  2017-04-28 18:30 ` Samuel Sieb
@ 2017-04-28 18:58 ` Andy Shevchenko
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2017-04-28 18:58 UTC (permalink / raw)
  To: Lee, Chun-Yi; +Cc: Darren Hart, Platform Driver, linux-kernel, Lee, Chun-Yi

On Fri, Apr 28, 2017 at 11:23 AM, Lee, Chun-Yi <joeyli.kernel@gmail.com> wrote:
> The 98d610c3739a 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.
>

Pushed to testing, thanks.

> Fixes: 98d610c3739a ("acer-wmi: setup accelerometer when machine has appropriate notify event")
> Reference: https://bugzilla.kernel.org/show_bug.cgi?id=193761
> Reported-by: Samuel Sieb <samuel-kbugs@sieb.net>
> Signed-off-by: "Lee, Chun-Yi" <jlee@suse.com>
> ---
>  drivers/platform/x86/acer-wmi.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
> index dac0fbe..dbb4e6e 100644
> --- a/drivers/platform/x86/acer-wmi.c
> +++ b/drivers/platform/x86/acer-wmi.c
> @@ -1896,7 +1896,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;
> @@ -1917,8 +1917,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 {
> @@ -2290,8 +2289,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);
> --
> 2.6.2
>



-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-04-28 18:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-28  8:23 [PATCH] acer-wmi: setup accelerometer when appropriate acpi device was found Lee, Chun-Yi
2017-04-28 18:30 ` Samuel Sieb
2017-04-28 18:58 ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).