[PATCH] genirq: cleanup: merge irq_affinity[] into irq_desc[]
authorIngo Molnar <mingo@elte.hu>
Thu, 29 Jun 2006 09:24:38 +0000 (02:24 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Thu, 29 Jun 2006 17:26:22 +0000 (10:26 -0700)
Consolidation: remove the irq_affinity[NR_IRQS] array and move it into the
irq_desc[NR_IRQS].affinity field.

[akpm@osdl.org: sparc64 build fix]
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
14 files changed:
arch/alpha/kernel/irq.c
arch/i386/kernel/irq.c
arch/ia64/kernel/irq.c
arch/parisc/kernel/irq.c
arch/powerpc/kernel/irq.c
arch/powerpc/platforms/pseries/xics.c
arch/powerpc/sysdev/mpic.c
arch/ppc/syslib/open_pic.c
arch/sparc64/kernel/irq.c
arch/x86_64/kernel/irq.c
include/linux/irq.h
kernel/irq/handle.c
kernel/irq/manage.c
kernel/irq/proc.c

index ec9d243d42c9b37a3c9574f6aa2b9d036c1d4dfd..63af36cf7f6e356fc917b1ac86f6e879be5bc0fd 100644 (file)
@@ -56,7 +56,7 @@ select_smp_affinity(unsigned int irq)
                cpu = (cpu < (NR_CPUS-1) ? cpu + 1 : 0);
        last_cpu = cpu;
 
-       irq_affinity[irq] = cpumask_of_cpu(cpu);
+       irq_desc[irq].affinity = cpumask_of_cpu(cpu);
        irq_desc[irq].chip->set_affinity(irq, cpumask_of_cpu(cpu));
        return 0;
 }
index b942a5918dabce88892fee0178b9739212d9fca2..3336cef9605a71c2771f4ebb34cb2eb911de177d 100644 (file)
@@ -291,7 +291,7 @@ void fixup_irqs(cpumask_t map)
                if (irq == 2)
                        continue;
 
-               cpus_and(mask, irq_affinity[irq], map);
+               cpus_and(mask, irq_desc[irq].affinity, map);
                if (any_online_cpu(mask) == NR_CPUS) {
                        printk("Breaking affinity for irq %i\n", irq);
                        mask = map;
index 2645153dba8aae768e260e208ad1bb1fad52bf3a..c4e1b3b60b48b95adf010ff67f804e7746bc23c4 100644 (file)
@@ -100,7 +100,7 @@ void set_irq_affinity_info (unsigned int irq, int hwid, int redir)
        cpu_set(cpu_logical_id(hwid), mask);
 
        if (irq < NR_IRQS) {
-               irq_affinity[irq] = mask;
+               irq_desc[irq].affinity = mask;
                irq_redir[irq] = (char) (redir & 0xff);
        }
 }
@@ -131,7 +131,7 @@ static void migrate_irqs(void)
                if (desc->status == IRQ_PER_CPU)
                        continue;
 
-               cpus_and(mask, irq_affinity[irq], cpu_online_map);
+               cpus_and(mask, irq_desc[irq].affinity, cpu_online_map);
                if (any_online_cpu(mask) == NR_CPUS) {
                        /*
                         * Save it for phase 2 processing
index 26e69f73fdb026d09b30507c46f170ef5153ff91..ea6a55e1a0c5bb831dc7211632e19ca9aae5dffc 100644 (file)
@@ -94,7 +94,7 @@ int cpu_check_affinity(unsigned int irq, cpumask_t *dest)
        if (irq == TIMER_IRQ || irq == IPI_IRQ) {
                /* Bad linux design decision.  The mask has already
                 * been set; we must reset it */
-               irq_affinity[irq] = CPU_MASK_ALL;
+               irq_desc[irq].affinity = CPU_MASK_ALL;
                return -EINVAL;
        }
 
@@ -110,7 +110,7 @@ static void cpu_set_affinity_irq(unsigned int irq, cpumask_t dest)
        if (cpu_check_affinity(irq, &dest))
                return;
 
-       irq_affinity[irq] = dest;
+       irq_desc[irq].affinity = dest;
 }
 #endif
 
@@ -265,7 +265,7 @@ int txn_alloc_irq(unsigned int bits_wide)
 unsigned long txn_affinity_addr(unsigned int irq, int cpu)
 {
 #ifdef CONFIG_SMP
-       irq_affinity[irq] = cpumask_of_cpu(cpu);
+       irq_desc[irq].affinity = cpumask_of_cpu(cpu);
 #endif
 
        return cpu_data[cpu].txn_addr;
@@ -326,7 +326,7 @@ void do_cpu_irq_mask(struct pt_regs *regs)
                /* Work our way from MSb to LSb...same order we alloc EIRs */
                for (irq = TIMER_IRQ; eirr_val && bit; bit>>=1, irq++) {
 #ifdef CONFIG_SMP
-                       cpumask_t dest = irq_affinity[irq];
+                       cpumask_t dest = irq_desc[irq].affinity;
 #endif
                        if (!(bit & eirr_val))
                                continue;
index 8cfc779d882db48f716872bd48a543057708d93c..24f6050aa4abb2d13a873659e737ae13442409bc 100644 (file)
@@ -164,7 +164,7 @@ void fixup_irqs(cpumask_t map)
                if (irq_desc[irq].status & IRQ_PER_CPU)
                        continue;
 
-               cpus_and(mask, irq_affinity[irq], map);
+               cpus_and(mask, irq_desc[irq].affinity, map);
                if (any_online_cpu(mask) == NR_CPUS) {
                        printk("Breaking affinity for irq %i\n", irq);
                        mask = map;
index bdc9e26a93cfe6e924337798115f5cfa7ebc5988..19c03dd43000fdd46c31413da79e7a11d7e5397c 100644 (file)
@@ -238,7 +238,7 @@ static int get_irq_server(unsigned int irq)
 {
        unsigned int server;
        /* For the moment only implement delivery to all cpus or one cpu */
-       cpumask_t cpumask = irq_affinity[irq];
+       cpumask_t cpumask = irq_desc[irq].affinity;
        cpumask_t tmp = CPU_MASK_NONE;
 
        if (!distribute_irqs)
@@ -729,7 +729,7 @@ void xics_migrate_irqs_away(void)
 
                /* Reset affinity to all cpus */
                desc->chip->set_affinity(virq, CPU_MASK_ALL);
-               irq_affinity[virq] = CPU_MASK_ALL;
+               irq_desc[irq].affinity = CPU_MASK_ALL;
 unlock:
                spin_unlock_irqrestore(&desc->lock, flags);
        }
index f4613ee6b7a295dd18ab5ead37ede2c5ee15c9e4..28df9c827ca66b409d0b0427f09c22944dad2079 100644 (file)
@@ -906,7 +906,7 @@ void mpic_setup_this_cpu(void)
        /* let the mpic know we want intrs. default affinity is 0xffffffff
         * until changed via /proc. That's how it's done on x86. If we want
         * it differently, then we should make sure we also change the default
-        * values of irq_affinity in irq.c.
+        * values of irq_desc[].affinity in irq.c.
         */
        if (distribute_irqs) {
                for (i = 0; i < mpic->num_sources ; i++)
index 822058c2983ef7e164b7a3c34dd70a10522baf93..767a0bc9581765fb21c70920a0fc93e7b3697735 100644 (file)
@@ -615,8 +615,8 @@ void __devinit do_openpic_setup_cpu(void)
        /* let the openpic know we want intrs. default affinity
         * is 0xffffffff until changed via /proc
         * That's how it's done on x86. If we want it differently, then
-        * we should make sure we also change the default values of irq_affinity
-        * in irq.c.
+        * we should make sure we also change the default values of
+        * irq_desc[].affinity in irq.c.
         */
        for (i = 0; i < NumSources; i++)
                openpic_mapirq(i, msk, CPU_MASK_ALL);
index 5d7c821ab7f64eb65d5b94f5a257c3b5fcdbd32f..ab9e640df22820a5ffd9084b73258ea09042c41e 100644 (file)
@@ -224,7 +224,7 @@ static inline struct ino_bucket *virt_irq_to_bucket(unsigned int virt_irq)
 #ifdef CONFIG_SMP
 static int irq_choose_cpu(unsigned int virt_irq)
 {
-       cpumask_t mask = irq_affinity[virt_irq];
+       cpumask_t mask = irq_desc[virt_irq].affinity;
        int cpuid;
 
        if (cpus_equal(mask, CPU_MASK_ALL)) {
index 0c2fb2c77bd0c40bc95b9c6ea61737df9f8ce31d..a1f1df5f7bfc2d5a40d6269e5a37f69d6dc746af 100644 (file)
@@ -146,7 +146,7 @@ void fixup_irqs(cpumask_t map)
                if (irq == 2)
                        continue;
 
-               cpus_and(mask, irq_affinity[irq], map);
+               cpus_and(mask, irq_desc[irq].affinity, map);
                if (any_online_cpu(mask) == NR_CPUS) {
                        printk("Breaking affinity for irq %i\n", irq);
                        mask = map;
index 9597a69042395ac6f5dafd2f1b50bf79a7500fae..6e3ad6245bd3e79154dec1ea21bbcca2e28e78af 100644 (file)
@@ -77,6 +77,9 @@ typedef struct irq_desc {
        unsigned int irq_count;         /* For detecting broken interrupts */
        unsigned int irqs_unhandled;
        spinlock_t lock;
+#ifdef CONFIG_SMP
+       cpumask_t affinity;
+#endif
 #if defined (CONFIG_GENERIC_PENDING_IRQ) || defined (CONFIG_IRQBALANCE)
        unsigned int move_irq;          /* Flag need to re-target intr dest*/
 #endif
@@ -96,12 +99,10 @@ irq_descp (int irq)
 extern int setup_irq(unsigned int irq, struct irqaction * new);
 
 #ifdef CONFIG_GENERIC_HARDIRQS
-extern cpumask_t irq_affinity[NR_IRQS];
-
 #ifdef CONFIG_SMP
 static inline void set_native_irq_info(int irq, cpumask_t mask)
 {
-       irq_affinity[irq] = mask;
+       irq_desc[irq].affinity = mask;
 }
 #else
 static inline void set_native_irq_info(int irq, cpumask_t mask)
index f9d95705a4ac5bfee0f313e6e028006892bf7c48..cc786aaf30d61aa48042328afe08a093959e9006 100644 (file)
@@ -32,7 +32,10 @@ irq_desc_t irq_desc[NR_IRQS] __cacheline_aligned = {
        [0 ... NR_IRQS-1] = {
                .status = IRQ_DISABLED,
                .chip = &no_irq_type,
-               .lock = SPIN_LOCK_UNLOCKED
+               .lock = SPIN_LOCK_UNLOCKED,
+#ifdef CONFIG_SMP
+               .affinity = CPU_MASK_ALL
+#endif
        }
 };
 
index 31ee1f3bfcf92bae6ddab6b240d9623e81b59b28..c53662edc73d9275085077787cb3a7319bb1119b 100644 (file)
@@ -16,8 +16,6 @@
 
 #ifdef CONFIG_SMP
 
-cpumask_t irq_affinity[NR_IRQS] = { [0 ... NR_IRQS-1] = CPU_MASK_ALL };
-
 #if defined (CONFIG_GENERIC_PENDING_IRQ) || defined (CONFIG_IRQBALANCE)
 cpumask_t __cacheline_aligned pending_irq_cpumask[NR_IRQS];
 #endif
index 90fe05f23e692ba3e5fdd4b50e18c47fd1a139c8..847b98a611e0335183031c7a3f1fc8e9a3f71842 100644 (file)
@@ -36,7 +36,7 @@ void proc_set_irq_affinity(unsigned int irq, cpumask_t mask_val)
 void proc_set_irq_affinity(unsigned int irq, cpumask_t mask_val)
 {
        set_balance_irq_affinity(irq, mask_val);
-       irq_affinity[irq] = mask_val;
+       irq_desc[irq].affinity = mask_val;
        irq_desc[irq].chip->set_affinity(irq, mask_val);
 }
 #endif
@@ -44,7 +44,7 @@ void proc_set_irq_affinity(unsigned int irq, cpumask_t mask_val)
 static int irq_affinity_read_proc(char *page, char **start, off_t off,
                                  int count, int *eof, void *data)
 {
-       int len = cpumask_scnprintf(page, count, irq_affinity[(long)data]);
+       int len = cpumask_scnprintf(page, count, irq_desc[(long)data].affinity);
 
        if (count - len < 2)
                return -EINVAL;