diff mbox series

[1/2] cpuidle: psci: Fix regression leading to no genpd governor

Message ID 20220514152032.758738-1-ulf.hansson@linaro.org
State Accepted
Commit 34be27517cb763ea367da21e3cdee5d1bc40f47f
Headers show
Series [1/2] cpuidle: psci: Fix regression leading to no genpd governor | expand

Commit Message

Ulf Hansson May 14, 2022, 3:20 p.m. UTC
While factoring out the PM domain related code from PSCI domain driver into
a set of library functions, a regression when initializing the genpds got
introduced. More precisely, we fail to assign a genpd governor, so let's
fix this.

Fixes: 9d976d6721df ("cpuidle: Factor-out power domain related code from PSCI domain driver")
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/cpuidle/cpuidle-psci-domain.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Anup Patel May 14, 2022, 4:48 p.m. UTC | #1
On Sat, May 14, 2022 at 8:50 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
>
> While factoring out the PM domain related code from PSCI domain driver into
> a set of library functions, a regression when initializing the genpds got
> introduced. More precisely, we fail to assign a genpd governor, so let's
> fix this.
>
> Fixes: 9d976d6721df ("cpuidle: Factor-out power domain related code from PSCI domain driver")
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

Looks good to me.

Reviewed-by: Anup Patel <anup@brainfault.org>

Regards,
Anup

> ---
>  drivers/cpuidle/cpuidle-psci-domain.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidle-psci-domain.c
> index 755bbdfc5b82..3db4fca1172b 100644
> --- a/drivers/cpuidle/cpuidle-psci-domain.c
> +++ b/drivers/cpuidle/cpuidle-psci-domain.c
> @@ -52,7 +52,7 @@ static int psci_pd_init(struct device_node *np, bool use_osi)
>         struct generic_pm_domain *pd;
>         struct psci_pd_provider *pd_provider;
>         struct dev_power_governor *pd_gov;
> -       int ret = -ENOMEM, state_count = 0;
> +       int ret = -ENOMEM;
>
>         pd = dt_idle_pd_alloc(np, psci_dt_parse_state_node);
>         if (!pd)
> @@ -71,7 +71,7 @@ static int psci_pd_init(struct device_node *np, bool use_osi)
>                 pd->flags |= GENPD_FLAG_ALWAYS_ON;
>
>         /* Use governor for CPU PM domains if it has some states to manage. */
> -       pd_gov = state_count > 0 ? &pm_domain_cpu_gov : NULL;
> +       pd_gov = pd->states ? &pm_domain_cpu_gov : NULL;
>
>         ret = pm_genpd_init(pd, pd_gov, false);
>         if (ret)
> --
> 2.25.1
>
Rafael J. Wysocki May 18, 2022, 6:50 p.m. UTC | #2
On Sat, May 14, 2022 at 6:49 PM Anup Patel <anup@brainfault.org> wrote:
>
> On Sat, May 14, 2022 at 8:50 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> >
> > While factoring out the PM domain related code from PSCI domain driver into
> > a set of library functions, a regression when initializing the genpds got
> > introduced. More precisely, we fail to assign a genpd governor, so let's
> > fix this.
> >
> > Fixes: 9d976d6721df ("cpuidle: Factor-out power domain related code from PSCI domain driver")
> > Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
>
> Looks good to me.
>
> Reviewed-by: Anup Patel <anup@brainfault.org>
>

Ulf, do you want me to take this lot or is it going to be handled elsewhere?

> > ---
> >  drivers/cpuidle/cpuidle-psci-domain.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidle-psci-domain.c
> > index 755bbdfc5b82..3db4fca1172b 100644
> > --- a/drivers/cpuidle/cpuidle-psci-domain.c
> > +++ b/drivers/cpuidle/cpuidle-psci-domain.c
> > @@ -52,7 +52,7 @@ static int psci_pd_init(struct device_node *np, bool use_osi)
> >         struct generic_pm_domain *pd;
> >         struct psci_pd_provider *pd_provider;
> >         struct dev_power_governor *pd_gov;
> > -       int ret = -ENOMEM, state_count = 0;
> > +       int ret = -ENOMEM;
> >
> >         pd = dt_idle_pd_alloc(np, psci_dt_parse_state_node);
> >         if (!pd)
> > @@ -71,7 +71,7 @@ static int psci_pd_init(struct device_node *np, bool use_osi)
> >                 pd->flags |= GENPD_FLAG_ALWAYS_ON;
> >
> >         /* Use governor for CPU PM domains if it has some states to manage. */
> > -       pd_gov = state_count > 0 ? &pm_domain_cpu_gov : NULL;
> > +       pd_gov = pd->states ? &pm_domain_cpu_gov : NULL;
> >
> >         ret = pm_genpd_init(pd, pd_gov, false);
> >         if (ret)
> > --
> > 2.25.1
> >
Ulf Hansson May 19, 2022, 1 p.m. UTC | #3
On Wed, 18 May 2022 at 20:50, Rafael J. Wysocki <rafael@kernel.org> wrote:
>
> On Sat, May 14, 2022 at 6:49 PM Anup Patel <anup@brainfault.org> wrote:
> >
> > On Sat, May 14, 2022 at 8:50 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> > >
> > > While factoring out the PM domain related code from PSCI domain driver into
> > > a set of library functions, a regression when initializing the genpds got
> > > introduced. More precisely, we fail to assign a genpd governor, so let's
> > > fix this.
> > >
> > > Fixes: 9d976d6721df ("cpuidle: Factor-out power domain related code from PSCI domain driver")
> > > Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> >
> > Looks good to me.
> >
> > Reviewed-by: Anup Patel <anup@brainfault.org>
> >
>
> Ulf, do you want me to take this lot or is it going to be handled elsewhere?

I appreciate it if you can pick both this and the second patch.

Kind regards
Uffe

>
> > > ---
> > >  drivers/cpuidle/cpuidle-psci-domain.c | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidle-psci-domain.c
> > > index 755bbdfc5b82..3db4fca1172b 100644
> > > --- a/drivers/cpuidle/cpuidle-psci-domain.c
> > > +++ b/drivers/cpuidle/cpuidle-psci-domain.c
> > > @@ -52,7 +52,7 @@ static int psci_pd_init(struct device_node *np, bool use_osi)
> > >         struct generic_pm_domain *pd;
> > >         struct psci_pd_provider *pd_provider;
> > >         struct dev_power_governor *pd_gov;
> > > -       int ret = -ENOMEM, state_count = 0;
> > > +       int ret = -ENOMEM;
> > >
> > >         pd = dt_idle_pd_alloc(np, psci_dt_parse_state_node);
> > >         if (!pd)
> > > @@ -71,7 +71,7 @@ static int psci_pd_init(struct device_node *np, bool use_osi)
> > >                 pd->flags |= GENPD_FLAG_ALWAYS_ON;
> > >
> > >         /* Use governor for CPU PM domains if it has some states to manage. */
> > > -       pd_gov = state_count > 0 ? &pm_domain_cpu_gov : NULL;
> > > +       pd_gov = pd->states ? &pm_domain_cpu_gov : NULL;
> > >
> > >         ret = pm_genpd_init(pd, pd_gov, false);
> > >         if (ret)
> > > --
> > > 2.25.1
> > >
Rafael J. Wysocki May 19, 2022, 5:38 p.m. UTC | #4
On Thu, May 19, 2022 at 3:01 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
>
> On Wed, 18 May 2022 at 20:50, Rafael J. Wysocki <rafael@kernel.org> wrote:
> >
> > On Sat, May 14, 2022 at 6:49 PM Anup Patel <anup@brainfault.org> wrote:
> > >
> > > On Sat, May 14, 2022 at 8:50 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> > > >
> > > > While factoring out the PM domain related code from PSCI domain driver into
> > > > a set of library functions, a regression when initializing the genpds got
> > > > introduced. More precisely, we fail to assign a genpd governor, so let's
> > > > fix this.
> > > >
> > > > Fixes: 9d976d6721df ("cpuidle: Factor-out power domain related code from PSCI domain driver")
> > > > Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> > >
> > > Looks good to me.
> > >
> > > Reviewed-by: Anup Patel <anup@brainfault.org>
> > >
> >
> > Ulf, do you want me to take this lot or is it going to be handled elsewhere?
>
> I appreciate it if you can pick both this and the second patch.

Both applied, thanks!
diff mbox series

Patch

diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidle-psci-domain.c
index 755bbdfc5b82..3db4fca1172b 100644
--- a/drivers/cpuidle/cpuidle-psci-domain.c
+++ b/drivers/cpuidle/cpuidle-psci-domain.c
@@ -52,7 +52,7 @@  static int psci_pd_init(struct device_node *np, bool use_osi)
 	struct generic_pm_domain *pd;
 	struct psci_pd_provider *pd_provider;
 	struct dev_power_governor *pd_gov;
-	int ret = -ENOMEM, state_count = 0;
+	int ret = -ENOMEM;
 
 	pd = dt_idle_pd_alloc(np, psci_dt_parse_state_node);
 	if (!pd)
@@ -71,7 +71,7 @@  static int psci_pd_init(struct device_node *np, bool use_osi)
 		pd->flags |= GENPD_FLAG_ALWAYS_ON;
 
 	/* Use governor for CPU PM domains if it has some states to manage. */
-	pd_gov = state_count > 0 ? &pm_domain_cpu_gov : NULL;
+	pd_gov = pd->states ? &pm_domain_cpu_gov : NULL;
 
 	ret = pm_genpd_init(pd, pd_gov, false);
 	if (ret)