Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

alpha: irq clean up

Stop touching irq_desc[irq] directly, instead use accessor
functions provided. Use irq_has_action instead of directly
testing the irq_desc.

Tested-by: Michael Cree <mcree@orcon.net.nz>
Signed-off-by: Kyle McMartin <kyle@redhat.com>
Signed-off-by: Matt Turner <mattst88@gmail.com>

authored by

Kyle McMartin and committed by
Matt Turner
a891b393 d5ccde0a

+67 -58
+18 -9
arch/alpha/kernel/irq.c
··· 44 44 45 45 int irq_select_affinity(unsigned int irq) 46 46 { 47 + struct irq_desc *desc = irq_to_desc[irq]; 47 48 static int last_cpu; 48 49 int cpu = last_cpu + 1; 49 50 50 - if (!irq_desc[irq].chip->set_affinity || irq_user_affinity[irq]) 51 + if (!desc || !get_irq_desc_chip(desc)->set_affinity || irq_user_affinity[irq]) 51 52 return 1; 52 53 53 54 while (!cpu_possible(cpu) || ··· 56 55 cpu = (cpu < (NR_CPUS-1) ? cpu + 1 : 0); 57 56 last_cpu = cpu; 58 57 59 - cpumask_copy(irq_desc[irq].affinity, cpumask_of(cpu)); 60 - irq_desc[irq].chip->set_affinity(irq, cpumask_of(cpu)); 58 + cpumask_copy(desc->affinity, cpumask_of(cpu)); 59 + get_irq_desc_chip(desc)->set_affinity(irq, cpumask_of(cpu)); 61 60 return 0; 62 61 } 63 62 #endif /* CONFIG_SMP */ ··· 68 67 int j; 69 68 int irq = *(loff_t *) v; 70 69 struct irqaction * action; 70 + struct irq_desc *desc; 71 71 unsigned long flags; 72 72 73 73 #ifdef CONFIG_SMP ··· 81 79 #endif 82 80 83 81 if (irq < ACTUAL_NR_IRQS) { 84 - raw_spin_lock_irqsave(&irq_desc[irq].lock, flags); 85 - action = irq_desc[irq].action; 82 + desc = irq_to_desc(irq); 83 + 84 + if (!desc) 85 + return 0; 86 + 87 + raw_spin_lock_irqsave(&desc->lock, flags); 88 + action = desc->action; 86 89 if (!action) 87 90 goto unlock; 88 91 seq_printf(p, "%3d: ", irq); ··· 97 90 for_each_online_cpu(j) 98 91 seq_printf(p, "%10u ", kstat_irqs_cpu(irq, j)); 99 92 #endif 100 - seq_printf(p, " %14s", irq_desc[irq].chip->name); 93 + seq_printf(p, " %14s", get_irq_desc_chip(desc)->name); 101 94 seq_printf(p, " %c%s", 102 95 (action->flags & IRQF_DISABLED)?'+':' ', 103 96 action->name); ··· 110 103 111 104 seq_putc(p, '\n'); 112 105 unlock: 113 - raw_spin_unlock_irqrestore(&irq_desc[irq].lock, flags); 106 + raw_spin_unlock_irqrestore(&desc->lock, flags); 114 107 } else if (irq == ACTUAL_NR_IRQS) { 115 108 #ifdef CONFIG_SMP 116 109 seq_puts(p, "IPI: "); ··· 149 142 * handled by some other CPU. (or is disabled) 150 143 */ 151 144 static unsigned int illegal_count=0; 145 + struct irq_desc *desc = irq_to_desc(irq); 152 146 153 - if ((unsigned) irq > ACTUAL_NR_IRQS && illegal_count < MAX_ILLEGAL_IRQS ) { 147 + if (!desc || ((unsigned) irq > ACTUAL_NR_IRQS && 148 + illegal_count < MAX_ILLEGAL_IRQS)) { 154 149 irq_err_count++; 155 150 illegal_count++; 156 151 printk(KERN_CRIT "device_interrupt: invalid interrupt %d\n", ··· 168 159 * at IPL 0. 169 160 */ 170 161 local_irq_disable(); 171 - generic_handle_irq(irq); 162 + generic_handle_irq_desc(irq, desc); 172 163 irq_exit(); 173 164 } 174 165
+7 -3
arch/alpha/kernel/irq_alpha.c
··· 241 241 void __init 242 242 init_rtc_irq(void) 243 243 { 244 - irq_desc[RTC_IRQ].status = IRQ_DISABLED; 245 - irq_desc[RTC_IRQ].chip = &rtc_irq_type; 246 - setup_irq(RTC_IRQ, &timer_irqaction); 244 + struct irq_desc *desc = irq_to_desc(RTC_IRQ); 245 + 246 + if (desc) { 247 + desc->status |= IRQ_DISABLED; 248 + set_irq_chip(RTC_IRQ, &rtc_irq_type); 249 + setup_irq(RTC_IRQ, &timer_irqaction); 250 + } 247 251 } 248 252 249 253 /* Dummy irqactions. */
+2 -1
arch/alpha/kernel/irq_i8259.c
··· 79 79 void 80 80 i8259a_end_irq(unsigned int irq) 81 81 { 82 - if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) 82 + struct irq_desc *desc = irq_to_desc(irq); 83 + if (desc || !(desc->status & (IRQ_DISABLED|IRQ_INPROGRESS))) 83 84 i8259a_enable_irq(irq); 84 85 } 85 86
+3 -2
arch/alpha/kernel/irq_pyxis.c
··· 50 50 static void 51 51 pyxis_end_irq(unsigned int irq) 52 52 { 53 - if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) 53 + struct irq_desc *desc = irq_to_desc(irq); 54 + if (desc || !(desc->status & (IRQ_DISABLED|IRQ_INPROGRESS))) 54 55 pyxis_enable_irq(irq); 55 56 } 56 57 ··· 121 120 if ((ignore_mask >> i) & 1) 122 121 continue; 123 122 set_irq_chip_and_handler(i, &pyxis_irq_type, alpha_do_IRQ); 124 - irq_desc[i].status |= IRQ_LEVEL; 123 + irq_to_desc(i)->status |= IRQ_LEVEL; 125 124 } 126 125 127 126 setup_irq(16+7, &isa_cascade_irqaction);
+2 -2
arch/alpha/kernel/irq_srm.c
··· 43 43 static void 44 44 srm_end_irq(unsigned int irq) 45 45 { 46 - if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) 46 + if (!(irq_to_desc(irq)->status & (IRQ_DISABLED|IRQ_INPROGRESS))) 47 47 srm_enable_irq(irq); 48 48 } 49 49 ··· 68 68 for (i = 16; i < max; ++i) { 69 69 if (i < 64 && ((ignore_mask >> i) & 1)) 70 70 continue; 71 - irq_desc[i].status |= IRQ_LEVEL; 72 71 set_irq_chip_and_handler(i, &srm_irq_type, alpha_do_IRQ); 72 + irq_to_desc(i)->status |= IRQ_LEVEL; 73 73 } 74 74 } 75 75
+2 -2
arch/alpha/kernel/sys_alcor.c
··· 85 85 static void 86 86 alcor_end_irq(unsigned int irq) 87 87 { 88 - if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) 88 + if (!(irq_to_desc(irq)->status & (IRQ_DISABLED|IRQ_INPROGRESS))) 89 89 alcor_enable_irq(irq); 90 90 } 91 91 ··· 142 142 on while IRQ probing. */ 143 143 if (i >= 16+20 && i <= 16+30) 144 144 continue; 145 - irq_desc[i].status |= IRQ_LEVEL; 146 145 set_irq_chip_and_handler(i, &alcor_irq_type, alpha_do_IRQ); 146 + irq_to_desc(i)->status |= IRQ_LEVEL; 147 147 } 148 148 i8259a_irq_type.ack = alcor_isa_mask_and_ack_irq; 149 149
+2 -2
arch/alpha/kernel/sys_cabriolet.c
··· 67 67 static void 68 68 cabriolet_end_irq(unsigned int irq) 69 69 { 70 - if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) 70 + if (!(irq_to_desc(irq)->status & (IRQ_DISABLED|IRQ_INPROGRESS))) 71 71 cabriolet_enable_irq(irq); 72 72 } 73 73 ··· 124 124 for (i = 16; i < 35; ++i) { 125 125 set_irq_chip_and_handler(i, &cabriolet_irq_type, 126 126 alpha_do_IRQ); 127 - irq_desc[i].status |= IRQ_LEVEL; 127 + irq_to_desc(i)->status |= IRQ_LEVEL; 128 128 } 129 129 } 130 130
+3 -3
arch/alpha/kernel/sys_dp264.c
··· 125 125 static void 126 126 dp264_end_irq(unsigned int irq) 127 127 { 128 - if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) 128 + if (!(irq_to_desc(irq)->status & (IRQ_DISABLED|IRQ_INPROGRESS))) 129 129 dp264_enable_irq(irq); 130 130 } 131 131 ··· 157 157 static void 158 158 clipper_end_irq(unsigned int irq) 159 159 { 160 - if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) 160 + if (!(irq_to_desc(irq)->status & (IRQ_DISABLED|IRQ_INPROGRESS))) 161 161 clipper_enable_irq(irq); 162 162 } 163 163 ··· 302 302 { 303 303 long i; 304 304 for (i = imin; i <= imax; ++i) { 305 - irq_desc[i].status |= IRQ_LEVEL; 305 + irq_to_desc(i)->status |= IRQ_LEVEL; 306 306 set_irq_chip_and_handler(i, ops, alpha_do_IRQ); 307 307 } 308 308 }
+2 -2
arch/alpha/kernel/sys_eb64p.c
··· 65 65 static void 66 66 eb64p_end_irq(unsigned int irq) 67 67 { 68 - if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) 68 + if (!(irq_to_desc(irq)->status & (IRQ_DISABLED|IRQ_INPROGRESS))) 69 69 eb64p_enable_irq(irq); 70 70 } 71 71 ··· 135 135 init_i8259a_irqs(); 136 136 137 137 for (i = 16; i < 32; ++i) { 138 - irq_desc[i].status |= IRQ_LEVEL; 138 + irq_to_desc(i)->status |= IRQ_LEVEL; 139 139 set_irq_chip_and_handler(i, &eb64p_irq_type, alpha_do_IRQ); 140 140 } 141 141
+2 -2
arch/alpha/kernel/sys_eiger.c
··· 76 76 static void 77 77 eiger_end_irq(unsigned int irq) 78 78 { 79 - if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) 79 + if (!(irq_to_desc(irq)->status & (IRQ_DISABLED|IRQ_INPROGRESS))) 80 80 eiger_enable_irq(irq); 81 81 } 82 82 ··· 153 153 init_i8259a_irqs(); 154 154 155 155 for (i = 16; i < 128; ++i) { 156 - irq_desc[i].status |= IRQ_LEVEL; 156 + irq_to_desc(i)->status |= IRQ_LEVEL; 157 157 set_irq_chip_and_handler(i, &eiger_irq_type, alpha_do_IRQ); 158 158 } 159 159 }
+2 -8
arch/alpha/kernel/sys_jensen.c
··· 68 68 /* the parport is really hw IRQ 1, silly Jensen. */ 69 69 if (irq == 7) 70 70 i8259a_startup_irq(1); 71 - else 72 - /* 73 - * For all true local interrupts, set the flag that prevents 74 - * the IPL from being dropped during handler processing. 75 - */ 76 - if (irq_desc[irq].action) 77 - irq_desc[irq].action->flags |= IRQF_DISABLED; 71 + 78 72 return 0; 79 73 } 80 74 ··· 152 158 } 153 159 154 160 /* If there is no handler yet... */ 155 - if (irq_desc[irq].action == NULL) { 161 + if (!irq_has_action(irq)) { 156 162 /* If it is a local interrupt that cannot be masked... */ 157 163 if (vector >= 0x900) 158 164 {
+3 -3
arch/alpha/kernel/sys_marvel.c
··· 153 153 static void 154 154 io7_end_irq(unsigned int irq) 155 155 { 156 - if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) 156 + if (!(irq_to_desc(irq)->status & (IRQ_DISABLED|IRQ_INPROGRESS))) 157 157 io7_enable_irq(irq); 158 158 } 159 159 ··· 304 304 305 305 /* Set up the lsi irqs. */ 306 306 for (i = 0; i < 128; ++i) { 307 - irq_desc[base + i].status |= IRQ_LEVEL; 307 + irq_to_desc(base + i)->status |= IRQ_LEVEL; 308 308 set_irq_chip_and_handler(base + i, lsi_ops, alpha_do_IRQ); 309 309 } 310 310 ··· 318 318 319 319 /* Set up the msi irqs. */ 320 320 for (i = 128; i < (128 + 512); ++i) { 321 - irq_desc[base + i].status |= IRQ_LEVEL; 321 + irq_to_desc(base + i)->status |= IRQ_LEVEL; 322 322 set_irq_chip_and_handler(base + i, msi_ops, alpha_do_IRQ); 323 323 } 324 324
+2 -2
arch/alpha/kernel/sys_mikasa.c
··· 64 64 static void 65 65 mikasa_end_irq(unsigned int irq) 66 66 { 67 - if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) 67 + if (!(irq_to_desc(irq)->status & (IRQ_DISABLED|IRQ_INPROGRESS))) 68 68 mikasa_enable_irq(irq); 69 69 } 70 70 ··· 115 115 mikasa_update_irq_hw(0); 116 116 117 117 for (i = 16; i < 32; ++i) { 118 - irq_desc[i].status |= IRQ_LEVEL; 118 + irq_to_desc(i)->status |= IRQ_LEVEL; 119 119 set_irq_chip_and_handler(i, &mikasa_irq_type, alpha_do_IRQ); 120 120 } 121 121
+2 -2
arch/alpha/kernel/sys_noritake.c
··· 69 69 static void 70 70 noritake_end_irq(unsigned int irq) 71 71 { 72 - if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) 72 + if (!(irq_to_desc(irq)->status & (IRQ_DISABLED|IRQ_INPROGRESS))) 73 73 noritake_enable_irq(irq); 74 74 } 75 75 ··· 144 144 outw(0, 0x54c); 145 145 146 146 for (i = 16; i < 48; ++i) { 147 - irq_desc[i].status |= IRQ_LEVEL; 147 + irq_to_desc(i)->status |= IRQ_LEVEL; 148 148 set_irq_chip_and_handler(i, &noritake_irq_type, alpha_do_IRQ); 149 149 } 150 150
+2 -2
arch/alpha/kernel/sys_rawhide.c
··· 131 131 static void 132 132 rawhide_end_irq(unsigned int irq) 133 133 { 134 - if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) 134 + if (!(irq_to_desc(irq)->status & (IRQ_DISABLED|IRQ_INPROGRESS))) 135 135 rawhide_enable_irq(irq); 136 136 } 137 137 ··· 194 194 } 195 195 196 196 for (i = 16; i < 128; ++i) { 197 - irq_desc[i].status |= IRQ_LEVEL; 197 + irq_to_desc(i)->status |= IRQ_LEVEL; 198 198 set_irq_chip_and_handler(i, &rawhide_irq_type, alpha_do_IRQ); 199 199 } 200 200
+2 -2
arch/alpha/kernel/sys_rx164.c
··· 68 68 static void 69 69 rx164_end_irq(unsigned int irq) 70 70 { 71 - if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) 71 + if (!(irq_to_desc(irq)->status & (IRQ_DISABLED|IRQ_INPROGRESS))) 72 72 rx164_enable_irq(irq); 73 73 } 74 74 ··· 116 116 117 117 rx164_update_irq_hw(0); 118 118 for (i = 16; i < 40; ++i) { 119 - irq_desc[i].status |= IRQ_LEVEL; 119 + irq_to_desc(i)->status |= IRQ_LEVEL; 120 120 set_irq_chip_and_handler(i, &rx164_irq_type, alpha_do_IRQ); 121 121 } 122 122
+2 -2
arch/alpha/kernel/sys_sable.c
··· 484 484 static void 485 485 sable_lynx_end_irq(unsigned int irq) 486 486 { 487 - if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) 487 + if (!(irq_to_desc(irq)->status & (IRQ_DISABLED|IRQ_INPROGRESS))) 488 488 sable_lynx_enable_irq(irq); 489 489 } 490 490 ··· 535 535 long i; 536 536 537 537 for (i = 0; i < nr_of_irqs; ++i) { 538 - irq_desc[i].status |= IRQ_LEVEL; 538 + irq_to_desc(i)->status |= IRQ_LEVEL; 539 539 set_irq_chip_and_handler(i, &sable_lynx_irq_type, 540 540 alpha_do_IRQ); 541 541 }
+2 -2
arch/alpha/kernel/sys_takara.c
··· 70 70 static void 71 71 takara_end_irq(unsigned int irq) 72 72 { 73 - if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) 73 + if (!(irq_to_desc(irq)->status & (IRQ_DISABLED|IRQ_INPROGRESS))) 74 74 takara_enable_irq(irq); 75 75 } 76 76 ··· 153 153 takara_update_irq_hw(i, -1); 154 154 155 155 for (i = 16; i < 128; ++i) { 156 - irq_desc[i].status |= IRQ_LEVEL; 156 + irq_to_desc(i)->status |= IRQ_LEVEL; 157 157 set_irq_chip_and_handler(i, &takara_irq_type, alpha_do_IRQ); 158 158 } 159 159
+2 -2
arch/alpha/kernel/sys_titan.c
··· 139 139 static void 140 140 titan_end_irq(unsigned int irq) 141 141 { 142 - if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) 142 + if (!(irq_to_desc(irq)->status & (IRQ_DISABLED|IRQ_INPROGRESS))) 143 143 titan_enable_irq(irq); 144 144 } 145 145 ··· 189 189 { 190 190 long i; 191 191 for (i = imin; i <= imax; ++i) { 192 - irq_desc[i].status |= IRQ_LEVEL; 192 + irq_to_desc(i)->status |= IRQ_LEVEL; 193 193 set_irq_chip_and_handler(i, ops, alpha_do_IRQ); 194 194 } 195 195 }
+5 -5
arch/alpha/kernel/sys_wildfire.c
··· 150 150 wildfire_end_irq(unsigned int irq) 151 151 { 152 152 #if 0 153 - if (!irq_desc[irq].action) 153 + if (!irq_has_action(irq)) 154 154 printk("got irq %d\n", irq); 155 155 #endif 156 - if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) 156 + if (!(irq_to_desc(irq)->status & (IRQ_DISABLED|IRQ_INPROGRESS))) 157 157 wildfire_enable_irq(irq); 158 158 } 159 159 ··· 198 198 for (i = 0; i < 16; ++i) { 199 199 if (i == 2) 200 200 continue; 201 - irq_desc[i+irq_bias].status |= IRQ_LEVEL; 201 + irq_to_desc(i+irq_bias)->status |= IRQ_LEVEL; 202 202 set_irq_chip_and_handler(i+irq_bias, &wildfire_irq_type, 203 203 alpha_do_IRQ); 204 204 } 205 205 206 - irq_desc[36+irq_bias].status |= IRQ_LEVEL; 206 + irq_to_desc(36+irq_bias)->status |= IRQ_LEVEL; 207 207 set_irq_chip_and_handler(36+irq_bias, &wildfire_irq_type, alpha_do_IRQ); 208 208 for (i = 40; i < 64; ++i) { 209 - irq_desc[i+irq_bias].status |= IRQ_LEVEL; 209 + irq_to_desc(i+irq_bias)->status |= IRQ_LEVEL; 210 210 set_irq_chip_and_handler(i+irq_bias, &wildfire_irq_type, 211 211 alpha_do_IRQ); 212 212 }