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

x86: i8259: Convert to new irq_chip functions

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Ingo Molnar <mingo@elte.hu>

+47 -44
+2
arch/x86/include/asm/i8259.h
··· 55 55 struct legacy_pic { 56 56 int nr_legacy_irqs; 57 57 struct irq_chip *chip; 58 + void (*mask)(unsigned int irq); 59 + void (*unmask)(unsigned int irq); 58 60 void (*mask_all)(void); 59 61 void (*restore_mask)(void); 60 62 void (*init)(int auto_eoi);
+10 -10
arch/x86/kernel/apic/io_apic.c
··· 1459 1459 1460 1460 ioapic_register_intr(irq, desc, trigger); 1461 1461 if (irq < legacy_pic->nr_legacy_irqs) 1462 - legacy_pic->chip->mask(irq); 1462 + legacy_pic->mask(irq); 1463 1463 1464 1464 ioapic_write_entry(apic_id, pin, entry); 1465 1465 } ··· 2233 2233 2234 2234 raw_spin_lock_irqsave(&ioapic_lock, flags); 2235 2235 if (irq < legacy_pic->nr_legacy_irqs) { 2236 - legacy_pic->chip->mask(irq); 2236 + legacy_pic->mask(irq); 2237 2237 if (legacy_pic->irq_pending(irq)) 2238 2238 was_pending = 1; 2239 2239 } ··· 2928 2928 /* 2929 2929 * get/set the timer IRQ vector: 2930 2930 */ 2931 - legacy_pic->chip->mask(0); 2931 + legacy_pic->mask(0); 2932 2932 assign_irq_vector(0, cfg, apic->target_cpus()); 2933 2933 2934 2934 /* ··· 3000 3000 if (timer_irq_works()) { 3001 3001 if (nmi_watchdog == NMI_IO_APIC) { 3002 3002 setup_nmi(); 3003 - legacy_pic->chip->unmask(0); 3003 + legacy_pic->unmask(0); 3004 3004 } 3005 3005 if (disable_timer_pin_1 > 0) 3006 3006 clear_IO_APIC_pin(0, pin1); ··· 3023 3023 */ 3024 3024 replace_pin_at_irq_node(cfg, node, apic1, pin1, apic2, pin2); 3025 3025 setup_timer_IRQ0_pin(apic2, pin2, cfg->vector); 3026 - legacy_pic->chip->unmask(0); 3026 + legacy_pic->unmask(0); 3027 3027 if (timer_irq_works()) { 3028 3028 apic_printk(APIC_QUIET, KERN_INFO "....... works.\n"); 3029 3029 timer_through_8259 = 1; 3030 3030 if (nmi_watchdog == NMI_IO_APIC) { 3031 - legacy_pic->chip->mask(0); 3031 + legacy_pic->mask(0); 3032 3032 setup_nmi(); 3033 - legacy_pic->chip->unmask(0); 3033 + legacy_pic->unmask(0); 3034 3034 } 3035 3035 goto out; 3036 3036 } ··· 3038 3038 * Cleanup, just in case ... 3039 3039 */ 3040 3040 local_irq_disable(); 3041 - legacy_pic->chip->mask(0); 3041 + legacy_pic->mask(0); 3042 3042 clear_IO_APIC_pin(apic2, pin2); 3043 3043 apic_printk(APIC_QUIET, KERN_INFO "....... failed.\n"); 3044 3044 } ··· 3057 3057 3058 3058 lapic_register_intr(0, desc); 3059 3059 apic_write(APIC_LVT0, APIC_DM_FIXED | cfg->vector); /* Fixed mode */ 3060 - legacy_pic->chip->unmask(0); 3060 + legacy_pic->unmask(0); 3061 3061 3062 3062 if (timer_irq_works()) { 3063 3063 apic_printk(APIC_QUIET, KERN_INFO "..... works.\n"); 3064 3064 goto out; 3065 3065 } 3066 3066 local_irq_disable(); 3067 - legacy_pic->chip->mask(0); 3067 + legacy_pic->mask(0); 3068 3068 apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | cfg->vector); 3069 3069 apic_printk(APIC_QUIET, KERN_INFO "..... failed.\n"); 3070 3070
+1 -1
arch/x86/kernel/apic/nmi.c
··· 178 178 error: 179 179 if (nmi_watchdog == NMI_IO_APIC) { 180 180 if (!timer_through_8259) 181 - legacy_pic->chip->mask(0); 181 + legacy_pic->mask(0); 182 182 on_each_cpu(__acpi_nmi_disable, NULL, 1); 183 183 } 184 184
+32 -31
arch/x86/kernel/i8259.c
··· 29 29 * plus some generic x86 specific things if generic specifics makes 30 30 * any sense at all. 31 31 */ 32 + static void init_8259A(int auto_eoi); 32 33 33 34 static int i8259A_auto_eoi; 34 35 DEFINE_RAW_SPINLOCK(i8259A_lock); 35 - static void mask_and_ack_8259A(unsigned int); 36 - static void mask_8259A(void); 37 - static void unmask_8259A(void); 38 - static void disable_8259A_irq(unsigned int irq); 39 - static void enable_8259A_irq(unsigned int irq); 40 - static void init_8259A(int auto_eoi); 41 - static int i8259A_irq_pending(unsigned int irq); 42 - 43 - struct irq_chip i8259A_chip = { 44 - .name = "XT-PIC", 45 - .mask = disable_8259A_irq, 46 - .disable = disable_8259A_irq, 47 - .unmask = enable_8259A_irq, 48 - .mask_ack = mask_and_ack_8259A, 49 - }; 50 36 51 37 /* 52 38 * 8259A PIC functions to handle ISA devices: ··· 54 68 */ 55 69 unsigned long io_apic_irqs; 56 70 57 - static void disable_8259A_irq(unsigned int irq) 71 + static void mask_8259A_irq(unsigned int irq) 58 72 { 59 73 unsigned int mask = 1 << irq; 60 74 unsigned long flags; ··· 68 82 raw_spin_unlock_irqrestore(&i8259A_lock, flags); 69 83 } 70 84 71 - static void enable_8259A_irq(unsigned int irq) 85 + static void disable_8259A_irq(struct irq_data *data) 86 + { 87 + mask_8259A_irq(data->irq); 88 + } 89 + 90 + static void unmask_8259A_irq(unsigned int irq) 72 91 { 73 92 unsigned int mask = ~(1 << irq); 74 93 unsigned long flags; ··· 85 94 else 86 95 outb(cached_master_mask, PIC_MASTER_IMR); 87 96 raw_spin_unlock_irqrestore(&i8259A_lock, flags); 97 + } 98 + 99 + static void enable_8259A_irq(struct irq_data *data) 100 + { 101 + unmask_8259A_irq(data->irq); 88 102 } 89 103 90 104 static int i8259A_irq_pending(unsigned int irq) ··· 113 117 disable_irq_nosync(irq); 114 118 io_apic_irqs &= ~(1<<irq); 115 119 set_irq_chip_and_handler_name(irq, &i8259A_chip, handle_level_irq, 116 - "XT"); 120 + i8259A_chip.name); 117 121 enable_irq(irq); 118 122 } 119 123 ··· 146 150 * first, _then_ send the EOI, and the order of EOI 147 151 * to the two 8259s is important! 148 152 */ 149 - static void mask_and_ack_8259A(unsigned int irq) 153 + static void mask_and_ack_8259A(struct irq_data *data) 150 154 { 155 + unsigned int irq = data->irq; 151 156 unsigned int irqmask = 1 << irq; 152 157 unsigned long flags; 153 158 ··· 219 222 goto handle_real_irq; 220 223 } 221 224 } 225 + 226 + struct irq_chip i8259A_chip = { 227 + .name = "XT-PIC", 228 + .irq_mask = disable_8259A_irq, 229 + .irq_disable = disable_8259A_irq, 230 + .irq_unmask = enable_8259A_irq, 231 + .irq_mask_ack = mask_and_ack_8259A, 232 + }; 222 233 223 234 static char irq_trigger[2]; 224 235 /** ··· 347 342 * In AEOI mode we just have to mask the interrupt 348 343 * when acking. 349 344 */ 350 - i8259A_chip.mask_ack = disable_8259A_irq; 345 + i8259A_chip.irq_mask_ack = disable_8259A_irq; 351 346 else 352 - i8259A_chip.mask_ack = mask_and_ack_8259A; 347 + i8259A_chip.irq_mask_ack = mask_and_ack_8259A; 353 348 354 349 udelay(100); /* wait for 8259A to initialize */ 355 350 ··· 368 363 static void legacy_pic_noop(void) { }; 369 364 static void legacy_pic_uint_noop(unsigned int unused) { }; 370 365 static void legacy_pic_int_noop(int unused) { }; 371 - 372 - static struct irq_chip dummy_pic_chip = { 373 - .name = "dummy pic", 374 - .mask = legacy_pic_uint_noop, 375 - .unmask = legacy_pic_uint_noop, 376 - .disable = legacy_pic_uint_noop, 377 - .mask_ack = legacy_pic_uint_noop, 378 - }; 379 366 static int legacy_pic_irq_pending_noop(unsigned int irq) 380 367 { 381 368 return 0; ··· 375 378 376 379 struct legacy_pic null_legacy_pic = { 377 380 .nr_legacy_irqs = 0, 378 - .chip = &dummy_pic_chip, 381 + .chip = &dummy_irq_chip, 382 + .mask = legacy_pic_uint_noop, 383 + .unmask = legacy_pic_uint_noop, 379 384 .mask_all = legacy_pic_noop, 380 385 .restore_mask = legacy_pic_noop, 381 386 .init = legacy_pic_int_noop, ··· 388 389 struct legacy_pic default_legacy_pic = { 389 390 .nr_legacy_irqs = NR_IRQS_LEGACY, 390 391 .chip = &i8259A_chip, 391 - .mask_all = mask_8259A, 392 + .mask = mask_8259A_irq, 393 + .unmask = unmask_8259A_irq, 394 + .mask_all = mask_8259A, 392 395 .restore_mask = unmask_8259A, 393 396 .init = init_8259A, 394 397 .irq_pending = i8259A_irq_pending,
+2 -2
arch/x86/kernel/smpboot.c
··· 324 324 check_tsc_sync_target(); 325 325 326 326 if (nmi_watchdog == NMI_IO_APIC) { 327 - legacy_pic->chip->mask(0); 327 + legacy_pic->mask(0); 328 328 enable_NMI_through_LVT0(); 329 - legacy_pic->chip->unmask(0); 329 + legacy_pic->unmask(0); 330 330 } 331 331 332 332 /* This must be done before setting cpu_online_mask */