arm-scmi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pmdomain: arm: scmi_pm_domain: remove code clutter
@ 2025-06-06  9:08 Lukas Bulwahn
  2025-06-06  9:21 ` Sudeep Holla
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Lukas Bulwahn @ 2025-06-06  9:08 UTC (permalink / raw)
  To: Sudeep Holla, Cristian Marussi, Ulf Hansson, arm-scmi,
	linux-arm-kernel, linux-pm
  Cc: Javier Martinez Canillas, kernel-janitors, linux-kernel,
	Lukas Bulwahn

From: Lukas Bulwahn <lukas.bulwahn@redhat.com>

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 <lukas.bulwahn@redhat.com>
---
 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] pmdomain: arm: scmi_pm_domain: remove code clutter
  2025-06-06  9:08 [PATCH] pmdomain: arm: scmi_pm_domain: remove code clutter Lukas Bulwahn
@ 2025-06-06  9:21 ` Sudeep Holla
  2025-06-06  9:38 ` Javier Martinez Canillas
  2025-06-18 12:56 ` Ulf Hansson
  2 siblings, 0 replies; 4+ messages in thread
From: Sudeep Holla @ 2025-06-06  9:21 UTC (permalink / raw)
  To: Lukas Bulwahn
  Cc: Cristian Marussi, Sudeep Holla, Ulf Hansson, arm-scmi,
	linux-arm-kernel, linux-pm, Javier Martinez Canillas,
	kernel-janitors, linux-kernel, Lukas Bulwahn

On Fri, Jun 06, 2025 at 11:08:02AM +0200, Lukas Bulwahn wrote:
> From: Lukas Bulwahn <lukas.bulwahn@redhat.com>
> 
> 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.
> 

Nice cleanup. Thanks for doing this.

Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>

Ulf,

I assume you will pick this up when you start collecting patches for
next merge window.

-- 
Regards,
Sudeep

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pmdomain: arm: scmi_pm_domain: remove code clutter
  2025-06-06  9:08 [PATCH] pmdomain: arm: scmi_pm_domain: remove code clutter Lukas Bulwahn
  2025-06-06  9:21 ` Sudeep Holla
@ 2025-06-06  9:38 ` Javier Martinez Canillas
  2025-06-18 12:56 ` Ulf Hansson
  2 siblings, 0 replies; 4+ messages in thread
From: Javier Martinez Canillas @ 2025-06-06  9:38 UTC (permalink / raw)
  To: Lukas Bulwahn, Sudeep Holla, Cristian Marussi, Ulf Hansson,
	arm-scmi, linux-arm-kernel, linux-pm
  Cc: kernel-janitors, linux-kernel, Lukas Bulwahn

Lukas Bulwahn <lbulwahn@redhat.com> writes:

> From: Lukas Bulwahn <lukas.bulwahn@redhat.com>
>
> 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 <lukas.bulwahn@redhat.com>
> ---

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pmdomain: arm: scmi_pm_domain: remove code clutter
  2025-06-06  9:08 [PATCH] pmdomain: arm: scmi_pm_domain: remove code clutter Lukas Bulwahn
  2025-06-06  9:21 ` Sudeep Holla
  2025-06-06  9:38 ` Javier Martinez Canillas
@ 2025-06-18 12:56 ` Ulf Hansson
  2 siblings, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2025-06-18 12:56 UTC (permalink / raw)
  To: Lukas Bulwahn
  Cc: Sudeep Holla, Cristian Marussi, arm-scmi, linux-arm-kernel,
	linux-pm, Javier Martinez Canillas, kernel-janitors, linux-kernel,
	Lukas Bulwahn

On Fri, 6 Jun 2025 at 11:08, Lukas Bulwahn <lbulwahn@redhat.com> wrote:
>
> From: Lukas Bulwahn <lukas.bulwahn@redhat.com>
>
> 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 <lukas.bulwahn@redhat.com>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  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
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-06-18 12:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-06  9:08 [PATCH] pmdomain: arm: scmi_pm_domain: remove code clutter Lukas Bulwahn
2025-06-06  9:21 ` Sudeep Holla
2025-06-06  9:38 ` Javier Martinez Canillas
2025-06-18 12:56 ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).