From patchwork Tue Jun 9 17:44:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 224712 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31357C433E1 for ; Tue, 9 Jun 2020 17:46:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 04A1D2081A for ; Tue, 9 Jun 2020 17:46:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591724780; bh=1v+8pQJ2MGHqi5djMU3ruNLkZLDmt6+87t8aQprpRs4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ely59FhCYL0shrzDbhTIjM5aneqYN5OCpMik1+ULgOF6XdAV+0rh1CH4Xo2RGSE5g 2zAtl6L/Trxpl+NhFTFEUZfyQY1tn3XcnPl2jBeDpW4pac/dr5Tw917N4zMHQXPqy3 C4Dai2SScAbh6sCSzN+Fuq5F2t6kp37kYitYzoxw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731910AbgFIRqT (ORCPT ); Tue, 9 Jun 2020 13:46:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:56092 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728440AbgFIRqR (ORCPT ); Tue, 9 Jun 2020 13:46:17 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3105420812; Tue, 9 Jun 2020 17:46:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591724775; bh=1v+8pQJ2MGHqi5djMU3ruNLkZLDmt6+87t8aQprpRs4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ymmMk6r6PB2xuf/Udpad3OV3n/ISist/kYT4/SElOxLsYZHSpidfKW0VeItUBmKmR X+WNgWNdidpQ9jvLD2SLdg3EEREfRn8PIporvlaj4nYoTQorKnVUW3uSTPYjAnqr/8 MV+XR/Z0TDW2zPE+oYzGOytiBh6gCxb+KY/cLoBU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Samuel Sieb , "Lee, Chun-Yi" , Andy Shevchenko , Guenter Roeck Subject: [PATCH 4.4 03/36] platform/x86: acer-wmi: setup accelerometer when ACPI device was found Date: Tue, 9 Jun 2020 19:44:03 +0200 Message-Id: <20200609173933.485128117@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609173933.288044334@linuxfoundation.org> References: <20200609173933.288044334@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Lee, Chun-Yi commit f9ac89f5ad613b462339e845aeb8494646fd9be2 upstream. 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 Signed-off-by: "Lee, Chun-Yi" Signed-off-by: Andy Shevchenko Cc: Guenter Roeck Signed-off-by: Greg Kroah-Hartman --- drivers/platform/x86/acer-wmi.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -1826,7 +1826,7 @@ static acpi_status __init acer_wmi_get_h 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; @@ -1847,8 +1847,7 @@ static int __init acer_wmi_get_handle(co 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 { @@ -2199,8 +2198,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);