From patchwork Fri Apr 28 08:23:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chun-Yi Lee X-Patchwork-Id: 9704019 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 54835602B7 for ; Fri, 28 Apr 2017 08:24:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3280228602 for ; Fri, 28 Apr 2017 08:24:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 14B1528663; Fri, 28 Apr 2017 08:24:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0FCF128602 for ; Fri, 28 Apr 2017 08:24:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1033891AbdD1IYm (ORCPT ); Fri, 28 Apr 2017 04:24:42 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:35908 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1033096AbdD1IYk (ORCPT ); Fri, 28 Apr 2017 04:24:40 -0400 Received: by mail-wm0-f65.google.com with SMTP id u65so9406588wmu.3; Fri, 28 Apr 2017 01:24:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=3iGdEfJdRImMDxo+28yz0zqEGv0tp8LA7MJNQlngsMY=; b=OmPXwU16WftbxoNZwC7HgX8a1IwhtUVScIr7NdoME7972j8abso+P5vEkBUCLjel4I N8lFrGzo5oSBL0ol1/+Dzm6r5HU0iQ0+ymmZlVLuaNmp58s1vZDmwuh1FoC5NsDtipIh +nWmRPNFeIvAr9VDLILY733p2gH+LtRYX2eClQ8njF5cweePHs4pmxGePiiEykOHFuNK Z02DPAj1fUUJg8HNiCwrW4H2bckXNaftZsai6NU0+kDfmiaDhh7d1Qnd99F+uJI9pLGN Dz0xk5owuPpXGcNIaXVhlwNhKpTxigribfRN5v5oOki0CqkhHSo79Dnz4/MBa5ZUNUhn QNuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=3iGdEfJdRImMDxo+28yz0zqEGv0tp8LA7MJNQlngsMY=; b=YUGhY0SiGMj3JsJLJjV4HKaLgOH9z2QqARSsjHWdZW0cGhKIv9Z1DoHWPJc0i29GTw aRBPeeGOGXQYce8Xzj6G+HUohE10dfmiV5hRCJU0okJmWhc0FVW4S0MLkT1cxiAltY8S P+Dhq3BHCJh/VxRfoQ5Ws2TrXcbpTz3DLsKGdejsa+lkVCxEqlDVoTHYy1RiWTsIrEcB mYCRKuSYsojV/DGN+9S6g46f3D9u29PlPgcHJKISEiiTBSAfMle6HVuo8UmT3kERM+or YDAR9bJ5A8a1zFBJ01F2svAHcIcmoAD0h5Wli7ZecAcCzJcqWtygfbQ4FTlUlYvCvqc3 WynQ== X-Gm-Message-State: AN3rC/72+yuChCbl2BlxY/5/rdZF9Y82drU3PJ3P9O5xim/WQItgBSB7 QurUsh1usbI/dw== X-Received: by 10.28.132.134 with SMTP id g128mr5187785wmd.106.1493367879037; Fri, 28 Apr 2017 01:24:39 -0700 (PDT) Received: from linux-l9pv.suse (59-124-67-67.HINET-IP.hinet.net. [59.124.67.67]) by smtp.gmail.com with ESMTPSA id u145sm1638226wmu.1.2017.04.28.01.24.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 28 Apr 2017 01:24:38 -0700 (PDT) From: "Lee, Chun-Yi" X-Google-Original-From: "Lee, Chun-Yi" To: Darren Hart Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, "Lee, Chun-Yi" Subject: [PATCH] acer-wmi: setup accelerometer when appropriate acpi device was found Date: Fri, 28 Apr 2017 16:23:59 +0800 Message-Id: <20170428082359.20034-1-jlee@suse.com> X-Mailer: git-send-email 2.12.0 Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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" --- 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);