From patchwork Fri Aug 23 12:51:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13775268 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 EDF40C52D7C for ; Fri, 23 Aug 2024 14:01:20 +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:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=08WjYAlBBFEeMm+hEjWVyH9fkJaAAMN7ZuFtniSsgzY=; b=5BrofBAjAycTYDmcfdGYdjVZP0 CmiG6Z79PAz50w9TF95gnbQ7jSgjH0u9+v11mAiYPX6x8g4YL/UdX1y5TPC2ESpVHy48ch8Tz8aQY 7xmTZjyMb1sMWcQLzPEBAhGSQnVkgflmz7TlVCmV6elAZ2BGNzam1zCLx+EEtAQ7MTZBitV1BAza0 lL5Jq2F66+wEcbJxRL3l7pBLHqQ5704PSjLSOjppfGl9nbC5rP2KR3ctmjiYjCjDfCy4XSuwggAJF 3KVqCYZBX1gr/r9vKIj8B9ItVek1PsUd94N/oqOcXAQ4Rx9zUA1QfAYrEBsrQFx+upOPYuTr1PY3U ie/HDPuA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1shUqi-0000000Gyh1-1dfD; Fri, 23 Aug 2024 14:01:08 +0000 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1shTlM-0000000Gl8x-3JCy for linux-arm-kernel@lists.infradead.org; Fri, 23 Aug 2024 12:51:34 +0000 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-4280772333eso3413195e9.0 for ; Fri, 23 Aug 2024 05:51:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724417491; x=1725022291; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=08WjYAlBBFEeMm+hEjWVyH9fkJaAAMN7ZuFtniSsgzY=; b=dTKoOXbqwbk7N+kHSN9d+z6HLwE0lgSS85dv2BKGHrU3DgXyz4gIsUhVmHQ8Rd2TsE 184FunHG/WjSdXPWQWgqrRK37Kt43T8LTfQLaZv9qXGmq7dT2/DaQ6oYMO9YLwOhyUok 17cIlRsje+A95nYGQiyHMyRlCUyfQYmdqlqT/H8yIXc9hC8bi3MfgRABjO2XaHH4Uq4w fYyPD9G6+o868QLJvKT0FVyNwiL2qLu95u3IpChISA/YJNPGPATRmXZzyi2GxReRy4OF 2w/NVLbOpfyfc1liWTn1Pnws3Mk5NZlaKc5xMgbxI+pove6cjupucE+GiRxj/QKMSrgQ lt6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724417491; x=1725022291; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=08WjYAlBBFEeMm+hEjWVyH9fkJaAAMN7ZuFtniSsgzY=; b=TrF7R6aUzJGsbSBvhu5fIvwz/Fxbd9BEuedVzHSC3lA+LHgM/0tXZnxl/fiHlNwyZp uYmHD/q/mbUZLXqSEVBKyV2gIgCFntO22Rvx12u+ynCH3NhifqfENEcOKka33s5S9I1e DrdOb/gX1IXTKbuMLvXDf70ahYtqYlDsTZImFWbuoVNYcuU3Q3Fqbr8m3t4s9AxoX+Hi Gbs1OJHMA9Byk4KjwYSdKBVsDlfp5SkidjcK/16t2BTQamW8ucCDgQ+tUUeSjFbrO8rO RPiaHou+td4WIl2Ry6eGPuGTp8M39nXiRMK/Q39D1NmDmZ3OIS/rkjV/uHe5ALYk2ZN0 a5LQ== X-Forwarded-Encrypted: i=1; AJvYcCVbVvTURFmHn2IKUgjYvyGc+TmVKTqGOkZJe4WjKs5CdYLwRQnR2MBvjSpeeeDVo+AIzMR4MaBNMC1IruHmgNI5@lists.infradead.org X-Gm-Message-State: AOJu0YwP9z9OOL7qFuMLZgpZAYY7lEKmqbcVgJt355AC6xXggWbdyVI5 McOH1+FzbzyyabrgQdPtJEjZ0WooESaabB+WaTaJcd3NRbw8RrwKgEZCBZzIm/c= X-Google-Smtp-Source: AGHT+IFvESEynb7DEBYY8hzcsJgziySe0iFY1cy2WIsrs8d5Dw+VUq4IdBOvbW6RhGMnpPDiy3f+xg== X-Received: by 2002:a05:6000:402a:b0:367:95e3:e4c6 with SMTP id ffacd0b85a97d-373118310a2mr763684f8f.1.1724417490919; Fri, 23 Aug 2024 05:51:30 -0700 (PDT) Received: from [127.0.1.1] ([178.197.222.82]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a868f4f384bsm255931666b.192.2024.08.23.05.51.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 05:51:30 -0700 (PDT) From: Krzysztof Kozlowski Date: Fri, 23 Aug 2024 14:51:06 +0200 Subject: [PATCH 02/10] pmdomain: rockchip: Simplify locking with guard() MIME-Version: 1.0 Message-Id: <20240823-cleanup-h-guard-pm-domain-v1-2-8320722eaf39@linaro.org> References: <20240823-cleanup-h-guard-pm-domain-v1-0-8320722eaf39@linaro.org> In-Reply-To: <20240823-cleanup-h-guard-pm-domain-v1-0-8320722eaf39@linaro.org> To: Ulf Hansson , Heiko Stuebner , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Bjorn Andersson , Konrad Dybcio , Geert Uytterhoeven , Magnus Damm Cc: linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1181; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=tKIx1euz/voqGvTWXrKxtVVbTahOhXCIVgZ5jLT/O6E=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmyIXFrRydBY7pj/F8sriEDoh64iP0CNuv6npaj HfeNRwU4H2JAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZsiFxQAKCRDBN2bmhouD 1ydTD/9YGdRcqk+Zok98MLP0sxqW8OpRmhtYJW2V4NNNbYyyky4ZJr4aGR1Odu+U8AtBgSsNa47 2nLXZ2bJ/5YbwBxRXa1l30xja/ULnh17kbIf7MVIbVbbuXU1oqsAyqX9zuje16YcLC5qF3v5ATI BCrONFjJ2VsbJgn4GHfBK89oDUSVCXIPjrzONIpHVL5vqBv0hBtzSAYjXcqtBAzvCcpGNRT0zDf LLAB5t2TCzU0sxWRUhXWVTGXcq6LRh178lslP4leZ0m2NrwNTRR2A2xbY90vS+yjVEXQJOGh00m VGi/TyviAJK/vok5UfhiiCnLk171BkRPjlAEv6BG6Pc8qLj/LWjCPJNlbwqD3LT+yvv05kEpmeP R/BGeiUEtv4xxgpRxfIuSZJhx8iDXIoog+OhAqs4FsFU1CY3Hz4SgTlVI2nkPthKcYdS8U2V16R 452XzYefITynrpOSYMuxMwfO/7/lil34uB1lR3L2Rc2ltoMqmrUpCr0p3qsuxfZdBogfQsvIpEZ dPcBUzyYD1q8vqQJveSoOBN1E5cDJuOiT39Yar1sk03UVz1B2MbvwJiE0L/ORWvknPaKPFbvtEX QY243Ebc6HD3s/4s6YzaO097h0Ba5tySJAZBbSKWoAHDKYpgQ3/NaSheTq0SdA+D6L2xGHJQ59p WJa/6IY/F6V89qQ== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240823_055132_895886_6CC64FEC X-CRM114-Status: GOOD ( 12.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Simplify error handling (smaller error handling) over locks with guard(). Signed-off-by: Krzysztof Kozlowski Reviewed-by: Jonathan Cameron --- drivers/pmdomain/rockchip/pm-domains.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/pmdomain/rockchip/pm-domains.c b/drivers/pmdomain/rockchip/pm-domains.c index 5679ad336a11..538dde58d924 100644 --- a/drivers/pmdomain/rockchip/pm-domains.c +++ b/drivers/pmdomain/rockchip/pm-domains.c @@ -910,7 +910,7 @@ static int rockchip_pm_domain_probe(struct platform_device *pdev) * Prevent any rockchip_pmu_block() from racing with the remainder of * setup (clocks, register initialization). */ - mutex_lock(&dmc_pmu_mutex); + guard(mutex)(&dmc_pmu_mutex); for_each_available_child_of_node_scoped(np, node) { error = rockchip_pm_add_one_domain(pmu, node); @@ -943,13 +943,10 @@ static int rockchip_pm_domain_probe(struct platform_device *pdev) if (!WARN_ON_ONCE(dmc_pmu)) dmc_pmu = pmu; - mutex_unlock(&dmc_pmu_mutex); - return 0; err_out: rockchip_pm_domain_cleanup(pmu); - mutex_unlock(&dmc_pmu_mutex); return error; }