diff options
| -rw-r--r-- | arch/x86/kernel/apic/io_apic.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index 2a145d3a8375..2999f3dd5889 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c | |||
| @@ -490,7 +490,8 @@ static void ioapic_mask_entry(int apic, int pin) | |||
| 490 | * shared ISA-space IRQs, so we have to support them. We are super | 490 | * shared ISA-space IRQs, so we have to support them. We are super |
| 491 | * fast in the common case, and fast for shared ISA-space IRQs. | 491 | * fast in the common case, and fast for shared ISA-space IRQs. |
| 492 | */ | 492 | */ |
| 493 | static void add_pin_to_irq_node(struct irq_cfg *cfg, int node, int apic, int pin) | 493 | static int |
| 494 | add_pin_to_irq_node_nopanic(struct irq_cfg *cfg, int node, int apic, int pin) | ||
| 494 | { | 495 | { |
| 495 | struct irq_pin_list **last, *entry; | 496 | struct irq_pin_list **last, *entry; |
| 496 | 497 | ||
| @@ -498,19 +499,27 @@ static void add_pin_to_irq_node(struct irq_cfg *cfg, int node, int apic, int pin | |||
| 498 | last = &cfg->irq_2_pin; | 499 | last = &cfg->irq_2_pin; |
| 499 | for_each_irq_pin(entry, cfg->irq_2_pin) { | 500 | for_each_irq_pin(entry, cfg->irq_2_pin) { |
| 500 | if (entry->apic == apic && entry->pin == pin) | 501 | if (entry->apic == apic && entry->pin == pin) |
| 501 | return; | 502 | return 0; |
| 502 | last = &entry->next; | 503 | last = &entry->next; |
| 503 | } | 504 | } |
| 504 | 505 | ||
| 505 | entry = get_one_free_irq_2_pin(node); | 506 | entry = get_one_free_irq_2_pin(node); |
| 506 | if (!entry) { | 507 | if (!entry) { |
| 507 | printk(KERN_ERR "can not alloc irq_pin_list\n"); | 508 | printk(KERN_ERR "can not alloc irq_pin_list (%d,%d,%d)\n", |
| 508 | BUG_ON(1); | 509 | node, apic, pin); |
| 510 | return -ENOMEM; | ||
| 509 | } | 511 | } |
| 510 | entry->apic = apic; | 512 | entry->apic = apic; |
| 511 | entry->pin = pin; | 513 | entry->pin = pin; |
| 512 | 514 | ||
| 513 | *last = entry; | 515 | *last = entry; |
| 516 | return 0; | ||
| 517 | } | ||
| 518 | |||
| 519 | static void add_pin_to_irq_node(struct irq_cfg *cfg, int node, int apic, int pin) | ||
| 520 | { | ||
| 521 | if (add_pin_to_irq_node_nopanic(cfg, node, apic, pin)) | ||
| 522 | panic("IO-APIC: failed to add irq-pin. Can not proceed\n"); | ||
| 514 | } | 523 | } |
| 515 | 524 | ||
| 516 | /* | 525 | /* |
| @@ -3843,7 +3852,11 @@ static int __io_apic_set_pci_routing(struct device *dev, int irq, | |||
| 3843 | */ | 3852 | */ |
| 3844 | if (irq >= NR_IRQS_LEGACY) { | 3853 | if (irq >= NR_IRQS_LEGACY) { |
| 3845 | cfg = desc->chip_data; | 3854 | cfg = desc->chip_data; |
| 3846 | add_pin_to_irq_node(cfg, node, ioapic, pin); | 3855 | if (add_pin_to_irq_node_nopanic(cfg, node, ioapic, pin)) { |
| 3856 | printk(KERN_INFO "can not add pin %d for irq %d\n", | ||
| 3857 | pin, irq); | ||
| 3858 | return 0; | ||
| 3859 | } | ||
| 3847 | } | 3860 | } |
| 3848 | 3861 | ||
| 3849 | setup_IO_APIC_irq(ioapic, pin, irq, desc, trigger, polarity); | 3862 | setup_IO_APIC_irq(ioapic, pin, irq, desc, trigger, polarity); |
