Message ID | 20240825051627.2848495-14-dmitry.torokhov@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 67F4CC5321E for <linux-arm-kernel@archiver.kernel.org>; Sun, 25 Aug 2024 05:32:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=pqe1CPNPyPwWJltZY/tNpoPncj2b2bW7ofGMYanWSqo=; b=17lamNu8nv/jAawe44Yez/T+ad 6wSx2mCDce/YmxbLUDCekpSmWpszENXxjnZUVp/cv8bLs2m6DeX7B4/fsEyECrQps4jmMfLEthFuA c1b12BST1w8PCuJDT4mQwyVopTC7o0hOU1rnwrALA0JluFRVnUlcI46+jUrl3tJIddLEcwOl3f/2D SRbrdLdp1x3h8azPGzZKAL1LQvITTwigKvrFcCO4RPl8omtJ/zvv8qO4B8VLw38awV6kGNw4xHM9R hPfocjMyOSJ58wdC+BC6IuNbJHwB8CV/NHTsqy0MxsO6vjTZkcHaPV5rTRLiPxK0XrW7790vQ069T H6sKu+rQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1si5rU-00000003hbE-1GGQ; Sun, 25 Aug 2024 05:32:24 +0000 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1si5cW-00000003dkA-418H for linux-arm-kernel@lists.infradead.org; Sun, 25 Aug 2024 05:16:58 +0000 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-7142a93ea9cso2326784b3a.3 for <linux-arm-kernel@lists.infradead.org>; Sat, 24 Aug 2024 22:16:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724563016; x=1725167816; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pqe1CPNPyPwWJltZY/tNpoPncj2b2bW7ofGMYanWSqo=; b=XiSrXBydlDFyDHkk03goxLIgfkLtmvjKg2Dk5AatrTnsN9WEp8HCLdS9/Cjz30YOsV OBmpg3rQ3qwvuWK/6HHNSvSqHrAS0d5rGvATuD6eYpfLbowyTb+cpWT2QuzqulvL7i0s b6T9y9mcCKTZj0UaEY6FxVJnimsSiAlH46Sp5evxUCwQ7ugdbzIk+O9efm0k7q/WM4aP 4EYTWtr8Qe5awfNolAQ/MCv64K9bVgDyNdUe5u7xDpWAPb/By9hqZ03z4oefB00eIKCN 1jmBLQPgef9RWHMKkWpS/as/hLTgWh0lBmxgGajbgirBaWgnIXLxjMqMj98bizw5tC9W tc2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724563016; x=1725167816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pqe1CPNPyPwWJltZY/tNpoPncj2b2bW7ofGMYanWSqo=; b=fUE9ii/TC3K6Z92G0k07+fAwE1rAKua92jgf1Qp+i0OCzet+kNz2/Q/A39ojHFcyf3 wwYSwHkFIebLY3ktFhZ2j5gqz2EPzAt+xxYRR1qkEtQMQG1Xyxbxn7WhOof9LX92igCL w5KGqqtkMAk8V3f7QH1gti75sSNxo/XMTsCAAk0QGsIopi1efUMyB726wTPMOHHHHgUh +oI12wnYQ5H74EATKnHbH9L9F5rJnu/qPmEhPvG/ps/h3TdrfLmdGRmydvtA+1+X3uYN 5nkbILyrkacjQOOKtCF3UA+puydVoDq1QEDC0GruqkNk1u60eLVuZeIlu5kSfknzpOYl F/RQ== X-Forwarded-Encrypted: i=1; AJvYcCXZyRNEHren5PsoGkJjUeUq11HEteOX/+L2Gh+fyvlBH18zxuQfUxOTrzbBaxmskwbhCdBuIJ9BX4ZEhfRfLXFr@lists.infradead.org X-Gm-Message-State: AOJu0Yz3fvRanWuHCom3N1ZuTVCzDWt/2rYKHwIuYpavtUf24rcw6Ay4 1ZPwr+kcDNyZZoke7o9ICb0yTocOBtUNtK1K1xNDcpsloA0bsP42 X-Google-Smtp-Source: AGHT+IE9hfgPOc8K99rlo2yxdGDK0Km4IWYmEWtHARTyEvzXLFTX1fk3uYEqzkP6IiseW8pPeV5XNQ== X-Received: by 2002:a05:6a00:228e:b0:714:2cea:1473 with SMTP id d2e1a72fcca58-71445883e36mr6910331b3a.23.1724563015700; Sat, 24 Aug 2024 22:16:55 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2620:15c:9d:2:66dc:ce07:b7cc:51ea]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7cd9ad55a94sm5622442a12.57.2024.08.24.22.16.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Aug 2024 22:16:55 -0700 (PDT) From: Dmitry Torokhov <dmitry.torokhov@gmail.com> To: linux-input@vger.kernel.org Cc: Michael Hennerich <michael.hennerich@analog.com>, Shawn Guo <shawnguo@kernel.org>, Sascha Hauer <s.hauer@pengutronix.de>, Fabio Estevam <festevam@gmail.com>, Laxman Dewangan <ldewangan@nvidia.com>, Thierry Reding <thierry.reding@gmail.com>, Hans de Goede <hdegoede@redhat.com>, Tony Lindgren <tony@atomide.com>, Jeff LaBundy <jeff@labundy.com>, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org Subject: [PATCH 13/17] Input: pmic8xxx-keypad - use guard notation when acquiring mutex Date: Sat, 24 Aug 2024 22:16:17 -0700 Message-ID: <20240825051627.2848495-14-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.46.0.295.g3b9ea8a38a-goog In-Reply-To: <20240825051627.2848495-1-dmitry.torokhov@gmail.com> References: <20240825051627.2848495-1-dmitry.torokhov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240824_221657_340427_62BF92DE X-CRM114-Status: GOOD ( 11.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
Convert keyboard drivers to use new cleanup facilities
|
expand
|
diff --git a/drivers/input/keyboard/pmic8xxx-keypad.c b/drivers/input/keyboard/pmic8xxx-keypad.c index 26a005f9ace3..35d1aa2a22a5 100644 --- a/drivers/input/keyboard/pmic8xxx-keypad.c +++ b/drivers/input/keyboard/pmic8xxx-keypad.c @@ -630,12 +630,10 @@ static int pmic8xxx_kp_suspend(struct device *dev) if (device_may_wakeup(dev)) { enable_irq_wake(kp->key_sense_irq); } else { - mutex_lock(&input_dev->mutex); + guard(mutex)(&input_dev->mutex); if (input_device_enabled(input_dev)) pmic8xxx_kp_disable(kp); - - mutex_unlock(&input_dev->mutex); } return 0; @@ -650,12 +648,10 @@ static int pmic8xxx_kp_resume(struct device *dev) if (device_may_wakeup(dev)) { disable_irq_wake(kp->key_sense_irq); } else { - mutex_lock(&input_dev->mutex); + guard(mutex)(&input_dev->mutex); if (input_device_enabled(input_dev)) pmic8xxx_kp_enable(kp); - - mutex_unlock(&input_dev->mutex); } return 0;
This makes the code more compact and error handling more robust by ensuring that mutexes are released in all code paths when control leaves critical section. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> --- drivers/input/keyboard/pmic8xxx-keypad.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)