]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
pmdomain: rockchip: cleanup mutex handling in rockchip_pd_power
authorSebastian Reichel <sebastian.reichel@collabora.com>
Thu, 20 Feb 2025 18:58:05 +0000 (19:58 +0100)
committerUlf Hansson <ulf.hansson@linaro.org>
Fri, 28 Feb 2025 11:52:34 +0000 (12:52 +0100)
Use the cleanup infrastructure to handle the mutex, which
slightly improve code readability for this function.

Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Adrian Larumbe <adrian.larumbe@collabora.com> # On Rock 5B
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Link: https://lore.kernel.org/r/20250220-rk3588-gpu-pwr-domain-regulator-v6-2-a4f9c24e5b81@kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/pmdomain/rockchip/pm-domains.c

index 27a5c68ff8ba0820ef7cb0c8695952da793fd0aa..8b15e57aa27fe38556cd5ae5a578996721a9b4ef 100644 (file)
@@ -583,13 +583,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;
                }
 
@@ -615,7 +614,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;
 }