Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 32913
b: refs/heads/master
c: 15a647e
h: refs/heads/master
i:
  32911: e7f2883
v: v3
  • Loading branch information
David Brownell authored and Linus Torvalds committed Jul 31, 2006
1 parent 91b8aeb commit 6dcfe14
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5e44ef238b7eb607532e89249e7b2523faf77a92
refs/heads/master: 15a647eba94c3da27ccc666bea72e7cca06b2d19
3 changes: 3 additions & 0 deletions trunk/include/linux/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
#define IRQ_NOREQUEST 0x04000000 /* IRQ cannot be requested */
#define IRQ_NOAUTOEN 0x08000000 /* IRQ will not be enabled on request irq */
#define IRQ_DELAYED_DISABLE 0x10000000 /* IRQ disable (masking) happens delayed. */
#define IRQ_WAKEUP 0x20000000 /* IRQ triggers system wakeup */

struct proc_dir_entry;

Expand Down Expand Up @@ -124,6 +125,7 @@ struct irq_chip {
* @action: the irq action chain
* @status: status information
* @depth: disable-depth, for nested irq_disable() calls
* @wake_depth: enable depth, for multiple set_irq_wake() callers
* @irq_count: stats field to detect stalled irqs
* @irqs_unhandled: stats field for spurious unhandled interrupts
* @lock: locking for SMP
Expand All @@ -147,6 +149,7 @@ struct irq_desc {
unsigned int status; /* IRQ status */

unsigned int depth; /* nested irq disables */
unsigned int wake_depth; /* nested wake enables */
unsigned int irq_count; /* For detecting broken IRQs */
unsigned int irqs_unhandled;
spinlock_t lock;
Expand Down
28 changes: 26 additions & 2 deletions trunk/kernel/irq/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,16 +137,40 @@ EXPORT_SYMBOL(enable_irq);
* @irq: interrupt to control
* @on: enable/disable power management wakeup
*
* Enable/disable power management wakeup mode
* Enable/disable power management wakeup mode, which is
* disabled by default. Enables and disables must match,
* just as they match for non-wakeup mode support.
*
* Wakeup mode lets this IRQ wake the system from sleep
* states like "suspend to RAM".
*/
int set_irq_wake(unsigned int irq, unsigned int on)
{
struct irq_desc *desc = irq_desc + irq;
unsigned long flags;
int ret = -ENXIO;
int (*set_wake)(unsigned, unsigned) = desc->chip->set_wake;

/* wakeup-capable irqs can be shared between drivers that
* don't need to have the same sleep mode behaviors.
*/
spin_lock_irqsave(&desc->lock, flags);
if (desc->chip->set_wake)
if (on) {
if (desc->wake_depth++ == 0)
desc->status |= IRQ_WAKEUP;
else
set_wake = NULL;
} else {
if (desc->wake_depth == 0) {
printk(KERN_WARNING "Unbalanced IRQ %d "
"wake disable\n", irq);
WARN_ON(1);
} else if (--desc->wake_depth == 0)
desc->status &= ~IRQ_WAKEUP;
else
set_wake = NULL;
}
if (set_wake)
ret = desc->chip->set_wake(irq, on);
spin_unlock_irqrestore(&desc->lock, flags);
return ret;
Expand Down

0 comments on commit 6dcfe14

Please sign in to comment.