Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp2310397ybg; Fri, 5 Jun 2020 10:36:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAtKwACd1kpiuJo4/W4Uj2/r7iNmUGZwvnqBdHMhVsNpOCjB9Zjyz//ITYwTSxp6zAXqqn X-Received: by 2002:a05:6402:128f:: with SMTP id w15mr10644223edv.240.1591378590209; Fri, 05 Jun 2020 10:36:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591378590; cv=none; d=google.com; s=arc-20160816; b=utG7Xf83VcpScg4lmngPS+q0u5Z7o3NJB8rRrfAtxdUShyv83vbHktjv2M36qkRNQ+ QAADJ7GAvtP8MVQmFZejOA8b/cqX/wG2vAuir6RRSvWo3rBVrE/Y3VTkrhvyX5y4KK2F 97HJH7w9bywTCoiyrCNFD2A+Z4B3H6QygsUK4MVwDrEaoBpJsmxvV4IQIrBSUvVDGXE2 GtWos/pdg/O68okkmapZQWyy+W/d8WG149iiB2cqOjskTbGcDYeshr9Ng9fJR0lL3fU3 yJvytSREbT5B+fdF9cGt32hy5kZ4F4NEUkrp84EeItPFlC5+JClGQ1Cxu5ZDxSzgE2BI 2Ang== 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; bh=Bw1A9hqv1+wWUU6MeRA/c99n2jG+9x5y2bFSx9PIE/E=; b=lrnw1bn9c7ZH9fxtmelDqgsU4RlGKTvGTcmBDZXNzWOetZWAanIigihZ/1WR7Tjud1 iQGngTolAZaJLreFpEtkpxOk8SM6WYFYi1nGGquvJcxvczhjxBCtGvfSRGEx3gLwe4RY 461fVLi/4HwG6u2FTasUfjeG2uvbhAVfxZgpIUXiGhNFwNV0vF0D7fugRlFWXaJ3PFjg LgZ2sRaCDtrPdqbCxKq4pogyn4l9/OfEJ4bA14GCYLqHyvrwT7HgW6P0xZTiYXu8ou/R itai+mbiKqE9mHwAQgKoHDo9IPqhMu4afk9XAXI41kmqpLRBq51DAB9lx+4kG+AaFQz8 lQmQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w17si4021551ejn.590.2020.06.05.10.36.05; Fri, 05 Jun 2020 10:36:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728261AbgFEReN (ORCPT + 99 others); Fri, 5 Jun 2020 13:34:13 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:39248 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728074AbgFERd7 (ORCPT ); Fri, 5 Jun 2020 13:33:59 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: andrzej.p) with ESMTPSA id 6441C2A5091 From: Andrzej Pietrasiewicz To: linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-input@vger.kernel.org, linux-tegra@vger.kernel.org, patches@opensource.cirrus.com, ibm-acpi-devel@lists.sourceforge.net, platform-driver-x86@vger.kernel.org Cc: "Rafael J . Wysocki" , Len Brown , Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Kukjin Kim , Krzysztof Kozlowski , Dmitry Torokhov , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Vladimir Zapolskiy , Sylvain Lemieux , Laxman Dewangan , Thierry Reding , Jonathan Hunter , Barry Song , Michael Hennerich , Nick Dyer , Hans de Goede , Ferruh Yigit , Sangwon Jee , Peter Hutterer , Henrique de Moraes Holschuh , Andrzej Pietrasiewicz , kernel@collabora.com Subject: [PATCH v3 6/7] platform/x86: thinkpad_acpi: Use input_device_enabled() Date: Fri, 5 Jun 2020 19:33:34 +0200 Message-Id: <20200605173335.13753-7-andrzej.p@collabora.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605173335.13753-1-andrzej.p@collabora.com> References: <20200604072853.GP89269@dtor-ws> <20200605173335.13753-1-andrzej.p@collabora.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use the new helper. Inspecting input device's 'users' member needs to be done under device's mutex, so add appropriate invocations. Signed-off-by: Andrzej Pietrasiewicz Acked-by: Henrique de Moraes Holschuh --- drivers/platform/x86/thinkpad_acpi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 0f704484ae1d..8ae11b8c3ebb 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -2671,9 +2671,10 @@ static void hotkey_poll_setup(const bool may_warn) const u32 poll_driver_mask = hotkey_driver_mask & hotkey_source_mask; const u32 poll_user_mask = hotkey_user_mask & hotkey_source_mask; + mutex_lock(&tpacpi_inputdev->mutex); if (hotkey_poll_freq > 0 && (poll_driver_mask || - (poll_user_mask && tpacpi_inputdev->users > 0))) { + (poll_user_mask && input_device_enabled(tpacpi_inputdev)))) { if (!tpacpi_hotkey_task) { tpacpi_hotkey_task = kthread_run(hotkey_kthread, NULL, TPACPI_NVRAM_KTHREAD_NAME); @@ -2690,6 +2691,7 @@ static void hotkey_poll_setup(const bool may_warn) poll_user_mask, poll_driver_mask); } } + mutex_unlock(&tpacpi_inputdev->mutex); } static void hotkey_poll_setup_safe(const bool may_warn) -- 2.17.1