sparseirq: move kstat_irqs from kstat to irq_desc - fix
authorYinghai Lu <yhlu.kernel@gmail.com>
Mon, 25 Aug 2008 19:41:19 +0000 (12:41 -0700)
committerIngo Molnar <mingo@elte.hu>
Thu, 16 Oct 2008 14:53:04 +0000 (16:53 +0200)
fix non-sparseirq architectures.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
include/linux/irq.h
include/linux/kernel_stat.h
kernel/irq/chip.c
kernel/irq/handle.c

index 2445d2b3d5dc21638c8c57de6ff6f54cdb8a0bb0..93fe9a943e714c14802869b3a769f24ca4aed2bd 100644 (file)
@@ -161,8 +161,6 @@ struct irq_desc {
 #endif
 #ifdef CONFIG_HAVE_DYN_ARRAY
        unsigned int            *kstat_irqs;
-#else
-       unsigned int            kstat_irqs[NR_CPUS];
 #endif
 #if defined(CONFIG_INTR_REMAP) && defined(CONFIG_HAVE_SPARSE_IRQ)
        struct irq_2_iommu      *irq_2_iommu;
@@ -219,8 +217,10 @@ extern struct irq_desc *sparse_irqs;
 
 #endif
 
+#ifdef CONFIG_HAVE_DYN_ARRAY
 #define kstat_irqs_this_cpu(DESC) \
        ((DESC)->kstat_irqs[smp_processor_id()])
+#endif
 
 /*
  * Migration helpers for obsolete names, they will go away:
index f10616712de586a0ce3999dc7be30d30e0a94f80..21249d8c129370a3f3b6702f06f5784277806001 100644 (file)
@@ -28,7 +28,7 @@ struct cpu_usage_stat {
 
 struct kernel_stat {
        struct cpu_usage_stat   cpustat;
-#ifndef CONFIG_GENERIC_HARDIRQS
+#ifndef CONFIG_HAVE_DYN_ARRAY
        unsigned int irqs[NR_IRQS];
 #endif
 };
@@ -41,7 +41,13 @@ DECLARE_PER_CPU(struct kernel_stat, kstat);
 
 extern unsigned long long nr_context_switches(void);
 
-#ifndef CONFIG_GENERIC_HARDIRQS
+#ifndef CONFIG_HAVE_DYN_ARRAY
+#define kstat_irqs_this_cpu(irq) \
+       (kstat_this_cpu.irqs[irq])
+#endif
+
+
+#ifndef CONFIG_HAVE_DYN_ARRAY
 static inline unsigned int kstat_irqs_cpu(unsigned int irq, int cpu)
 {
        return kstat_cpu(cpu).irqs[irq];
index 9fc5e69213ded4b91752c5c2b2f8d158f729ba00..4ef555c50db8da27f02106e1ca50e656ad47e6bb 100644 (file)
@@ -327,7 +327,11 @@ handle_simple_irq(unsigned int irq, struct irq_desc *desc)
        if (unlikely(desc->status & IRQ_INPROGRESS))
                goto out_unlock;
        desc->status &= ~(IRQ_REPLAY | IRQ_WAITING);
+#ifdef CONFIG_HAVE_DYN_ARRAY
        kstat_irqs_this_cpu(desc)++;
+#else
+       kstat_irqs_this_cpu(irq)++;
+#endif
 
        action = desc->action;
        if (unlikely(!action || (desc->status & IRQ_DISABLED)))
@@ -368,7 +372,11 @@ handle_level_irq(unsigned int irq, struct irq_desc *desc)
        if (unlikely(desc->status & IRQ_INPROGRESS))
                goto out_unlock;
        desc->status &= ~(IRQ_REPLAY | IRQ_WAITING);
+#ifdef CONFIG_HAVE_DYN_ARRAY
        kstat_irqs_this_cpu(desc)++;
+#else
+       kstat_irqs_this_cpu(irq)++;
+#endif
 
        /*
         * If its disabled or no action available
@@ -415,7 +423,11 @@ handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc)
                goto out;
 
        desc->status &= ~(IRQ_REPLAY | IRQ_WAITING);
+#ifdef CONFIG_HAVE_DYN_ARRAY
        kstat_irqs_this_cpu(desc)++;
+#else
+       kstat_irqs_this_cpu(irq)++;
+#endif
 
        /*
         * If its disabled or no action available
@@ -479,8 +491,11 @@ handle_edge_irq(unsigned int irq, struct irq_desc *desc)
                mask_ack_irq(desc, irq);
                goto out_unlock;
        }
-
+#ifdef CONFIG_HAVE_DYN_ARRAY
        kstat_irqs_this_cpu(desc)++;
+#else
+       kstat_irqs_this_cpu(irq)++;
+#endif
 
        /* Start handling the irq */
        desc->chip->ack(irq);
@@ -535,7 +550,11 @@ handle_percpu_irq(unsigned int irq, struct irq_desc *desc)
 {
        irqreturn_t action_ret;
 
+#ifdef CONFIG_HAVE_DYN_ARRAY
        kstat_irqs_this_cpu(desc)++;
+#else
+       kstat_irqs_this_cpu(irq)++;
+#endif
 
        if (desc->chip->ack)
                desc->chip->ack(irq);
index d638a911cbc11a4e8584b1e75829963ece12d92f..eae69373a9c6cd0420937ebda903a91b73b8eafc 100644 (file)
@@ -34,7 +34,11 @@ void
 handle_bad_irq(unsigned int irq, struct irq_desc *desc)
 {
        print_irq_desc(irq, desc);
+#ifdef CONFIG_HAVE_DYN_ARRAY
        kstat_irqs_this_cpu(desc)++;
+#else
+       kstat_irqs_this_cpu(irq)++;
+#endif
        ack_bad_irq(irq);
 }
 
@@ -401,7 +405,11 @@ unsigned int __do_IRQ(unsigned int irq)
        struct irqaction *action;
        unsigned int status;
 
+#ifdef CONFIG_HAVE_DYN_ARRAY
        kstat_irqs_this_cpu(desc)++;
+#else
+       kstat_irqs_this_cpu(irq)++;
+#endif
        if (CHECK_IRQ_PER_CPU(desc->status)) {
                irqreturn_t action_ret;
 
@@ -501,10 +509,12 @@ void early_init_irq_lock_class(void)
 }
 #endif
 
+#ifdef CONFIG_HAVE_DYN_ARRAY
 unsigned int kstat_irqs_cpu(unsigned int irq, int cpu)
 {
        struct irq_desc *desc = irq_to_desc(irq);
        return desc->kstat_irqs[cpu];
 }
+#endif
 EXPORT_SYMBOL(kstat_irqs_cpu);