genirq: Mark wakeup sources as armed on suspend
authorThomas Gleixner <tglx@linutronix.de>
Fri, 29 Aug 2014 11:54:09 +0000 (13:54 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 1 Sep 2014 11:48:51 +0000 (13:48 +0200)
This allows us to utilize this information in the irq_may_run() check
without adding another conditional to the fast path.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
include/linux/irq.h
kernel/irq/pm.c

index 62af592..03f48d9 100644 (file)
@@ -173,6 +173,7 @@ struct irq_data {
  * IRQD_IRQ_DISABLED           - Disabled state of the interrupt
  * IRQD_IRQ_MASKED             - Masked state of the interrupt
  * IRQD_IRQ_INPROGRESS         - In progress state of the interrupt
+ * IRQD_WAKEUP_ARMED           - Wakeup mode armed
  */
 enum {
        IRQD_TRIGGER_MASK               = 0xf,
@@ -186,6 +187,7 @@ enum {
        IRQD_IRQ_DISABLED               = (1 << 16),
        IRQD_IRQ_MASKED                 = (1 << 17),
        IRQD_IRQ_INPROGRESS             = (1 << 18),
+       IRQD_WAKEUP_ARMED               = (1 << 19),
 };
 
 static inline bool irqd_is_setaffinity_pending(struct irq_data *d)
@@ -257,6 +259,12 @@ static inline bool irqd_irq_inprogress(struct irq_data *d)
        return d->state_use_accessors & IRQD_IRQ_INPROGRESS;
 }
 
+static inline bool irqd_is_wakeup_armed(struct irq_data *d)
+{
+       return d->state_use_accessors & IRQD_WAKEUP_ARMED;
+}
+
+
 /*
  * Functions for chained handlers which can be enabled/disabled by the
  * standard disable_irq/enable_irq calls. Must be called with
index cf0ce01..766930e 100644 (file)
@@ -54,6 +54,9 @@ static bool suspend_device_irq(struct irq_desc *desc, int irq)
        if (!desc->action || desc->no_suspend_depth)
                return false;
 
+       if (irqd_is_wakeup_set(&desc->irq_data))
+               irqd_set(&desc->irq_data, IRQD_WAKEUP_ARMED);
+
        desc->istate |= IRQS_SUSPENDED;
        __disable_irq(desc, irq);
 
@@ -101,6 +104,8 @@ EXPORT_SYMBOL_GPL(suspend_device_irqs);
 
 static void resume_irq(struct irq_desc *desc, int irq)
 {
+       irqd_clear(&desc->irq_data, IRQD_WAKEUP_ARMED);
+
        if (desc->istate & IRQS_SUSPENDED)
                goto resume;