Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp1972627ima; Thu, 25 Oct 2018 07:46:46 -0700 (PDT) X-Google-Smtp-Source: AJdET5dOIdNCjbXTUCXy4Rjg5aX6sLNNJ89eL82Zap2WPsaHresty3Sh913ZR4gAsF+/nXUxUI8N X-Received: by 2002:a63:f141:: with SMTP id o1mr1792820pgk.134.1540478806425; Thu, 25 Oct 2018 07:46:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540478806; cv=none; d=google.com; s=arc-20160816; b=B5bVAT+FrlU3Y3ixdvdIDVYq6UTMtzndMKHU+GYsIMfO/0O4679f68Yo3/+C+96t37 zeiV8SZOrpslQG1D5FWs7O1yYFTwJQKePlRbMcIL/X7QN8ZLvPQxwaWk7Ww4B3ytBwA4 YOuOQAGkgYkS9Q0+4DuLXL//0ETXDdUgyTl+EDpa1KRaY6NH+JyRJbUi0/7glP7zeX12 KpKx5RNyFIyOc5KlFLNT83PhbUeiVy24pd8H1fmFSASh/zCcDd/FqwgwS0NKYSUK41MP 1kUN9sw9HhIx7A9B+kkre4ehs5S+f2Ndp9mRchJ4Kr3oNUwCt3b+eDHnSr3AHmX/c+70 jQvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=j7txb4nBdGeRL2CNjVtkqqY2hFa8h0Tk3FUXJruxkeE=; b=UC+wBanJ4KAtedfEgaoEKM2k4mqrcIY0ReQjXFH96WyyAO/3knId//FevGyV14/B6f k7aHD5Ph5YkvITGfKI8SzclOyBUIznkTbUuCvN44A/3F9bjQxwaD3aFT74U46XE6v56M RxmZ3rwb6QUrU5QDfLkUOKBNeYn65hEHg8zJYs9SMzoWnkryFzAAtDKcw5F3mVviEOVo 9dRu4cbjgZxytLsCi31Ic+PW/tWdXUfX+TT2hJaRRU7bpdEndG1O3nq4fGHvSEOyAFv9 e5tS/dRS9WJF6fOcsphL2rG1N0iCN3FoYUuNzjKLcwkSzG0Pg6hCyX6QTGfMaJUvpuo4 HG2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ma2VuIg+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c14-v6si8083970pgm.556.2018.10.25.07.46.29; Thu, 25 Oct 2018 07:46:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ma2VuIg+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728624AbeJYWrn (ORCPT + 99 others); Thu, 25 Oct 2018 18:47:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:55856 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728449AbeJYWrm (ORCPT ); Thu, 25 Oct 2018 18:47:42 -0400 Received: from sasha-vm.mshome.net (unknown [167.98.65.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4C65D20834; Thu, 25 Oct 2018 14:14:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1540476886; bh=bVJbbLUbw57/OQ7Ehm0jH1+4kMz5P0o+zPwqjZCOZMs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ma2VuIg+sP/68sFLEZl1P20Sfbk4HqEvjAk+WGnMXFQleKFtjfoyoqVPY18rSYLGn 89OPPNO5x6FBwtm2U52cIVqbKBadMVU2ysnN9QTJ/6A/G3Tmz4QWqabWBZXrdWGeda HIn8d1/DOqnrxebOQfhibk5UvCxMlinrB9BtLrJo= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Lee, Chun-Yi" , "Lee, Chun-Yi" , Andy Shevchenko , Sasha Levin Subject: [PATCH AUTOSEL 4.9 13/98] platform/x86: acer-wmi: setup accelerometer when ACPI device was found Date: Thu, 25 Oct 2018 10:12:58 -0400 Message-Id: <20181025141423.213774-13-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025141423.213774-1-sashal@kernel.org> References: <20181025141423.213774-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Lee, Chun-Yi" [ Upstream commit f9ac89f5ad613b462339e845aeb8494646fd9be2 ] 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 Signed-off-by: Sasha Levin --- 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 c29b9b611ab2..1515c9480f89 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -1856,7 +1856,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; @@ -1877,8 +1877,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 { @@ -2247,8 +2246,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.17.1