Skip to content

Commit

Permalink
genirq: Move wakeup state to irq_data
Browse files Browse the repository at this point in the history
Some irq_chips need to know the state of wakeup mode for
setting the trigger type etc. Reflect it in irq_data state.

Signed-off-by: Thomas Gleixner <[email protected]>
  • Loading branch information
KAGA-KOKO committed Feb 19, 2011
1 parent d4d5e08 commit 7f94226
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
8 changes: 8 additions & 0 deletions include/linux/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ struct irq_data {
* IRQD_PER_CPU - Interrupt is per cpu
* IRQD_AFFINITY_SET - Interrupt affinity was set
* IRQD_LEVEL - Interrupt is level triggered
* IRQD_WAKEUP_STATE - Interrupt is configured for wakeup
* from suspend
*/
enum {
IRQD_TRIGGER_MASK = 0xf,
Expand All @@ -176,6 +178,7 @@ enum {
IRQD_PER_CPU = (1 << 11),
IRQD_AFFINITY_SET = (1 << 12),
IRQD_LEVEL = (1 << 13),
IRQD_WAKEUP_STATE = (1 << 14),
};

static inline bool irqd_is_setaffinity_pending(struct irq_data *d)
Expand Down Expand Up @@ -217,6 +220,11 @@ static inline bool irqd_is_level_type(struct irq_data *d)
return d->state_use_accessors & IRQD_LEVEL;
}

static inline bool irqd_is_wakeup_set(struct irq_data *d)
{
return d->state_use_accessors & IRQD_WAKEUP_STATE;
}

/**
* struct irq_chip - hardware interrupt chip descriptor
*
Expand Down
2 changes: 0 additions & 2 deletions kernel/irq/internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ enum {
* IRQS_PENDING - irq is pending and replayed later
* IRQS_MASKED - irq is masked
* IRQS_SUSPENDED - irq is suspended
* IRQS_WAKEUP - irq triggers system wakeup from suspend
*/
enum {
IRQS_AUTODETECT = 0x00000001,
Expand All @@ -60,7 +59,6 @@ enum {
IRQS_PENDING = 0x00000200,
IRQS_MASKED = 0x00000400,
IRQS_SUSPENDED = 0x00000800,
IRQS_WAKEUP = 0x00001000,
};

#include "compat.h"
Expand Down
4 changes: 2 additions & 2 deletions kernel/irq/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ int irq_set_irq_wake(unsigned int irq, unsigned int on)
if (ret)
desc->wake_depth = 0;
else
desc->istate |= IRQS_WAKEUP;
irqd_set(&desc->irq_data, IRQD_WAKEUP_STATE);
}
} else {
if (desc->wake_depth == 0) {
Expand All @@ -502,7 +502,7 @@ int irq_set_irq_wake(unsigned int irq, unsigned int on)
if (ret)
desc->wake_depth = 1;
else
desc->istate &= ~IRQS_WAKEUP;
irqd_clear(&desc->irq_data, IRQD_WAKEUP_STATE);
}
}

Expand Down
2 changes: 1 addition & 1 deletion kernel/irq/pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ int check_wakeup_irqs(void)
int irq;

for_each_irq_desc(irq, desc)
if ((desc->istate & IRQS_WAKEUP) &&
if (irqd_is_wakeup_set(&desc->irq_data) &&
(desc->istate & IRQS_PENDING))
return -EBUSY;

Expand Down

0 comments on commit 7f94226

Please sign in to comment.