* [PATCH v2 1/2] ARM: cpuidle: Don't register the driver when back-end init returns -ENXIO
@ 2018-11-01 12:22 Ulf Hansson
2018-11-02 11:26 ` Daniel Lezcano
0 siblings, 1 reply; 2+ messages in thread
From: Ulf Hansson @ 2018-11-01 12:22 UTC (permalink / raw)
To: linux-arm-kernel
There's no point to register the cpuidle driver for the current CPU, when
the initialization of the arch specific back-end data fails by returning
-ENXIO.
Instead, let's re-order the sequence to its original flow, by first trying
to initialize the back-end part and then act accordingly on the returned
error code. Additionally, let's print the error message, no matter of what
error code that was returned.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Fixes: a0d46a3dfdc3 ("ARM: cpuidle: Register per cpuidle device")
Cc: <stable@vger.kernel.org> # v4.19+
---
Changes in v2:
- Added a fixes and a stable tag.
---
drivers/cpuidle/cpuidle-arm.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c
index 073557f433eb..df564d783216 100644
--- a/drivers/cpuidle/cpuidle-arm.c
+++ b/drivers/cpuidle/cpuidle-arm.c
@@ -103,13 +103,6 @@ static int __init arm_idle_init_cpu(int cpu)
goto out_kfree_drv;
}
- ret = cpuidle_register_driver(drv);
- if (ret) {
- if (ret != -EBUSY)
- pr_err("Failed to register cpuidle driver\n");
- goto out_kfree_drv;
- }
-
/*
* Call arch CPU operations in order to initialize
* idle states suspend back-end specific data
@@ -117,15 +110,20 @@ static int __init arm_idle_init_cpu(int cpu)
ret = arm_cpuidle_init(cpu);
/*
- * Skip the cpuidle device initialization if the reported
+ * Allow the initialization to continue for other CPUs, if the reported
* failure is a HW misconfiguration/breakage (-ENXIO).
*/
- if (ret == -ENXIO)
- return 0;
-
if (ret) {
pr_err("CPU %d failed to init idle CPU ops\n", cpu);
- goto out_unregister_drv;
+ ret = ret == -ENXIO ? 0 : ret;
+ goto out_kfree_drv;
+ }
+
+ ret = cpuidle_register_driver(drv);
+ if (ret) {
+ if (ret != -EBUSY)
+ pr_err("Failed to register cpuidle driver\n");
+ goto out_kfree_drv;
}
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH v2 1/2] ARM: cpuidle: Don't register the driver when back-end init returns -ENXIO
2018-11-01 12:22 [PATCH v2 1/2] ARM: cpuidle: Don't register the driver when back-end init returns -ENXIO Ulf Hansson
@ 2018-11-02 11:26 ` Daniel Lezcano
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Lezcano @ 2018-11-02 11:26 UTC (permalink / raw)
To: linux-arm-kernel
On 01/11/2018 13:22, Ulf Hansson wrote:
> There's no point to register the cpuidle driver for the current CPU, when
> the initialization of the arch specific back-end data fails by returning
> -ENXIO.
>
> Instead, let's re-order the sequence to its original flow, by first trying
> to initialize the back-end part and then act accordingly on the returned
> error code. Additionally, let's print the error message, no matter of what
> error code that was returned.
>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> Fixes: a0d46a3dfdc3 ("ARM: cpuidle: Register per cpuidle device")
> Cc: <stable@vger.kernel.org> # v4.19+
Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
>
> Changes in v2:
> - Added a fixes and a stable tag.
>
> ---
> drivers/cpuidle/cpuidle-arm.c | 22 ++++++++++------------
> 1 file changed, 10 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c
> index 073557f433eb..df564d783216 100644
> --- a/drivers/cpuidle/cpuidle-arm.c
> +++ b/drivers/cpuidle/cpuidle-arm.c
> @@ -103,13 +103,6 @@ static int __init arm_idle_init_cpu(int cpu)
> goto out_kfree_drv;
> }
>
> - ret = cpuidle_register_driver(drv);
> - if (ret) {
> - if (ret != -EBUSY)
> - pr_err("Failed to register cpuidle driver\n");
> - goto out_kfree_drv;
> - }
> -
> /*
> * Call arch CPU operations in order to initialize
> * idle states suspend back-end specific data
> @@ -117,15 +110,20 @@ static int __init arm_idle_init_cpu(int cpu)
> ret = arm_cpuidle_init(cpu);
>
> /*
> - * Skip the cpuidle device initialization if the reported
> + * Allow the initialization to continue for other CPUs, if the reported
> * failure is a HW misconfiguration/breakage (-ENXIO).
> */
> - if (ret == -ENXIO)
> - return 0;
> -
> if (ret) {
> pr_err("CPU %d failed to init idle CPU ops\n", cpu);
> - goto out_unregister_drv;
> + ret = ret == -ENXIO ? 0 : ret;
> + goto out_kfree_drv;
> + }
> +
> + ret = cpuidle_register_driver(drv);
> + if (ret) {
> + if (ret != -EBUSY)
> + pr_err("Failed to register cpuidle driver\n");
> + goto out_kfree_drv;
> }
>
> dev = kzalloc(sizeof(*dev), GFP_KERNEL);
>
--
<http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-11-02 11:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-01 12:22 [PATCH v2 1/2] ARM: cpuidle: Don't register the driver when back-end init returns -ENXIO Ulf Hansson
2018-11-02 11:26 ` Daniel Lezcano
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).