From patchwork Wed Dec 11 14:26:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Reichel X-Patchwork-Id: 13903589 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 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 C7DE3E77182 for ; Wed, 11 Dec 2024 14:31:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6JFA9hAtGbIziH+prvqVcUyk4MF+eFZTj6+z/m5oFKE=; b=n+2cf0hkOOtvxK qzCTxSBDsHlPN6p3q2ZsLC4cpmVErKkhL3wiY62YiJpx4vcpQIHYlcsWBBEqXdhDM8PIYbNuU6X3n S4OEpa+utPvRzOqCp6B8jGHi/oFap1fvPLcKDckeNMr4Np62YDQv/QVXXKtnSbQ7mr9vHOGEd8AL8 EipDOAfD9nCnj2WGIBYmB/Uv0HhTnnLSAzx6mhbw3scclithk2ESA2o2t5/Bz/b5duBaNzR8VATeH 8piR2L7+j2aKQAa1Uc4oeN4L5GEWDg/ZuOsxvqggNHTy2PY7ppE02GIBhl4vS4b9lrEfuy1FX2W/J lMpycveXywcyWMXwL+1w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tLNkr-0000000F9Ib-13PP; Wed, 11 Dec 2024 14:31:57 +0000 Received: from bali.collaboradmins.com ([2a01:4f8:201:9162::2]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tLNjk-0000000F8vZ-0dVW for linux-rockchip@lists.infradead.org; Wed, 11 Dec 2024 14:30:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1733927446; bh=weUMWJ/yGA2zkBAFFHf1vfM+l7pVZFAl+UVEBLx7Q0s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ISKQSsTXM0KIZULPgEUYCY8nXS+o9oxQZnhwt+2ykw5kn8VTFvWRyfPXN9H6LJe3s ualoBk5PG/grnkP7GUfH4cJR2HzpXGo3qXQJx6dhE1w9ur4YrWUWn2piQLJkDKkh1D T1Bn8TuUEc2WYvPnQWQuAeTFRPSoD0kAOl7/Yx86fK8o5YKjqUG9DL7SCXykSPqXgc BWvao6sz3+7yr4Qa47/1y4pDTDRjRdXvz1LFT2jmxDjy2buNT8efzFF6MM4CnDexxs lvBk78JbvuiJaxyyJJs6GEr6Ke8ajpxYOFB9HhZpwy1dY4hdN5IplnKvIsoAvM0eTC 6G6OIGQNenUKQ== Received: from jupiter.universe (dyndsl-091-248-215-089.ewe-ip-backbone.de [91.248.215.89]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: sre) by bali.collaboradmins.com (Postfix) with ESMTPSA id 457D517E377D; Wed, 11 Dec 2024 15:30:46 +0100 (CET) Received: by jupiter.universe (Postfix, from userid 1000) id 79DCB48CC8C; Wed, 11 Dec 2024 15:30:45 +0100 (CET) From: Sebastian Reichel To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Ulf Hansson , Mark Brown Cc: Liam Girdwood , Elaine Zhang , =?utf-8?q?Adri=C3=A1n_Mart=C3=ADne?= =?utf-8?q?z_Larumbe?= , Boris Brezillon , Chen-Yu Tsai , devicetree@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Sebastian Reichel , kernel@collabora.com Subject: [PATCH v5 2/7] pmdomain: rockchip: cleanup mutex handling in rockchip_pd_power Date: Wed, 11 Dec 2024 15:26:47 +0100 Message-ID: <20241211143044.9550-3-sebastian.reichel@collabora.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241211143044.9550-1-sebastian.reichel@collabora.com> References: <20241211143044.9550-1-sebastian.reichel@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241211_063048_363511_A1A39CE9 X-CRM114-Status: GOOD ( 11.30 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org Use the cleanup infrastructure to handle the mutex, which slightly improve code readability for this function. Reviewed-by: Heiko Stuebner Tested-by: Heiko Stuebner Tested-by: Adrian Larumbe # On Rock 5B Signed-off-by: Sebastian Reichel --- drivers/pmdomain/rockchip/pm-domains.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/pmdomain/rockchip/pm-domains.c b/drivers/pmdomain/rockchip/pm-domains.c index cb0f93800138..a161ee13c633 100644 --- a/drivers/pmdomain/rockchip/pm-domains.c +++ b/drivers/pmdomain/rockchip/pm-domains.c @@ -574,13 +574,12 @@ static int rockchip_pd_power(struct rockchip_pm_domain *pd, bool power_on) struct rockchip_pmu *pmu = pd->pmu; int ret; - mutex_lock(&pmu->mutex); + guard(mutex)(&pmu->mutex); if (rockchip_pmu_domain_is_on(pd) != power_on) { ret = clk_bulk_enable(pd->num_clks, pd->clks); if (ret < 0) { dev_err(pmu->dev, "failed to enable clocks\n"); - mutex_unlock(&pmu->mutex); return ret; } @@ -606,7 +605,6 @@ static int rockchip_pd_power(struct rockchip_pm_domain *pd, bool power_on) clk_bulk_disable(pd->num_clks, pd->clks); } - mutex_unlock(&pmu->mutex); return 0; }