summaryrefslogtreecommitdiffstats
path: root/drivers/cpuidle/cpuidle-calxeda.c
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@linaro.org>2013-04-23 08:54:42 +0000
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-04-23 13:45:23 +0200
commit0b210d96a6f9f8fc10bca482ca6f6d87bf52927e (patch)
tree8f452fbb79d548aae3f601d5a51e92145f4efdce /drivers/cpuidle/cpuidle-calxeda.c
parentf040c26ffaa5e56f2bca427c719c9601a02e70e5 (diff)
downloadblackbird-op-linux-0b210d96a6f9f8fc10bca482ca6f6d87bf52927e.tar.gz
blackbird-op-linux-0b210d96a6f9f8fc10bca482ca6f6d87bf52927e.zip
ARM: calxeda: cpuidle: use init/exit common routine
Remove the duplicated code and use the cpuidle common code for initialization. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Acked-by: Rob Herring <rob.herring@calxeda.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpuidle/cpuidle-calxeda.c')
-rw-r--r--drivers/cpuidle/cpuidle-calxeda.c52
1 files changed, 1 insertions, 51 deletions
diff --git a/drivers/cpuidle/cpuidle-calxeda.c b/drivers/cpuidle/cpuidle-calxeda.c
index a3b56f5d33bd..e344b560d75d 100644
--- a/drivers/cpuidle/cpuidle-calxeda.c
+++ b/drivers/cpuidle/cpuidle-calxeda.c
@@ -35,8 +35,6 @@
extern void highbank_set_cpu_jump(int cpu, void *jump_addr);
extern void *scu_base_addr;
-static struct cpuidle_device __percpu *calxeda_idle_cpuidle_devices;
-
static inline unsigned int get_auxcr(void)
{
unsigned int val;
@@ -85,19 +83,6 @@ static int calxeda_pwrdown_idle(struct cpuidle_device *dev,
return index;
}
-static void calxeda_idle_cpuidle_devices_uninit(void)
-{
- int i;
- struct cpuidle_device *dev;
-
- for_each_possible_cpu(i) {
- dev = per_cpu_ptr(calxeda_idle_cpuidle_devices, i);
- cpuidle_unregister_device(dev);
- }
-
- free_percpu(calxeda_idle_cpuidle_devices);
-}
-
static struct cpuidle_driver calxeda_idle_driver = {
.name = "calxeda_idle",
.states = {
@@ -117,44 +102,9 @@ static struct cpuidle_driver calxeda_idle_driver = {
static int __init calxeda_cpuidle_init(void)
{
- int cpu_id;
- int ret;
- struct cpuidle_device *dev;
- struct cpuidle_driver *drv = &calxeda_idle_driver;
-
if (!of_machine_is_compatible("calxeda,highbank"))
return -ENODEV;
- ret = cpuidle_register_driver(drv);
- if (ret)
- return ret;
-
- calxeda_idle_cpuidle_devices = alloc_percpu(struct cpuidle_device);
- if (calxeda_idle_cpuidle_devices == NULL) {
- ret = -ENOMEM;
- goto unregister_drv;
- }
-
- /* initialize state data for each cpuidle_device */
- for_each_possible_cpu(cpu_id) {
- dev = per_cpu_ptr(calxeda_idle_cpuidle_devices, cpu_id);
- dev->cpu = cpu_id;
- dev->state_count = drv->state_count;
-
- ret = cpuidle_register_device(dev);
- if (ret) {
- pr_err("Failed to register cpu %u, error: %d\n",
- cpu_id, ret);
- goto uninit;
- }
- }
-
- return 0;
-
-uninit:
- calxeda_idle_cpuidle_devices_uninit();
-unregister_drv:
- cpuidle_unregister_driver(drv);
- return ret;
+ return cpuidle_register(&calxeda_idle_driver, NULL);
}
module_init(calxeda_cpuidle_init);
OpenPOWER on IntegriCloud