aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/irq/manage.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-06-29 05:24:40 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-29 13:26:22 -0400
commit06fcb0c6fb3aae9570a32ac3b72a8222563baa69 (patch)
treec1f9d750a42031434971b2271882b907fd7838f5 /kernel/irq/manage.c
parent2e60bbb6d50de654d8e68f115161e27878b5e72d (diff)
[PATCH] genirq: cleanup: misc code cleanups
Assorted code cleanups to the generic IRQ code. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/irq/manage.c')
-rw-r--r--kernel/irq/manage.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index c53662edc73d..261906ebdf04 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -40,7 +40,6 @@ void synchronize_irq(unsigned int irq)
40 while (desc->status & IRQ_INPROGRESS) 40 while (desc->status & IRQ_INPROGRESS)
41 cpu_relax(); 41 cpu_relax();
42} 42}
43
44EXPORT_SYMBOL(synchronize_irq); 43EXPORT_SYMBOL(synchronize_irq);
45 44
46#endif 45#endif
@@ -71,7 +70,6 @@ void disable_irq_nosync(unsigned int irq)
71 } 70 }
72 spin_unlock_irqrestore(&desc->lock, flags); 71 spin_unlock_irqrestore(&desc->lock, flags);
73} 72}
74
75EXPORT_SYMBOL(disable_irq_nosync); 73EXPORT_SYMBOL(disable_irq_nosync);
76 74
77/** 75/**
@@ -97,7 +95,6 @@ void disable_irq(unsigned int irq)
97 if (desc->action) 95 if (desc->action)
98 synchronize_irq(irq); 96 synchronize_irq(irq);
99} 97}
100
101EXPORT_SYMBOL(disable_irq); 98EXPORT_SYMBOL(disable_irq);
102 99
103/** 100/**
@@ -139,7 +136,6 @@ void enable_irq(unsigned int irq)
139 } 136 }
140 spin_unlock_irqrestore(&desc->lock, flags); 137 spin_unlock_irqrestore(&desc->lock, flags);
141} 138}
142
143EXPORT_SYMBOL(enable_irq); 139EXPORT_SYMBOL(enable_irq);
144 140
145/* 141/*
@@ -166,7 +162,7 @@ int can_request_irq(unsigned int irq, unsigned long irqflags)
166 * Internal function to register an irqaction - typically used to 162 * Internal function to register an irqaction - typically used to
167 * allocate special interrupts that are part of the architecture. 163 * allocate special interrupts that are part of the architecture.
168 */ 164 */
169int setup_irq(unsigned int irq, struct irqaction * new) 165int setup_irq(unsigned int irq, struct irqaction *new)
170{ 166{
171 struct irq_desc *desc = irq_desc + irq; 167 struct irq_desc *desc = irq_desc + irq;
172 struct irqaction *old, **p; 168 struct irqaction *old, **p;
@@ -198,9 +194,10 @@ int setup_irq(unsigned int irq, struct irqaction * new)
198 /* 194 /*
199 * The following block of code has to be executed atomically 195 * The following block of code has to be executed atomically
200 */ 196 */
201 spin_lock_irqsave(&desc->lock,flags); 197 spin_lock_irqsave(&desc->lock, flags);
202 p = &desc->action; 198 p = &desc->action;
203 if ((old = *p) != NULL) { 199 old = *p;
200 if (old) {
204 /* Can't share interrupts unless both agree to */ 201 /* Can't share interrupts unless both agree to */
205 if (!(old->flags & new->flags & SA_SHIRQ)) 202 if (!(old->flags & new->flags & SA_SHIRQ))
206 goto mismatch; 203 goto mismatch;
@@ -233,7 +230,7 @@ int setup_irq(unsigned int irq, struct irqaction * new)
233 else 230 else
234 desc->chip->enable(irq); 231 desc->chip->enable(irq);
235 } 232 }
236 spin_unlock_irqrestore(&desc->lock,flags); 233 spin_unlock_irqrestore(&desc->lock, flags);
237 234
238 new->irq = irq; 235 new->irq = irq;
239 register_irq_proc(irq); 236 register_irq_proc(irq);
@@ -276,10 +273,10 @@ void free_irq(unsigned int irq, void *dev_id)
276 return; 273 return;
277 274
278 desc = irq_desc + irq; 275 desc = irq_desc + irq;
279 spin_lock_irqsave(&desc->lock,flags); 276 spin_lock_irqsave(&desc->lock, flags);
280 p = &desc->action; 277 p = &desc->action;
281 for (;;) { 278 for (;;) {
282 struct irqaction * action = *p; 279 struct irqaction *action = *p;
283 280
284 if (action) { 281 if (action) {
285 struct irqaction **pp = p; 282 struct irqaction **pp = p;
@@ -304,7 +301,7 @@ void free_irq(unsigned int irq, void *dev_id)
304 else 301 else
305 desc->chip->disable(irq); 302 desc->chip->disable(irq);
306 } 303 }
307 spin_unlock_irqrestore(&desc->lock,flags); 304 spin_unlock_irqrestore(&desc->lock, flags);
308 unregister_handler_proc(irq, action); 305 unregister_handler_proc(irq, action);
309 306
310 /* Make sure it's not being used on another CPU */ 307 /* Make sure it's not being used on another CPU */
@@ -312,12 +309,11 @@ void free_irq(unsigned int irq, void *dev_id)
312 kfree(action); 309 kfree(action);
313 return; 310 return;
314 } 311 }
315 printk(KERN_ERR "Trying to free free IRQ%d\n",irq); 312 printk(KERN_ERR "Trying to free free IRQ%d\n", irq);
316 spin_unlock_irqrestore(&desc->lock,flags); 313 spin_unlock_irqrestore(&desc->lock, flags);
317 return; 314 return;
318 } 315 }
319} 316}
320
321EXPORT_SYMBOL(free_irq); 317EXPORT_SYMBOL(free_irq);
322 318
323/** 319/**
@@ -351,9 +347,9 @@ EXPORT_SYMBOL(free_irq);
351 */ 347 */
352int request_irq(unsigned int irq, 348int request_irq(unsigned int irq,
353 irqreturn_t (*handler)(int, void *, struct pt_regs *), 349 irqreturn_t (*handler)(int, void *, struct pt_regs *),
354 unsigned long irqflags, const char * devname, void *dev_id) 350 unsigned long irqflags, const char *devname, void *dev_id)
355{ 351{
356 struct irqaction * action; 352 struct irqaction *action;
357 int retval; 353 int retval;
358 354
359 /* 355 /*
@@ -388,6 +384,5 @@ int request_irq(unsigned int irq,
388 384
389 return retval; 385 return retval;
390} 386}
391
392EXPORT_SYMBOL(request_irq); 387EXPORT_SYMBOL(request_irq);
393 388