ARM: ux500: cpuidle: use init/exit common routine
Remove the duplicate code and use the cpuidle common code for initialization. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
Родитель
4c637b2175
Коммит
e8928e2e1e
|
@ -21,7 +21,6 @@
|
||||||
|
|
||||||
static atomic_t master = ATOMIC_INIT(0);
|
static atomic_t master = ATOMIC_INIT(0);
|
||||||
static DEFINE_SPINLOCK(master_lock);
|
static DEFINE_SPINLOCK(master_lock);
|
||||||
static DEFINE_PER_CPU(struct cpuidle_device, ux500_cpuidle_device);
|
|
||||||
|
|
||||||
static inline int ux500_enter_idle(struct cpuidle_device *dev,
|
static inline int ux500_enter_idle(struct cpuidle_device *dev,
|
||||||
struct cpuidle_driver *drv, int index)
|
struct cpuidle_driver *drv, int index)
|
||||||
|
@ -112,40 +111,11 @@ static struct cpuidle_driver ux500_idle_driver = {
|
||||||
|
|
||||||
int __init ux500_idle_init(void)
|
int __init ux500_idle_init(void)
|
||||||
{
|
{
|
||||||
int ret, cpu;
|
|
||||||
struct cpuidle_device *device;
|
|
||||||
|
|
||||||
/* Configure wake up reasons */
|
/* Configure wake up reasons */
|
||||||
prcmu_enable_wakeups(PRCMU_WAKEUP(ARM) | PRCMU_WAKEUP(RTC) |
|
prcmu_enable_wakeups(PRCMU_WAKEUP(ARM) | PRCMU_WAKEUP(RTC) |
|
||||||
PRCMU_WAKEUP(ABB));
|
PRCMU_WAKEUP(ABB));
|
||||||
|
|
||||||
ret = cpuidle_register_driver(&ux500_idle_driver);
|
return cpuidle_register(&ux500_idle_driver, NULL);
|
||||||
if (ret) {
|
|
||||||
printk(KERN_ERR "failed to register ux500 idle driver\n");
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
for_each_possible(cpu) {
|
|
||||||
device = &per_cpu(ux500_cpuidle_device, cpu);
|
|
||||||
device->cpu = cpu;
|
|
||||||
ret = cpuidle_register_device(device);
|
|
||||||
if (ret) {
|
|
||||||
printk(KERN_ERR "Failed to register cpuidle "
|
|
||||||
"device for cpu%d\n", cpu);
|
|
||||||
goto out_unregister;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
out:
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
out_unregister:
|
|
||||||
for_each_possible_cpu(cpu) {
|
|
||||||
device = &per_cpu(ux500_cpuidle_device, cpu);
|
|
||||||
cpuidle_unregister_device(device);
|
|
||||||
}
|
|
||||||
|
|
||||||
cpuidle_unregister_driver(&ux500_idle_driver);
|
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
device_initcall(ux500_idle_init);
|
device_initcall(ux500_idle_init);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче