From patchwork Tue Jul 4 21:03:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13301584 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC264EB64D9 for ; Tue, 4 Jul 2023 21:03:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229793AbjGDVDe (ORCPT ); Tue, 4 Jul 2023 17:03:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230472AbjGDVDd (ORCPT ); Tue, 4 Jul 2023 17:03:33 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1717110D7; Tue, 4 Jul 2023 14:03:31 -0700 (PDT) From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1688504608; bh=5uR0LdnKjKs0n4uZv6fjdMfj3y5tRy2LwcBBWPqIGm8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=cEWNAPOzRnEmGGm56FkorByHHnQ1fXlfXHSpwPgAGLWFVMKtdXyvHQaYappRDGLNK lLeBpAhGE61YK1DA5CmEU5BKjPlvwKJDnvsq5wiMqZ3tb0YJ6pzZzsTI3hKy4MlFlu BcH6/INRbYLcG0ziGw0ih3j4qep2BiDt8CfDDp2I= Date: Tue, 04 Jul 2023 23:03:17 +0200 Subject: [PATCH 1/2] platform/x86: thinkpad_acpi: take mutex for hotkey_mask_{set,get} MIME-Version: 1.0 Message-Id: <20230704-thinkpad_acpi-lockdep-v1-1-60129548a738@weissschuh.net> References: <20230704-thinkpad_acpi-lockdep-v1-0-60129548a738@weissschuh.net> In-Reply-To: <20230704-thinkpad_acpi-lockdep-v1-0-60129548a738@weissschuh.net> To: Henrique de Moraes Holschuh , Hans de Goede , Mark Gross Cc: ibm-acpi-devel@lists.sourceforge.net, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1688504608; l=1340; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=5uR0LdnKjKs0n4uZv6fjdMfj3y5tRy2LwcBBWPqIGm8=; b=JuLe2U8TccNMJjW0vtcgW8wNPauuFWJBOT+UdbRBgSvpf4mkRCCrd5Pr0nQLZ4UWV3l21oOOj v+O+fIlQN0BB3IPpJhsHTjDGx3/aTXviz1RJSWmdmCNeVqIQTMEVPRP X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org hotkey_mask_set() and hotkey_mask_get() expect hotkey_mutex to be held. While it should not matter during initialization a following patch will enable lockdep for hotkey_mutex which would produce warnings here. Signed-off-by: Thomas Weißschuh --- drivers/platform/x86/thinkpad_acpi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 187018ffb068..b796e65c99e0 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -3478,7 +3478,9 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) if (tp_features.hotkey_mask) { /* hotkey_source_mask *must* be zero for * the first hotkey_mask_get to return hotkey_orig_mask */ + mutex_lock(&hotkey_mutex); res = hotkey_mask_get(); + mutex_unlock(&hotkey_mutex); if (res) return res; @@ -3577,9 +3579,11 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) hotkey_exit(); return res; } + mutex_lock(&hotkey_mutex); res = hotkey_mask_set(((hotkey_all_mask & ~hotkey_reserved_mask) | hotkey_driver_mask) & ~hotkey_source_mask); + mutex_unlock(&hotkey_mutex); if (res < 0 && res != -ENXIO) { hotkey_exit(); return res;