diff options
author | Daniel Lezcano <daniel.lezcano@linaro.org> | 2013-04-23 04:54:42 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-04-23 07:45:23 -0400 |
commit | 0b210d96a6f9f8fc10bca482ca6f6d87bf52927e (patch) | |
tree | 8f452fbb79d548aae3f601d5a51e92145f4efdce /drivers/cpuidle | |
parent | f040c26ffaa5e56f2bca427c719c9601a02e70e5 (diff) |
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')
-rw-r--r-- | drivers/cpuidle/cpuidle-calxeda.c | 52 |
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 @@ | |||
35 | extern void highbank_set_cpu_jump(int cpu, void *jump_addr); | 35 | extern void highbank_set_cpu_jump(int cpu, void *jump_addr); |
36 | extern void *scu_base_addr; | 36 | extern void *scu_base_addr; |
37 | 37 | ||
38 | static struct cpuidle_device __percpu *calxeda_idle_cpuidle_devices; | ||
39 | |||
40 | static inline unsigned int get_auxcr(void) | 38 | static inline unsigned int get_auxcr(void) |
41 | { | 39 | { |
42 | unsigned int val; | 40 | unsigned int val; |
@@ -85,19 +83,6 @@ static int calxeda_pwrdown_idle(struct cpuidle_device *dev, | |||
85 | return index; | 83 | return index; |
86 | } | 84 | } |
87 | 85 | ||
88 | static void calxeda_idle_cpuidle_devices_uninit(void) | ||
89 | { | ||
90 | int i; | ||
91 | struct cpuidle_device *dev; | ||
92 | |||
93 | for_each_possible_cpu(i) { | ||
94 | dev = per_cpu_ptr(calxeda_idle_cpuidle_devices, i); | ||
95 | cpuidle_unregister_device(dev); | ||
96 | } | ||
97 | |||
98 | free_percpu(calxeda_idle_cpuidle_devices); | ||
99 | } | ||
100 | |||
101 | static struct cpuidle_driver calxeda_idle_driver = { | 86 | static struct cpuidle_driver calxeda_idle_driver = { |
102 | .name = "calxeda_idle", | 87 | .name = "calxeda_idle", |
103 | .states = { | 88 | .states = { |
@@ -117,44 +102,9 @@ static struct cpuidle_driver calxeda_idle_driver = { | |||
117 | 102 | ||
118 | static int __init calxeda_cpuidle_init(void) | 103 | static int __init calxeda_cpuidle_init(void) |
119 | { | 104 | { |
120 | int cpu_id; | ||
121 | int ret; | ||
122 | struct cpuidle_device *dev; | ||
123 | struct cpuidle_driver *drv = &calxeda_idle_driver; | ||
124 | |||
125 | if (!of_machine_is_compatible("calxeda,highbank")) | 105 | if (!of_machine_is_compatible("calxeda,highbank")) |
126 | return -ENODEV; | 106 | return -ENODEV; |
127 | 107 | ||
128 | ret = cpuidle_register_driver(drv); | 108 | return cpuidle_register(&calxeda_idle_driver, NULL); |
129 | if (ret) | ||
130 | return ret; | ||
131 | |||
132 | calxeda_idle_cpuidle_devices = alloc_percpu(struct cpuidle_device); | ||
133 | if (calxeda_idle_cpuidle_devices == NULL) { | ||
134 | ret = -ENOMEM; | ||
135 | goto unregister_drv; | ||
136 | } | ||
137 | |||
138 | /* initialize state data for each cpuidle_device */ | ||
139 | for_each_possible_cpu(cpu_id) { | ||
140 | dev = per_cpu_ptr(calxeda_idle_cpuidle_devices, cpu_id); | ||
141 | dev->cpu = cpu_id; | ||
142 | dev->state_count = drv->state_count; | ||
143 | |||
144 | ret = cpuidle_register_device(dev); | ||
145 | if (ret) { | ||
146 | pr_err("Failed to register cpu %u, error: %d\n", | ||
147 | cpu_id, ret); | ||
148 | goto uninit; | ||
149 | } | ||
150 | } | ||
151 | |||
152 | return 0; | ||
153 | |||
154 | uninit: | ||
155 | calxeda_idle_cpuidle_devices_uninit(); | ||
156 | unregister_drv: | ||
157 | cpuidle_unregister_driver(drv); | ||
158 | return ret; | ||
159 | } | 109 | } |
160 | module_init(calxeda_cpuidle_init); | 110 | module_init(calxeda_cpuidle_init); |