manage.c (fece13ca005a5f559147e9424321f4b5e01272b4) | manage.c (02cea3958664723a5d2236f0f0058de97c7e4693) |
---|---|
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 */ --- 54 unchanged lines hidden (view full) --- 63 * interrupt to complete before returning. If you use this 64 * function while holding a resource the IRQ handler may need you 65 * will deadlock. It does not take associated threaded handlers 66 * into account. 67 * 68 * Do not use this for shutdown scenarios where you must be sure 69 * that all parts (hardirq and threaded handler) have completed. 70 * | 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 */ --- 54 unchanged lines hidden (view full) --- 63 * interrupt to complete before returning. If you use this 64 * function while holding a resource the IRQ handler may need you 65 * will deadlock. It does not take associated threaded handlers 66 * into account. 67 * 68 * Do not use this for shutdown scenarios where you must be sure 69 * that all parts (hardirq and threaded handler) have completed. 70 * |
71 * Returns: false if a threaded handler is active. 72 * |
|
71 * This function may be called - with care - from IRQ context. 72 */ | 73 * This function may be called - with care - from IRQ context. 74 */ |
73void synchronize_hardirq(unsigned int irq) | 75bool synchronize_hardirq(unsigned int irq) |
74{ 75 struct irq_desc *desc = irq_to_desc(irq); 76 | 76{ 77 struct irq_desc *desc = irq_to_desc(irq); 78 |
77 if (desc) | 79 if (desc) { |
78 __synchronize_hardirq(desc); | 80 __synchronize_hardirq(desc); |
81 return !atomic_read(&desc->threads_active); 82 } 83 84 return true; |
|
79} 80EXPORT_SYMBOL(synchronize_hardirq); 81 82/** 83 * synchronize_irq - wait for pending IRQ handlers (on other CPUs) 84 * @irq: interrupt number to wait for 85 * 86 * This function waits for any pending IRQ handlers for this interrupt --- 348 unchanged lines hidden (view full) --- 435 */ 436void disable_irq(unsigned int irq) 437{ 438 if (!__disable_irq_nosync(irq)) 439 synchronize_irq(irq); 440} 441EXPORT_SYMBOL(disable_irq); 442 | 85} 86EXPORT_SYMBOL(synchronize_hardirq); 87 88/** 89 * synchronize_irq - wait for pending IRQ handlers (on other CPUs) 90 * @irq: interrupt number to wait for 91 * 92 * This function waits for any pending IRQ handlers for this interrupt --- 348 unchanged lines hidden (view full) --- 441 */ 442void disable_irq(unsigned int irq) 443{ 444 if (!__disable_irq_nosync(irq)) 445 synchronize_irq(irq); 446} 447EXPORT_SYMBOL(disable_irq); 448 |
449/** 450 * disable_hardirq - disables an irq and waits for hardirq completion 451 * @irq: Interrupt to disable 452 * 453 * Disable the selected interrupt line. Enables and Disables are 454 * nested. 455 * This function waits for any pending hard IRQ handlers for this 456 * interrupt to complete before returning. If you use this function while 457 * holding a resource the hard IRQ handler may need you will deadlock. 458 * 459 * When used to optimistically disable an interrupt from atomic context 460 * the return value must be checked. 461 * 462 * Returns: false if a threaded handler is active. 463 * 464 * This function may be called - with care - from IRQ context. 465 */ 466bool disable_hardirq(unsigned int irq) 467{ 468 if (!__disable_irq_nosync(irq)) 469 return synchronize_hardirq(irq); 470 471 return false; 472} 473EXPORT_SYMBOL_GPL(disable_hardirq); 474 |
|
443void __enable_irq(struct irq_desc *desc, unsigned int irq) 444{ 445 switch (desc->depth) { 446 case 0: 447 err_out: 448 WARN(1, KERN_WARNING "Unbalanced enable for IRQ %d\n", irq); 449 break; 450 case 1: { --- 1313 unchanged lines hidden --- | 475void __enable_irq(struct irq_desc *desc, unsigned int irq) 476{ 477 switch (desc->depth) { 478 case 0: 479 err_out: 480 WARN(1, KERN_WARNING "Unbalanced enable for IRQ %d\n", irq); 481 break; 482 case 1: { --- 1313 unchanged lines hidden --- |