aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68k/kernel
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert@linux-m68k.org>2011-04-13 16:31:28 -0400
committerGeert Uytterhoeven <geert@linux-m68k.org>2011-11-08 16:35:47 -0500
commitc288bf2533e57174b90b07860c4391bcd1ea269c (patch)
tree91fa6ef91d6653f491f41ff97c4da5e28dfd62fe /arch/m68k/kernel
parent3ec7215e5d1a714ef65069a1d0999a31e4930bb7 (diff)
m68k/irq: Rename irq_controller to irq_chip
Make it more similar to the genirq version: - Remove lock (unused as we don't do SMP anyway), - Prepend methods with irq_, - Make irq_startup() return unsigned int. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Acked-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/m68k/kernel')
-rw-r--r--arch/m68k/kernel/ints.c86
1 files changed, 42 insertions, 44 deletions
diff --git a/arch/m68k/kernel/ints.c b/arch/m68k/kernel/ints.c
index 761ee0440c99..f43ad7b93ab6 100644
--- a/arch/m68k/kernel/ints.c
+++ b/arch/m68k/kernel/ints.c
@@ -52,23 +52,21 @@ extern u16 user_irqvec_fixup[];
52 52
53/* table for system interrupt handlers */ 53/* table for system interrupt handlers */
54static struct irq_node *irq_list[NR_IRQS]; 54static struct irq_node *irq_list[NR_IRQS];
55static struct irq_controller *irq_controller[NR_IRQS]; 55static struct irq_chip *irq_chip[NR_IRQS];
56static int irq_depth[NR_IRQS]; 56static int irq_depth[NR_IRQS];
57 57
58static int m68k_first_user_vec; 58static int m68k_first_user_vec;
59 59
60static struct irq_controller auto_irq_controller = { 60static struct irq_chip auto_irq_chip = {
61 .name = "auto", 61 .name = "auto",
62 .lock = __SPIN_LOCK_UNLOCKED(auto_irq_controller.lock), 62 .irq_startup = m68k_irq_startup,
63 .startup = m68k_irq_startup, 63 .irq_shutdown = m68k_irq_shutdown,
64 .shutdown = m68k_irq_shutdown,
65}; 64};
66 65
67static struct irq_controller user_irq_controller = { 66static struct irq_chip user_irq_chip = {
68 .name = "user", 67 .name = "user",
69 .lock = __SPIN_LOCK_UNLOCKED(user_irq_controller.lock), 68 .irq_startup = m68k_irq_startup,
70 .startup = m68k_irq_startup, 69 .irq_shutdown = m68k_irq_shutdown,
71 .shutdown = m68k_irq_shutdown,
72}; 70};
73 71
74#define NUM_IRQ_NODES 100 72#define NUM_IRQ_NODES 100
@@ -96,7 +94,7 @@ void __init init_IRQ(void)
96 } 94 }
97 95
98 for (i = IRQ_AUTO_1; i <= IRQ_AUTO_7; i++) 96 for (i = IRQ_AUTO_1; i <= IRQ_AUTO_7; i++)
99 irq_controller[i] = &auto_irq_controller; 97 irq_chip[i] = &auto_irq_chip;
100 98
101 mach_init_IRQ(); 99 mach_init_IRQ();
102} 100}
@@ -136,7 +134,7 @@ void __init m68k_setup_user_interrupt(unsigned int vec, unsigned int cnt,
136 BUG_ON(IRQ_USER + cnt > NR_IRQS); 134 BUG_ON(IRQ_USER + cnt > NR_IRQS);
137 m68k_first_user_vec = vec; 135 m68k_first_user_vec = vec;
138 for (i = 0; i < cnt; i++) 136 for (i = 0; i < cnt; i++)
139 irq_controller[IRQ_USER + i] = &user_irq_controller; 137 irq_chip[IRQ_USER + i] = &user_irq_chip;
140 *user_irqvec_fixup = vec - IRQ_USER; 138 *user_irqvec_fixup = vec - IRQ_USER;
141 if (handler) 139 if (handler)
142 *user_irqhandler_fixup = (u32)handler; 140 *user_irqhandler_fixup = (u32)handler;
@@ -144,7 +142,7 @@ void __init m68k_setup_user_interrupt(unsigned int vec, unsigned int cnt,
144} 142}
145 143
146/** 144/**
147 * m68k_setup_irq_controller 145 * m68k_setup_irq_chip
148 * @contr: irq controller which controls specified irq 146 * @contr: irq controller which controls specified irq
149 * @irq: first irq to be managed by the controller 147 * @irq: first irq to be managed by the controller
150 * 148 *
@@ -153,13 +151,13 @@ void __init m68k_setup_user_interrupt(unsigned int vec, unsigned int cnt,
153 * be changed as well, but the controller probably should use m68k_irq_startup/ 151 * be changed as well, but the controller probably should use m68k_irq_startup/
154 * m68k_irq_shutdown. 152 * m68k_irq_shutdown.
155 */ 153 */
156void m68k_setup_irq_controller(struct irq_controller *contr, unsigned int irq, 154void m68k_setup_irq_chip(struct irq_chip *contr, unsigned int irq,
157 unsigned int cnt) 155 unsigned int cnt)
158{ 156{
159 int i; 157 int i;
160 158
161 for (i = 0; i < cnt; i++) 159 for (i = 0; i < cnt; i++)
162 irq_controller[irq + i] = contr; 160 irq_chip[irq + i] = contr;
163} 161}
164 162
165irq_node_t *new_irq_node(void) 163irq_node_t *new_irq_node(void)
@@ -180,23 +178,23 @@ irq_node_t *new_irq_node(void)
180 178
181int setup_irq(unsigned int irq, struct irq_node *node) 179int setup_irq(unsigned int irq, struct irq_node *node)
182{ 180{
183 struct irq_controller *contr; 181 struct irq_chip *contr;
184 struct irq_node **prev; 182 struct irq_node **prev;
185 unsigned long flags; 183 unsigned long flags;
186 184
187 if (irq >= NR_IRQS || !(contr = irq_controller[irq])) { 185 if (irq >= NR_IRQS || !(contr = irq_chip[irq])) {
188 printk("%s: Incorrect IRQ %d from %s\n", 186 printk("%s: Incorrect IRQ %d from %s\n",
189 __func__, irq, node->devname); 187 __func__, irq, node->devname);
190 return -ENXIO; 188 return -ENXIO;
191 } 189 }
192 190
193 spin_lock_irqsave(&contr->lock, flags); 191 local_irq_save(flags);
194 192
195 prev = irq_list + irq; 193 prev = irq_list + irq;
196 if (*prev) { 194 if (*prev) {
197 /* Can't share interrupts unless both agree to */ 195 /* Can't share interrupts unless both agree to */
198 if (!((*prev)->flags & node->flags & IRQF_SHARED)) { 196 if (!((*prev)->flags & node->flags & IRQF_SHARED)) {
199 spin_unlock_irqrestore(&contr->lock, flags); 197 local_irq_restore(flags);
200 return -EBUSY; 198 return -EBUSY;
201 } 199 }
202 while (*prev) 200 while (*prev)
@@ -204,15 +202,15 @@ int setup_irq(unsigned int irq, struct irq_node *node)
204 } 202 }
205 203
206 if (!irq_list[irq]) { 204 if (!irq_list[irq]) {
207 if (contr->startup) 205 if (contr->irq_startup)
208 contr->startup(irq); 206 contr->irq_startup(irq);
209 else 207 else
210 contr->enable(irq); 208 contr->irq_enable(irq);
211 } 209 }
212 node->next = NULL; 210 node->next = NULL;
213 *prev = node; 211 *prev = node;
214 212
215 spin_unlock_irqrestore(&contr->lock, flags); 213 local_irq_restore(flags);
216 214
217 return 0; 215 return 0;
218} 216}
@@ -244,16 +242,16 @@ EXPORT_SYMBOL(request_irq);
244 242
245void free_irq(unsigned int irq, void *dev_id) 243void free_irq(unsigned int irq, void *dev_id)
246{ 244{
247 struct irq_controller *contr; 245 struct irq_chip *contr;
248 struct irq_node **p, *node; 246 struct irq_node **p, *node;
249 unsigned long flags; 247 unsigned long flags;
250 248
251 if (irq >= NR_IRQS || !(contr = irq_controller[irq])) { 249 if (irq >= NR_IRQS || !(contr = irq_chip[irq])) {
252 printk("%s: Incorrect IRQ %d\n", __func__, irq); 250 printk("%s: Incorrect IRQ %d\n", __func__, irq);
253 return; 251 return;
254 } 252 }
255 253
256 spin_lock_irqsave(&contr->lock, flags); 254 local_irq_save(flags);
257 255
258 p = irq_list + irq; 256 p = irq_list + irq;
259 while ((node = *p)) { 257 while ((node = *p)) {
@@ -270,58 +268,58 @@ void free_irq(unsigned int irq, void *dev_id)
270 __func__, irq); 268 __func__, irq);
271 269
272 if (!irq_list[irq]) { 270 if (!irq_list[irq]) {
273 if (contr->shutdown) 271 if (contr->irq_shutdown)
274 contr->shutdown(irq); 272 contr->irq_shutdown(irq);
275 else 273 else
276 contr->disable(irq); 274 contr->irq_disable(irq);
277 } 275 }
278 276
279 spin_unlock_irqrestore(&contr->lock, flags); 277 local_irq_restore(flags);
280} 278}
281 279
282EXPORT_SYMBOL(free_irq); 280EXPORT_SYMBOL(free_irq);
283 281
284void enable_irq(unsigned int irq) 282void enable_irq(unsigned int irq)
285{ 283{
286 struct irq_controller *contr; 284 struct irq_chip *contr;
287 unsigned long flags; 285 unsigned long flags;
288 286
289 if (irq >= NR_IRQS || !(contr = irq_controller[irq])) { 287 if (irq >= NR_IRQS || !(contr = irq_chip[irq])) {
290 printk("%s: Incorrect IRQ %d\n", 288 printk("%s: Incorrect IRQ %d\n",
291 __func__, irq); 289 __func__, irq);
292 return; 290 return;
293 } 291 }
294 292
295 spin_lock_irqsave(&contr->lock, flags); 293 local_irq_save(flags);
296 if (irq_depth[irq]) { 294 if (irq_depth[irq]) {
297 if (!--irq_depth[irq]) { 295 if (!--irq_depth[irq]) {
298 if (contr->enable) 296 if (contr->irq_enable)
299 contr->enable(irq); 297 contr->irq_enable(irq);
300 } 298 }
301 } else 299 } else
302 WARN_ON(1); 300 WARN_ON(1);
303 spin_unlock_irqrestore(&contr->lock, flags); 301 local_irq_restore(flags);
304} 302}
305 303
306EXPORT_SYMBOL(enable_irq); 304EXPORT_SYMBOL(enable_irq);
307 305
308void disable_irq(unsigned int irq) 306void disable_irq(unsigned int irq)
309{ 307{
310 struct irq_controller *contr; 308 struct irq_chip *contr;
311 unsigned long flags; 309 unsigned long flags;
312 310
313 if (irq >= NR_IRQS || !(contr = irq_controller[irq])) { 311 if (irq >= NR_IRQS || !(contr = irq_chip[irq])) {
314 printk("%s: Incorrect IRQ %d\n", 312 printk("%s: Incorrect IRQ %d\n",
315 __func__, irq); 313 __func__, irq);
316 return; 314 return;
317 } 315 }
318 316
319 spin_lock_irqsave(&contr->lock, flags); 317 local_irq_save(flags);
320 if (!irq_depth[irq]++) { 318 if (!irq_depth[irq]++) {
321 if (contr->disable) 319 if (contr->irq_disable)
322 contr->disable(irq); 320 contr->irq_disable(irq);
323 } 321 }
324 spin_unlock_irqrestore(&contr->lock, flags); 322 local_irq_restore(flags);
325} 323}
326 324
327EXPORT_SYMBOL(disable_irq); 325EXPORT_SYMBOL(disable_irq);
@@ -330,7 +328,7 @@ void disable_irq_nosync(unsigned int irq) __attribute__((alias("disable_irq")));
330 328
331EXPORT_SYMBOL(disable_irq_nosync); 329EXPORT_SYMBOL(disable_irq_nosync);
332 330
333int m68k_irq_startup(unsigned int irq) 331unsigned int m68k_irq_startup(unsigned int irq)
334{ 332{
335 if (irq <= IRQ_AUTO_7) 333 if (irq <= IRQ_AUTO_7)
336 vectors[VEC_SPUR + irq] = auto_inthandler; 334 vectors[VEC_SPUR + irq] = auto_inthandler;
@@ -413,13 +411,13 @@ asmlinkage void handle_badint(struct pt_regs *regs)
413 411
414int show_interrupts(struct seq_file *p, void *v) 412int show_interrupts(struct seq_file *p, void *v)
415{ 413{
416 struct irq_controller *contr; 414 struct irq_chip *contr;
417 struct irq_node *node; 415 struct irq_node *node;
418 int i = *(loff_t *) v; 416 int i = *(loff_t *) v;
419 417
420 /* autovector interrupts */ 418 /* autovector interrupts */
421 if (irq_list[i]) { 419 if (irq_list[i]) {
422 contr = irq_controller[i]; 420 contr = irq_chip[i];
423 node = irq_list[i]; 421 node = irq_list[i];
424 seq_printf(p, "%-8s %3u: %10u %s", contr->name, i, kstat_cpu(0).irqs[i], node->devname); 422 seq_printf(p, "%-8s %3u: %10u %s", contr->name, i, kstat_cpu(0).irqs[i], node->devname);
425 while ((node = node->next)) 423 while ((node = node->next))