tizen 2.3.1 release
[kernel/linux-3.0.git] / kernel / irq / handle.c
index 8565360..0b552df 100644 (file)
 #include <mach/sec_debug.h>
 
 #include "internals.h"
-
+#ifdef CONFIG_SLP_WAKEUP_COUNT
+#include <linux/suspend.h>
+static DEFINE_SPINLOCK(wakeup_status_lock);
+#endif
 /**
  * handle_bad_irq - handle spurious and unhandled irqs
  * @irq:       the interrupt number
@@ -119,7 +122,7 @@ irqreturn_t
 handle_irq_event_percpu(struct irq_desc *desc, struct irqaction *action)
 {
        irqreturn_t retval = IRQ_NONE;
-       unsigned int random = 0, irq = desc->irq_data.irq;
+       unsigned int flags = 0, irq = desc->irq_data.irq;
 
        do {
                irqreturn_t res;
@@ -149,7 +152,7 @@ handle_irq_event_percpu(struct irq_desc *desc, struct irqaction *action)
 
                        /* Fall through to add to randomness */
                case IRQ_HANDLED:
-                       random |= action->flags;
+                       flags |= action->flags;
                        break;
 
                default:
@@ -160,8 +163,7 @@ handle_irq_event_percpu(struct irq_desc *desc, struct irqaction *action)
                action = action->next;
        } while (action);
 
-       if (random & IRQF_SAMPLE_RANDOM)
-               add_interrupt_randomness(irq);
+       add_interrupt_randomness(irq, flags);
 
        if (!noirqdebug)
                note_interrupt(irq, desc, retval);
@@ -172,10 +174,23 @@ irqreturn_t handle_irq_event(struct irq_desc *desc)
 {
        struct irqaction *action = desc->action;
        irqreturn_t ret;
+#ifdef CONFIG_SLP_WAKEUP_COUNT
+       unsigned long irqflags;
+#endif
 
        desc->istate &= ~IRQS_PENDING;
        irqd_set(&desc->irq_data, IRQD_IRQ_INPROGRESS);
        raw_spin_unlock(&desc->lock);
+#ifdef CONFIG_SLP_WAKEUP_COUNT
+       spin_lock_irqsave(&wakeup_status_lock, irqflags);       /* to be safe */
+       if (wakeup_state) {
+               raw_spin_lock(&desc->lock);
+               desc->hit_in_sleep++;
+               raw_spin_unlock(&desc->lock);
+               wakeup_state = 0;
+       }
+       spin_unlock_irqrestore(&wakeup_status_lock, irqflags);
+#endif
 
        ret = handle_irq_event_percpu(desc, action);