manage.c (7d94f7ca401dd7f445fda9a971a48aa5427b3e55) | manage.c (cb5bc83225a86ca53bbb889ed8439e4fd6cf44ac) |
---|---|
1/* 2 * linux/kernel/irq/manage.c 3 * 4 * Copyright (C) 1992, 1998-2006 Linus Torvalds, Ingo Molnar 5 * Copyright (C) 2005-2006 Thomas Gleixner 6 * 7 * This file contains driver APIs to the irq subsystem. 8 */ --- 17 unchanged lines hidden (view full) --- 26 * This function waits for any pending IRQ handlers for this interrupt 27 * to complete before returning. If you use this function while 28 * holding a resource the IRQ handler may need you will deadlock. 29 * 30 * This function may be called - with care - from IRQ context. 31 */ 32void synchronize_irq(unsigned int irq) 33{ | 1/* 2 * linux/kernel/irq/manage.c 3 * 4 * Copyright (C) 1992, 1998-2006 Linus Torvalds, Ingo Molnar 5 * Copyright (C) 2005-2006 Thomas Gleixner 6 * 7 * This file contains driver APIs to the irq subsystem. 8 */ --- 17 unchanged lines hidden (view full) --- 26 * This function waits for any pending IRQ handlers for this interrupt 27 * to complete before returning. If you use this function while 28 * holding a resource the IRQ handler may need you will deadlock. 29 * 30 * This function may be called - with care - from IRQ context. 31 */ 32void synchronize_irq(unsigned int irq) 33{ |
34 struct irq_desc *desc = __irq_to_desc(irq); | 34 struct irq_desc *desc = irq_to_desc(irq); |
35 unsigned int status; 36 37 if (!desc) 38 return; 39 40 do { 41 unsigned long flags; 42 --- 97 unchanged lines hidden (view full) --- 140 * 141 * This function may be called from IRQ context. 142 */ 143void disable_irq_nosync(unsigned int irq) 144{ 145 struct irq_desc *desc; 146 unsigned long flags; 147 | 35 unsigned int status; 36 37 if (!desc) 38 return; 39 40 do { 41 unsigned long flags; 42 --- 97 unchanged lines hidden (view full) --- 140 * 141 * This function may be called from IRQ context. 142 */ 143void disable_irq_nosync(unsigned int irq) 144{ 145 struct irq_desc *desc; 146 unsigned long flags; 147 |
148 desc = __irq_to_desc(irq); | 148 desc = irq_to_desc(irq); |
149 if (!desc) 150 return; 151 152 spin_lock_irqsave(&desc->lock, flags); 153 if (!desc->depth++) { 154 desc->status |= IRQ_DISABLED; 155 desc->chip->disable(irq); 156 } --- 12 unchanged lines hidden (view full) --- 169 * holding a resource the IRQ handler may need you will deadlock. 170 * 171 * This function may be called - with care - from IRQ context. 172 */ 173void disable_irq(unsigned int irq) 174{ 175 struct irq_desc *desc; 176 | 149 if (!desc) 150 return; 151 152 spin_lock_irqsave(&desc->lock, flags); 153 if (!desc->depth++) { 154 desc->status |= IRQ_DISABLED; 155 desc->chip->disable(irq); 156 } --- 12 unchanged lines hidden (view full) --- 169 * holding a resource the IRQ handler may need you will deadlock. 170 * 171 * This function may be called - with care - from IRQ context. 172 */ 173void disable_irq(unsigned int irq) 174{ 175 struct irq_desc *desc; 176 |
177 desc = __irq_to_desc(irq); | 177 desc = irq_to_desc(irq); |
178 if (!desc) 179 return; 180 181 disable_irq_nosync(irq); 182 if (desc->action) 183 synchronize_irq(irq); 184} 185EXPORT_SYMBOL(disable_irq); --- 27 unchanged lines hidden (view full) --- 213 * 214 * This function may be called from IRQ context. 215 */ 216void enable_irq(unsigned int irq) 217{ 218 struct irq_desc *desc; 219 unsigned long flags; 220 | 178 if (!desc) 179 return; 180 181 disable_irq_nosync(irq); 182 if (desc->action) 183 synchronize_irq(irq); 184} 185EXPORT_SYMBOL(disable_irq); --- 27 unchanged lines hidden (view full) --- 213 * 214 * This function may be called from IRQ context. 215 */ 216void enable_irq(unsigned int irq) 217{ 218 struct irq_desc *desc; 219 unsigned long flags; 220 |
221 desc = __irq_to_desc(irq); | 221 desc = irq_to_desc(irq); |
222 if (!desc) 223 return; 224 225 spin_lock_irqsave(&desc->lock, flags); 226 __enable_irq(desc, irq); 227 spin_unlock_irqrestore(&desc->lock, flags); 228} 229EXPORT_SYMBOL(enable_irq); --- 61 unchanged lines hidden (view full) --- 291 * particular irq has been exclusively allocated or is available 292 * for driver use. 293 */ 294int can_request_irq(unsigned int irq, unsigned long irqflags) 295{ 296 struct irq_desc *desc; 297 struct irqaction *action; 298 | 222 if (!desc) 223 return; 224 225 spin_lock_irqsave(&desc->lock, flags); 226 __enable_irq(desc, irq); 227 spin_unlock_irqrestore(&desc->lock, flags); 228} 229EXPORT_SYMBOL(enable_irq); --- 61 unchanged lines hidden (view full) --- 291 * particular irq has been exclusively allocated or is available 292 * for driver use. 293 */ 294int can_request_irq(unsigned int irq, unsigned long irqflags) 295{ 296 struct irq_desc *desc; 297 struct irqaction *action; 298 |
299 desc = __irq_to_desc(irq); | 299 desc = irq_to_desc(irq); |
300 if (!desc) 301 return 0; 302 303 if (desc->status & IRQ_NOREQUEST) 304 return 0; 305 306 action = desc->action; 307 if (action) --- 53 unchanged lines hidden (view full) --- 361{ 362 struct irq_desc *desc; 363 struct irqaction *old, **p; 364 const char *old_name = NULL; 365 unsigned long flags; 366 int shared = 0; 367 int ret; 368 | 300 if (!desc) 301 return 0; 302 303 if (desc->status & IRQ_NOREQUEST) 304 return 0; 305 306 action = desc->action; 307 if (action) --- 53 unchanged lines hidden (view full) --- 361{ 362 struct irq_desc *desc; 363 struct irqaction *old, **p; 364 const char *old_name = NULL; 365 unsigned long flags; 366 int shared = 0; 367 int ret; 368 |
369 desc = __irq_to_desc(irq); | 369 desc = irq_to_desc(irq); |
370 if (!desc) 371 return -EINVAL; 372 373 if (desc->chip == &no_irq_chip) 374 return -ENOSYS; 375 /* 376 * Some drivers like serial.c use request_irq() heavily, 377 * so we have to be careful not to interfere with a --- 144 unchanged lines hidden (view full) --- 522void free_irq(unsigned int irq, void *dev_id) 523{ 524 struct irq_desc *desc; 525 struct irqaction **p; 526 unsigned long flags; 527 528 WARN_ON(in_interrupt()); 529 | 370 if (!desc) 371 return -EINVAL; 372 373 if (desc->chip == &no_irq_chip) 374 return -ENOSYS; 375 /* 376 * Some drivers like serial.c use request_irq() heavily, 377 * so we have to be careful not to interfere with a --- 144 unchanged lines hidden (view full) --- 522void free_irq(unsigned int irq, void *dev_id) 523{ 524 struct irq_desc *desc; 525 struct irqaction **p; 526 unsigned long flags; 527 528 WARN_ON(in_interrupt()); 529 |
530 desc = __irq_to_desc(irq); | 530 desc = irq_to_desc(irq); |
531 if (!desc) 532 return; 533 534 spin_lock_irqsave(&desc->lock, flags); 535 p = &desc->action; 536 for (;;) { 537 struct irqaction *action = *p; 538 --- 100 unchanged lines hidden (view full) --- 639 * Sanity-check: shared interrupts must pass in a real dev-ID, 640 * otherwise we'll have trouble later trying to figure out 641 * which interrupt is which (messes up the interrupt freeing 642 * logic etc). 643 */ 644 if ((irqflags & IRQF_SHARED) && !dev_id) 645 return -EINVAL; 646 | 531 if (!desc) 532 return; 533 534 spin_lock_irqsave(&desc->lock, flags); 535 p = &desc->action; 536 for (;;) { 537 struct irqaction *action = *p; 538 --- 100 unchanged lines hidden (view full) --- 639 * Sanity-check: shared interrupts must pass in a real dev-ID, 640 * otherwise we'll have trouble later trying to figure out 641 * which interrupt is which (messes up the interrupt freeing 642 * logic etc). 643 */ 644 if ((irqflags & IRQF_SHARED) && !dev_id) 645 return -EINVAL; 646 |
647 desc = __irq_to_desc(irq); | 647 desc = irq_to_desc(irq); |
648 if (!desc) 649 return -EINVAL; 650 651 if (desc->status & IRQ_NOREQUEST) 652 return -EINVAL; 653 if (!handler) 654 return -EINVAL; 655 --- 37 unchanged lines hidden --- | 648 if (!desc) 649 return -EINVAL; 650 651 if (desc->status & IRQ_NOREQUEST) 652 return -EINVAL; 653 if (!handler) 654 return -EINVAL; 655 --- 37 unchanged lines hidden --- |