Thread (4 messages) 4 messages, 4 authors, 2025-06-18

Re: [PATCH] pmdomain: arm: scmi_pm_domain: remove code clutter

From: Ulf Hansson <hidden>
Date: 2025-06-18 12:57:12
Also in: arm-scmi, kernel-janitors, linux-pm, lkml

On Fri, 6 Jun 2025 at 11:08, Lukas Bulwahn [off-list ref] wrote:
From: Lukas Bulwahn <redacted>

There is no need to introduce the boolean power_on to select the constant
value for state. Simply pass the value for state as argument. Just remove
this code clutter.

No functional change.

Signed-off-by: Lukas Bulwahn <redacted>
Applied for next, thanks!

Kind regards
Uffe

quoted hunk ↗ jump to hunk
---
 drivers/pmdomain/arm/scmi_pm_domain.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/pmdomain/arm/scmi_pm_domain.c b/drivers/pmdomain/arm/scmi_pm_domain.c
index 2a213c218126..8fe1c0a501c9 100644
--- a/drivers/pmdomain/arm/scmi_pm_domain.c
+++ b/drivers/pmdomain/arm/scmi_pm_domain.c
@@ -22,27 +22,21 @@ struct scmi_pm_domain {

 #define to_scmi_pd(gpd) container_of(gpd, struct scmi_pm_domain, genpd)

-static int scmi_pd_power(struct generic_pm_domain *domain, bool power_on)
+static int scmi_pd_power(struct generic_pm_domain *domain, u32 state)
 {
-       u32 state;
        struct scmi_pm_domain *pd = to_scmi_pd(domain);

-       if (power_on)
-               state = SCMI_POWER_STATE_GENERIC_ON;
-       else
-               state = SCMI_POWER_STATE_GENERIC_OFF;
-
        return power_ops->state_set(pd->ph, pd->domain, state);
 }

 static int scmi_pd_power_on(struct generic_pm_domain *domain)
 {
-       return scmi_pd_power(domain, true);
+       return scmi_pd_power(domain, SCMI_POWER_STATE_GENERIC_ON);
 }

 static int scmi_pd_power_off(struct generic_pm_domain *domain)
 {
-       return scmi_pd_power(domain, false);
+       return scmi_pd_power(domain, SCMI_POWER_STATE_GENERIC_OFF);
 }

 static int scmi_pm_domain_probe(struct scmi_device *sdev)
--
2.49.0
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help