diff options
author | Yinghai Lu <yhlu.kernel@gmail.com> | 2008-08-19 23:50:13 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-16 10:52:33 -0400 |
commit | 46b8214d12c274bd4265aae482ab7ffe69d94818 (patch) | |
tree | 512dc5a904104b82eda8741dc200f70ac938973b | |
parent | c7fb03a475bd80c642c1345d85c7c550f63514b8 (diff) |
x86, ioapic: replace loop with nr_irqs with for_each_irq_icfg
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | arch/x86/kernel/io_apic_64.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c index 708be9724daf..60d60061659c 100644 --- a/arch/x86/kernel/io_apic_64.c +++ b/arch/x86/kernel/io_apic_64.c | |||
@@ -129,6 +129,9 @@ static void __init init_work(void *data) | |||
129 | cfg[i-1].next = &cfg[i]; | 129 | cfg[i-1].next = &cfg[i]; |
130 | } | 130 | } |
131 | 131 | ||
132 | #define for_each_irq_cfg(cfg) \ | ||
133 | for (cfg = irq_cfgx; cfg && cfg->irq != -1U; cfg = cfg->next) | ||
134 | |||
132 | static struct irq_cfg *irq_cfgx; | 135 | static struct irq_cfg *irq_cfgx; |
133 | DEFINE_DYN_ARRAY(irq_cfgx, sizeof(struct irq_cfg), nr_irq_cfg, PAGE_SIZE, init_work); | 136 | DEFINE_DYN_ARRAY(irq_cfgx, sizeof(struct irq_cfg), nr_irq_cfg, PAGE_SIZE, init_work); |
134 | 137 | ||
@@ -1097,20 +1100,18 @@ void __setup_vector_irq(int cpu) | |||
1097 | /* Initialize vector_irq on a new cpu */ | 1100 | /* Initialize vector_irq on a new cpu */ |
1098 | /* This function must be called with vector_lock held */ | 1101 | /* This function must be called with vector_lock held */ |
1099 | int irq, vector; | 1102 | int irq, vector; |
1103 | struct irq_cfg *cfg; | ||
1100 | 1104 | ||
1101 | /* Mark the inuse vectors */ | 1105 | /* Mark the inuse vectors */ |
1102 | for (irq = 0; irq < nr_irqs; ++irq) { | 1106 | for_each_irq_cfg(cfg) { |
1103 | struct irq_cfg *cfg = irq_cfg(irq); | ||
1104 | |||
1105 | if (!cpu_isset(cpu, cfg->domain)) | 1107 | if (!cpu_isset(cpu, cfg->domain)) |
1106 | continue; | 1108 | continue; |
1107 | vector = cfg->vector; | 1109 | vector = cfg->vector; |
1110 | irq = cfg->irq; | ||
1108 | per_cpu(vector_irq, cpu)[vector] = irq; | 1111 | per_cpu(vector_irq, cpu)[vector] = irq; |
1109 | } | 1112 | } |
1110 | /* Mark the free vectors */ | 1113 | /* Mark the free vectors */ |
1111 | for (vector = 0; vector < NR_VECTORS; ++vector) { | 1114 | for (vector = 0; vector < NR_VECTORS; ++vector) { |
1112 | struct irq_cfg *cfg; | ||
1113 | |||
1114 | irq = per_cpu(vector_irq, cpu)[vector]; | 1115 | irq = per_cpu(vector_irq, cpu)[vector]; |
1115 | if (irq < 0) | 1116 | if (irq < 0) |
1116 | continue; | 1117 | continue; |
@@ -1340,6 +1341,7 @@ __apicdebuginit(void) print_IO_APIC(void) | |||
1340 | union IO_APIC_reg_01 reg_01; | 1341 | union IO_APIC_reg_01 reg_01; |
1341 | union IO_APIC_reg_02 reg_02; | 1342 | union IO_APIC_reg_02 reg_02; |
1342 | unsigned long flags; | 1343 | unsigned long flags; |
1344 | struct irq_cfg *cfg; | ||
1343 | 1345 | ||
1344 | if (apic_verbosity == APIC_QUIET) | 1346 | if (apic_verbosity == APIC_QUIET) |
1345 | return; | 1347 | return; |
@@ -1408,12 +1410,11 @@ __apicdebuginit(void) print_IO_APIC(void) | |||
1408 | } | 1410 | } |
1409 | } | 1411 | } |
1410 | printk(KERN_DEBUG "IRQ to pin mappings:\n"); | 1412 | printk(KERN_DEBUG "IRQ to pin mappings:\n"); |
1411 | for (i = 0; i < nr_irqs; i++) { | 1413 | for_each_irq_cfg(cfg) { |
1412 | struct irq_cfg *cfg = irq_cfg(i); | ||
1413 | struct irq_pin_list *entry = cfg->irq_2_pin; | 1414 | struct irq_pin_list *entry = cfg->irq_2_pin; |
1414 | if (!entry) | 1415 | if (!entry) |
1415 | continue; | 1416 | continue; |
1416 | printk(KERN_DEBUG "IRQ%d ", i); | 1417 | printk(KERN_DEBUG "IRQ%d ", cfg->irq); |
1417 | for (;;) { | 1418 | for (;;) { |
1418 | printk("-> %d:%d", entry->apic, entry->pin); | 1419 | printk("-> %d:%d", entry->apic, entry->pin); |
1419 | if (!entry->next) | 1420 | if (!entry->next) |
@@ -2070,6 +2071,7 @@ static inline void init_IO_APIC_traps(void) | |||
2070 | { | 2071 | { |
2071 | int irq; | 2072 | int irq; |
2072 | struct irq_desc *desc; | 2073 | struct irq_desc *desc; |
2074 | struct irq_cfg *cfg; | ||
2073 | 2075 | ||
2074 | /* | 2076 | /* |
2075 | * NOTE! The local APIC isn't very good at handling | 2077 | * NOTE! The local APIC isn't very good at handling |
@@ -2082,10 +2084,8 @@ static inline void init_IO_APIC_traps(void) | |||
2082 | * Also, we've got to be careful not to trash gate | 2084 | * Also, we've got to be careful not to trash gate |
2083 | * 0x80, because int 0x80 is hm, kind of importantish. ;) | 2085 | * 0x80, because int 0x80 is hm, kind of importantish. ;) |
2084 | */ | 2086 | */ |
2085 | for (irq = 0; irq < nr_irqs ; irq++) { | 2087 | for_each_irq_cfg(cfg) { |
2086 | struct irq_cfg *cfg; | 2088 | irq = cfg->irq; |
2087 | |||
2088 | cfg = irq_cfg(irq); | ||
2089 | if (IO_APIC_IRQ(irq) && !cfg->vector) { | 2089 | if (IO_APIC_IRQ(irq) && !cfg->vector) { |
2090 | /* | 2090 | /* |
2091 | * Hmm.. We don't have an entry for this, | 2091 | * Hmm.. We don't have an entry for this, |