-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path0047-pmdomain-rockchip-reduce-indentation-in-rockchip_pd_.patch
90 lines (74 loc) · 2.56 KB
/
0047-pmdomain-rockchip-reduce-indentation-in-rockchip_pd_.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
From b81bedd80c42ba135054603f915661e478525938 Mon Sep 17 00:00:00 2001
From: Sebastian Reichel <[email protected]>
Date: Fri, 6 Sep 2024 17:44:55 +0200
Subject: [PATCH 47/77] pmdomain: rockchip: reduce indentation in
rockchip_pd_power
Rework the logic, so that the function exits early when the
power domain state is already correct to reduce code indentation.
No functional change intended.
Reviewed-by: Heiko Stuebner <[email protected]>
Tested-by: Adrian Larumbe <[email protected]> # On Rock 5B
Signed-off-by: Sebastian Reichel <[email protected]>
---
drivers/pmdomain/rockchip/pm-domains.c | 49 +++++++++++++-------------
1 file changed, 25 insertions(+), 24 deletions(-)
diff --git a/drivers/pmdomain/rockchip/pm-domains.c b/drivers/pmdomain/rockchip/pm-domains.c
index 8f440f2883db8..f4e555dac20a3 100644
--- a/drivers/pmdomain/rockchip/pm-domains.c
+++ b/drivers/pmdomain/rockchip/pm-domains.c
@@ -582,39 +582,40 @@ static int rockchip_pd_power(struct rockchip_pm_domain *pd, bool power_on)
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");
- return ret;
- }
+ if (rockchip_pmu_domain_is_on(pd) == power_on)
+ return 0;
- rockchip_pmu_ungate_clk(pd, true);
+ ret = clk_bulk_enable(pd->num_clks, pd->clks);
+ if (ret < 0) {
+ dev_err(pmu->dev, "failed to enable clocks\n");
+ return ret;
+ }
- if (!power_on) {
- rockchip_pmu_save_qos(pd);
+ rockchip_pmu_ungate_clk(pd, true);
- /* if powering down, idle request to NIU first */
- rockchip_pmu_set_idle_request(pd, true);
- }
+ if (!power_on) {
+ rockchip_pmu_save_qos(pd);
- ret = rockchip_do_pmu_set_power_domain(pd, power_on);
- if (ret < 0) {
- clk_bulk_disable(pd->num_clks, pd->clks);
- return ret;
- }
+ /* if powering down, idle request to NIU first */
+ rockchip_pmu_set_idle_request(pd, true);
+ }
- if (power_on) {
- /* if powering up, leave idle mode */
- rockchip_pmu_set_idle_request(pd, false);
+ ret = rockchip_do_pmu_set_power_domain(pd, power_on);
+ if (ret < 0) {
+ clk_bulk_disable(pd->num_clks, pd->clks);
+ return ret;
+ }
- rockchip_pmu_restore_qos(pd);
- }
+ if (power_on) {
+ /* if powering up, leave idle mode */
+ rockchip_pmu_set_idle_request(pd, false);
- rockchip_pmu_ungate_clk(pd, false);
- clk_bulk_disable(pd->num_clks, pd->clks);
+ rockchip_pmu_restore_qos(pd);
}
+ rockchip_pmu_ungate_clk(pd, false);
+ clk_bulk_disable(pd->num_clks, pd->clks);
+
return 0;
}
--
2.47.0