Commit 97dc6c03 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

Merge branch 'pm-cpuidle'

* pm-cpuidle:
  ARM: cpuidle: Convert to use cpuidle_register|unregister()
  ARM: cpuidle: Don't register the driver when back-end init returns -ENXIO
parents aeaf6a4b 3e452e63
...@@ -82,7 +82,6 @@ static int __init arm_idle_init_cpu(int cpu) ...@@ -82,7 +82,6 @@ static int __init arm_idle_init_cpu(int cpu)
{ {
int ret; int ret;
struct cpuidle_driver *drv; struct cpuidle_driver *drv;
struct cpuidle_device *dev;
drv = kmemdup(&arm_idle_driver, sizeof(*drv), GFP_KERNEL); drv = kmemdup(&arm_idle_driver, sizeof(*drv), GFP_KERNEL);
if (!drv) if (!drv)
...@@ -103,13 +102,6 @@ static int __init arm_idle_init_cpu(int cpu) ...@@ -103,13 +102,6 @@ static int __init arm_idle_init_cpu(int cpu)
goto out_kfree_drv; 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 * Call arch CPU operations in order to initialize
* idle states suspend back-end specific data * idle states suspend back-end specific data
...@@ -117,37 +109,21 @@ static int __init arm_idle_init_cpu(int cpu) ...@@ -117,37 +109,21 @@ static int __init arm_idle_init_cpu(int cpu)
ret = arm_cpuidle_init(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). * failure is a HW misconfiguration/breakage (-ENXIO).
*/ */
if (ret == -ENXIO)
return 0;
if (ret) { if (ret) {
pr_err("CPU %d failed to init idle CPU ops\n", cpu); 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;
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (!dev) {
ret = -ENOMEM;
goto out_unregister_drv;
} }
dev->cpu = cpu;
ret = cpuidle_register_device(dev); ret = cpuidle_register(drv, NULL);
if (ret) { if (ret)
pr_err("Failed to register cpuidle device for CPU %d\n", goto out_kfree_drv;
cpu);
goto out_kfree_dev;
}
return 0; return 0;
out_kfree_dev:
kfree(dev);
out_unregister_drv:
cpuidle_unregister_driver(drv);
out_kfree_drv: out_kfree_drv:
kfree(drv); kfree(drv);
return ret; return ret;
...@@ -178,9 +154,7 @@ static int __init arm_idle_init(void) ...@@ -178,9 +154,7 @@ static int __init arm_idle_init(void)
while (--cpu >= 0) { while (--cpu >= 0) {
dev = per_cpu(cpuidle_devices, cpu); dev = per_cpu(cpuidle_devices, cpu);
drv = cpuidle_get_cpu_driver(dev); drv = cpuidle_get_cpu_driver(dev);
cpuidle_unregister_device(dev); cpuidle_unregister(drv);
cpuidle_unregister_driver(drv);
kfree(dev);
kfree(drv); kfree(drv);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment