diff mbox series

PM: domains: Fix domain attach for CONFIG_PM_OPP=n

Message ID 4fb42fa1b76b38c6628f056cfd804bb5b4e74d99.1629818532.git.geert+renesas@glider.be
State Accepted
Commit 656164181eece68a2f99f0b8a1c5558184b67d7b
Headers show
Series PM: domains: Fix domain attach for CONFIG_PM_OPP=n | expand

Commit Message

Geert Uytterhoeven Aug. 24, 2021, 3:23 p.m. UTC
If CONFIG_PM_OPP=n, of_get_required_opp_performance_state() always
returns -EOPNOTSUPP, and all drivers for devices that are part of a PM
Domain fail to probe with:

    failed to set required performance state for power-domain foo: -95
    probe of bar failed with error -95

Fix this by treating -EOPNOTSUPP the same as -ENODEV.

Fixes: c016baf7dc58e77a ("PM: domains: Add support for 'required-opps' to set default perf state")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/base/power/domain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Niklas Söderlund Aug. 27, 2021, 7:53 a.m. UTC | #1
Hi Geert,

Thanks for your work.

On 2021-08-24 17:23:38 +0200, Geert Uytterhoeven wrote:
> If CONFIG_PM_OPP=n, of_get_required_opp_performance_state() always

> returns -EOPNOTSUPP, and all drivers for devices that are part of a PM

> Domain fail to probe with:

> 

>     failed to set required performance state for power-domain foo: -95

>     probe of bar failed with error -95

> 

> Fix this by treating -EOPNOTSUPP the same as -ENODEV.

> 

> Fixes: c016baf7dc58e77a ("PM: domains: Add support for 'required-opps' to set default perf state")

> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>


Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>


> ---

>  drivers/base/power/domain.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c

> index a10d740c4f2a1c28..7b197690e6442911 100644

> --- a/drivers/base/power/domain.c

> +++ b/drivers/base/power/domain.c

> @@ -2760,7 +2760,7 @@ static int __genpd_dev_pm_attach(struct device *dev, struct device *base_dev,

>  

>  	/* Set the default performance state */

>  	pstate = of_get_required_opp_performance_state(dev->of_node, index);

> -	if (pstate < 0 && pstate != -ENODEV) {

> +	if (pstate < 0 && pstate != -ENODEV && pstate != -EOPNOTSUPP) {

>  		ret = pstate;

>  		goto err;

>  	} else if (pstate > 0) {

> -- 

> 2.25.1

> 


-- 
Regards,
Niklas Söderlund
Ulf Hansson Aug. 27, 2021, 1:23 p.m. UTC | #2
On Tue, 24 Aug 2021 at 17:23, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
>

> If CONFIG_PM_OPP=n, of_get_required_opp_performance_state() always

> returns -EOPNOTSUPP, and all drivers for devices that are part of a PM

> Domain fail to probe with:

>

>     failed to set required performance state for power-domain foo: -95

>     probe of bar failed with error -95

>

> Fix this by treating -EOPNOTSUPP the same as -ENODEV.

>

> Fixes: c016baf7dc58e77a ("PM: domains: Add support for 'required-opps' to set default perf state")

> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>


Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>


Kind regards
Uffe

> ---

>  drivers/base/power/domain.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

>

> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c

> index a10d740c4f2a1c28..7b197690e6442911 100644

> --- a/drivers/base/power/domain.c

> +++ b/drivers/base/power/domain.c

> @@ -2760,7 +2760,7 @@ static int __genpd_dev_pm_attach(struct device *dev, struct device *base_dev,

>

>         /* Set the default performance state */

>         pstate = of_get_required_opp_performance_state(dev->of_node, index);

> -       if (pstate < 0 && pstate != -ENODEV) {

> +       if (pstate < 0 && pstate != -ENODEV && pstate != -EOPNOTSUPP) {

>                 ret = pstate;

>                 goto err;

>         } else if (pstate > 0) {

> --

> 2.25.1

>
diff mbox series

Patch

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index a10d740c4f2a1c28..7b197690e6442911 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -2760,7 +2760,7 @@  static int __genpd_dev_pm_attach(struct device *dev, struct device *base_dev,
 
 	/* Set the default performance state */
 	pstate = of_get_required_opp_performance_state(dev->of_node, index);
-	if (pstate < 0 && pstate != -ENODEV) {
+	if (pstate < 0 && pstate != -ENODEV && pstate != -EOPNOTSUPP) {
 		ret = pstate;
 		goto err;
 	} else if (pstate > 0) {