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

x86, ioapic: Clean up ioapic/apic_id usage

While looking at the code, apic_id sometime is referred to index
of ioapic, but sometime is used for phys apic id. and some even
use apic for real apic id. It is very confusing.

So try to limit apic_id or ioapic_id to be real apic id for
ioapic, and use ioapic_idx for ioapic index in the array.

-v2: Suggested by Ingo, use ioapic_idx consistently, instead of ioapic

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Naga Chumbalkar <nagananda.chumbalkar@hp.com>
Cc: Suresh Siddha <suresh.b.siddha@intel.com>
Link: http://lkml.kernel.org/r/4E9542DC.3090509@oracle.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>

authored by

Yinghai Lu and committed by
Ingo Molnar
6f50d45f cda417dd

+97 -97
+97 -97
arch/x86/kernel/apic/io_apic.c
··· 92 92 DECLARE_BITMAP(pin_programmed, MP_MAX_IOAPIC_PIN + 1); 93 93 } ioapics[MAX_IO_APICS]; 94 94 95 - #define mpc_ioapic_ver(id) ioapics[id].mp_config.apicver 95 + #define mpc_ioapic_ver(ioapic_idx) ioapics[ioapic_idx].mp_config.apicver 96 96 97 - int mpc_ioapic_id(int id) 97 + int mpc_ioapic_id(int ioapic_idx) 98 98 { 99 - return ioapics[id].mp_config.apicid; 99 + return ioapics[ioapic_idx].mp_config.apicid; 100 100 } 101 101 102 - unsigned int mpc_ioapic_addr(int id) 102 + unsigned int mpc_ioapic_addr(int ioapic_idx) 103 103 { 104 - return ioapics[id].mp_config.apicaddr; 104 + return ioapics[ioapic_idx].mp_config.apicaddr; 105 105 } 106 106 107 - struct mp_ioapic_gsi *mp_ioapic_gsi_routing(int id) 107 + struct mp_ioapic_gsi *mp_ioapic_gsi_routing(int ioapic_idx) 108 108 { 109 - return &ioapics[id].gsi_config; 109 + return &ioapics[ioapic_idx].gsi_config; 110 110 } 111 111 112 112 int nr_ioapics; ··· 712 712 /* 713 713 * Find the IRQ entry number of a certain pin. 714 714 */ 715 - static int find_irq_entry(int apic, int pin, int type) 715 + static int find_irq_entry(int ioapic_idx, int pin, int type) 716 716 { 717 717 int i; 718 718 719 719 for (i = 0; i < mp_irq_entries; i++) 720 720 if (mp_irqs[i].irqtype == type && 721 - (mp_irqs[i].dstapic == mpc_ioapic_id(apic) || 721 + (mp_irqs[i].dstapic == mpc_ioapic_id(ioapic_idx) || 722 722 mp_irqs[i].dstapic == MP_APIC_ALL) && 723 723 mp_irqs[i].dstirq == pin) 724 724 return i; ··· 757 757 (mp_irqs[i].srcbusirq == irq)) 758 758 break; 759 759 } 760 + 760 761 if (i < mp_irq_entries) { 761 - int apic; 762 - for(apic = 0; apic < nr_ioapics; apic++) { 763 - if (mpc_ioapic_id(apic) == mp_irqs[i].dstapic) 764 - return apic; 765 - } 762 + int ioapic_idx; 763 + 764 + for (ioapic_idx = 0; ioapic_idx < nr_ioapics; ioapic_idx++) 765 + if (mpc_ioapic_id(ioapic_idx) == mp_irqs[i].dstapic) 766 + return ioapic_idx; 766 767 } 767 768 768 769 return -1; ··· 978 977 int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin, 979 978 struct io_apic_irq_attr *irq_attr) 980 979 { 981 - int apic, i, best_guess = -1; 980 + int ioapic_idx, i, best_guess = -1; 982 981 983 982 apic_printk(APIC_DEBUG, 984 983 "querying PCI -> IRQ mapping bus:%d, slot:%d, pin:%d.\n", ··· 991 990 for (i = 0; i < mp_irq_entries; i++) { 992 991 int lbus = mp_irqs[i].srcbus; 993 992 994 - for (apic = 0; apic < nr_ioapics; apic++) 995 - if (mpc_ioapic_id(apic) == mp_irqs[i].dstapic || 993 + for (ioapic_idx = 0; ioapic_idx < nr_ioapics; ioapic_idx++) 994 + if (mpc_ioapic_id(ioapic_idx) == mp_irqs[i].dstapic || 996 995 mp_irqs[i].dstapic == MP_APIC_ALL) 997 996 break; 998 997 ··· 1000 999 !mp_irqs[i].irqtype && 1001 1000 (bus == lbus) && 1002 1001 (slot == ((mp_irqs[i].srcbusirq >> 2) & 0x1f))) { 1003 - int irq = pin_2_irq(i, apic, mp_irqs[i].dstirq); 1002 + int irq = pin_2_irq(i, ioapic_idx, mp_irqs[i].dstirq); 1004 1003 1005 - if (!(apic || IO_APIC_IRQ(irq))) 1004 + if (!(ioapic_idx || IO_APIC_IRQ(irq))) 1006 1005 continue; 1007 1006 1008 1007 if (pin == (mp_irqs[i].srcbusirq & 3)) { 1009 - set_io_apic_irq_attr(irq_attr, apic, 1008 + set_io_apic_irq_attr(irq_attr, ioapic_idx, 1010 1009 mp_irqs[i].dstirq, 1011 1010 irq_trigger(i), 1012 1011 irq_polarity(i)); ··· 1017 1016 * best-guess fuzzy result for broken mptables. 1018 1017 */ 1019 1018 if (best_guess < 0) { 1020 - set_io_apic_irq_attr(irq_attr, apic, 1019 + set_io_apic_irq_attr(irq_attr, ioapic_idx, 1021 1020 mp_irqs[i].dstirq, 1022 1021 irq_trigger(i), 1023 1022 irq_polarity(i)); ··· 1264 1263 { 1265 1264 int index; 1266 1265 struct irte irte; 1267 - int apic_id = mpc_ioapic_id(attr->ioapic); 1268 - struct intel_iommu *iommu = map_ioapic_to_ir(apic_id); 1266 + int ioapic_id = mpc_ioapic_id(attr->ioapic); 1267 + struct intel_iommu *iommu = map_ioapic_to_ir(ioapic_id); 1269 1268 1270 1269 if (!iommu) { 1271 - pr_warn("No mapping iommu for ioapic %d\n", apic_id); 1270 + pr_warn("No mapping iommu for ioapic %d\n", ioapic_id); 1272 1271 return -ENODEV; 1273 1272 } 1274 1273 1275 1274 index = alloc_irte(iommu, irq, 1); 1276 1275 if (index < 0) { 1277 - pr_warn("Failed to allocate IRTE for ioapic %d\n", apic_id); 1276 + pr_warn("Failed to allocate IRTE for ioapic %d\n", ioapic_id); 1278 1277 return -ENOMEM; 1279 1278 } 1280 1279 1281 1280 prepare_irte(&irte, vector, destination); 1282 1281 1283 1282 /* Set source-id of interrupt request */ 1284 - set_ioapic_sid(&irte, apic_id); 1283 + set_ioapic_sid(&irte, ioapic_id); 1285 1284 1286 1285 modify_irte(irq, &irte); 1287 1286 ··· 1390 1389 ioapic_write_entry(attr->ioapic, attr->ioapic_pin, entry); 1391 1390 } 1392 1391 1393 - static bool __init io_apic_pin_not_connected(int idx, int apic_id, int pin) 1392 + static bool __init io_apic_pin_not_connected(int idx, int ioapic_idx, int pin) 1394 1393 { 1395 1394 if (idx != -1) 1396 1395 return false; 1397 1396 1398 1397 apic_printk(APIC_VERBOSE, KERN_DEBUG " apic %d pin %d not connected\n", 1399 - mpc_ioapic_id(apic_id), pin); 1398 + mpc_ioapic_id(ioapic_idx), pin); 1400 1399 return true; 1401 1400 } 1402 1401 1403 - static void __init __io_apic_setup_irqs(unsigned int apic_id) 1402 + static void __init __io_apic_setup_irqs(unsigned int ioapic_idx) 1404 1403 { 1405 1404 int idx, node = cpu_to_node(0); 1406 1405 struct io_apic_irq_attr attr; 1407 1406 unsigned int pin, irq; 1408 1407 1409 - for (pin = 0; pin < ioapics[apic_id].nr_registers; pin++) { 1410 - idx = find_irq_entry(apic_id, pin, mp_INT); 1411 - if (io_apic_pin_not_connected(idx, apic_id, pin)) 1408 + for (pin = 0; pin < ioapics[ioapic_idx].nr_registers; pin++) { 1409 + idx = find_irq_entry(ioapic_idx, pin, mp_INT); 1410 + if (io_apic_pin_not_connected(idx, ioapic_idx, pin)) 1412 1411 continue; 1413 1412 1414 - irq = pin_2_irq(idx, apic_id, pin); 1413 + irq = pin_2_irq(idx, ioapic_idx, pin); 1415 1414 1416 - if ((apic_id > 0) && (irq > 16)) 1415 + if ((ioapic_idx > 0) && (irq > 16)) 1417 1416 continue; 1418 1417 1419 1418 /* ··· 1421 1420 * installed and if it returns 1: 1422 1421 */ 1423 1422 if (apic->multi_timer_check && 1424 - apic->multi_timer_check(apic_id, irq)) 1423 + apic->multi_timer_check(ioapic_idx, irq)) 1425 1424 continue; 1426 1425 1427 - set_io_apic_irq_attr(&attr, apic_id, pin, irq_trigger(idx), 1426 + set_io_apic_irq_attr(&attr, ioapic_idx, pin, irq_trigger(idx), 1428 1427 irq_polarity(idx)); 1429 1428 1430 1429 io_apic_setup_irq_pin(irq, node, &attr); ··· 1433 1432 1434 1433 static void __init setup_IO_APIC_irqs(void) 1435 1434 { 1436 - unsigned int apic_id; 1435 + unsigned int ioapic_idx; 1437 1436 1438 1437 apic_printk(APIC_VERBOSE, KERN_DEBUG "init IO_APIC IRQs\n"); 1439 1438 1440 - for (apic_id = 0; apic_id < nr_ioapics; apic_id++) 1441 - __io_apic_setup_irqs(apic_id); 1439 + for (ioapic_idx = 0; ioapic_idx < nr_ioapics; ioapic_idx++) 1440 + __io_apic_setup_irqs(ioapic_idx); 1442 1441 } 1443 1442 1444 1443 /* ··· 1448 1447 */ 1449 1448 void setup_IO_APIC_irq_extra(u32 gsi) 1450 1449 { 1451 - int apic_id = 0, pin, idx, irq, node = cpu_to_node(0); 1450 + int ioapic_idx = 0, pin, idx, irq, node = cpu_to_node(0); 1452 1451 struct io_apic_irq_attr attr; 1453 1452 1454 1453 /* 1455 1454 * Convert 'gsi' to 'ioapic.pin'. 1456 1455 */ 1457 - apic_id = mp_find_ioapic(gsi); 1458 - if (apic_id < 0) 1456 + ioapic_idx = mp_find_ioapic(gsi); 1457 + if (ioapic_idx < 0) 1459 1458 return; 1460 1459 1461 - pin = mp_find_ioapic_pin(apic_id, gsi); 1462 - idx = find_irq_entry(apic_id, pin, mp_INT); 1460 + pin = mp_find_ioapic_pin(ioapic_idx, gsi); 1461 + idx = find_irq_entry(ioapic_idx, pin, mp_INT); 1463 1462 if (idx == -1) 1464 1463 return; 1465 1464 1466 - irq = pin_2_irq(idx, apic_id, pin); 1465 + irq = pin_2_irq(idx, ioapic_idx, pin); 1467 1466 1468 1467 /* Only handle the non legacy irqs on secondary ioapics */ 1469 - if (apic_id == 0 || irq < NR_IRQS_LEGACY) 1468 + if (ioapic_idx == 0 || irq < NR_IRQS_LEGACY) 1470 1469 return; 1471 1470 1472 - set_io_apic_irq_attr(&attr, apic_id, pin, irq_trigger(idx), 1471 + set_io_apic_irq_attr(&attr, ioapic_idx, pin, irq_trigger(idx), 1473 1472 irq_polarity(idx)); 1474 1473 1475 1474 io_apic_setup_irq_pin_once(irq, node, &attr); ··· 1478 1477 /* 1479 1478 * Set up the timer pin, possibly with the 8259A-master behind. 1480 1479 */ 1481 - static void __init setup_timer_IRQ0_pin(unsigned int apic_id, unsigned int pin, 1482 - int vector) 1480 + static void __init setup_timer_IRQ0_pin(unsigned int ioapic_idx, 1481 + unsigned int pin, int vector) 1483 1482 { 1484 1483 struct IO_APIC_route_entry entry; 1485 1484 ··· 1510 1509 /* 1511 1510 * Add it to the IO-APIC irq-routing table: 1512 1511 */ 1513 - ioapic_write_entry(apic_id, pin, entry); 1512 + ioapic_write_entry(ioapic_idx, pin, entry); 1514 1513 } 1515 1514 1516 - __apicdebuginit(void) print_IO_APIC(int apic) 1515 + __apicdebuginit(void) print_IO_APIC(int ioapic_idx) 1517 1516 { 1518 1517 int i; 1519 1518 union IO_APIC_reg_00 reg_00; ··· 1523 1522 unsigned long flags; 1524 1523 1525 1524 raw_spin_lock_irqsave(&ioapic_lock, flags); 1526 - reg_00.raw = io_apic_read(apic, 0); 1527 - reg_01.raw = io_apic_read(apic, 1); 1525 + reg_00.raw = io_apic_read(ioapic_idx, 0); 1526 + reg_01.raw = io_apic_read(ioapic_idx, 1); 1528 1527 if (reg_01.bits.version >= 0x10) 1529 - reg_02.raw = io_apic_read(apic, 2); 1528 + reg_02.raw = io_apic_read(ioapic_idx, 2); 1530 1529 if (reg_01.bits.version >= 0x20) 1531 - reg_03.raw = io_apic_read(apic, 3); 1530 + reg_03.raw = io_apic_read(ioapic_idx, 3); 1532 1531 raw_spin_unlock_irqrestore(&ioapic_lock, flags); 1533 1532 1534 1533 printk("\n"); 1535 - printk(KERN_DEBUG "IO APIC #%d......\n", mpc_ioapic_id(apic)); 1534 + printk(KERN_DEBUG "IO APIC #%d......\n", mpc_ioapic_id(ioapic_idx)); 1536 1535 printk(KERN_DEBUG ".... register #00: %08X\n", reg_00.raw); 1537 1536 printk(KERN_DEBUG "....... : physical APIC id: %02X\n", reg_00.bits.ID); 1538 1537 printk(KERN_DEBUG "....... : Delivery Type: %X\n", reg_00.bits.delivery_type); ··· 1582 1581 struct IO_APIC_route_entry entry; 1583 1582 struct IR_IO_APIC_route_entry *ir_entry; 1584 1583 1585 - entry = ioapic_read_entry(apic, i); 1584 + entry = ioapic_read_entry(ioapic_idx, i); 1586 1585 ir_entry = (struct IR_IO_APIC_route_entry *) &entry; 1587 1586 printk(KERN_DEBUG " %02x %04X ", 1588 1587 i, ··· 1603 1602 } else { 1604 1603 struct IO_APIC_route_entry entry; 1605 1604 1606 - entry = ioapic_read_entry(apic, i); 1605 + entry = ioapic_read_entry(ioapic_idx, i); 1607 1606 printk(KERN_DEBUG " %02x %02X ", 1608 1607 i, 1609 1608 entry.dest ··· 1625 1624 1626 1625 __apicdebuginit(void) print_IO_APICs(void) 1627 1626 { 1628 - int apic, i; 1627 + int ioapic_idx; 1629 1628 struct irq_cfg *cfg; 1630 1629 unsigned int irq; 1631 1630 1632 1631 printk(KERN_DEBUG "number of MP IRQ sources: %d.\n", mp_irq_entries); 1633 - for (i = 0; i < nr_ioapics; i++) 1632 + for (ioapic_idx = 0; ioapic_idx < nr_ioapics; ioapic_idx++) 1634 1633 printk(KERN_DEBUG "number of IO-APIC #%d registers: %d.\n", 1635 - mpc_ioapic_id(i), ioapics[i].nr_registers); 1634 + mpc_ioapic_id(ioapic_idx), 1635 + ioapics[ioapic_idx].nr_registers); 1636 1636 1637 1637 /* 1638 1638 * We are a bit conservative about what we expect. We have to ··· 1641 1639 */ 1642 1640 printk(KERN_INFO "testing the IO APIC.......................\n"); 1643 1641 1644 - for (apic = 0; apic < nr_ioapics; apic++) 1645 - print_IO_APIC(apic); 1642 + for (ioapic_idx = 0; ioapic_idx < nr_ioapics; ioapic_idx++) 1643 + print_IO_APIC(ioapic_idx); 1646 1644 1647 1645 printk(KERN_DEBUG "IRQ to pin mappings:\n"); 1648 1646 for_each_active_irq(irq) { ··· 1979 1977 { 1980 1978 union IO_APIC_reg_00 reg_00; 1981 1979 physid_mask_t phys_id_present_map; 1982 - int apic_id; 1980 + int ioapic_idx; 1983 1981 int i; 1984 1982 unsigned char old_id; 1985 1983 unsigned long flags; ··· 1993 1991 /* 1994 1992 * Set the IOAPIC ID to the value stored in the MPC table. 1995 1993 */ 1996 - for (apic_id = 0; apic_id < nr_ioapics; apic_id++) { 1997 - 1994 + for (ioapic_idx = 0; ioapic_idx < nr_ioapics; ioapic_idx++) { 1998 1995 /* Read the register 0 value */ 1999 1996 raw_spin_lock_irqsave(&ioapic_lock, flags); 2000 - reg_00.raw = io_apic_read(apic_id, 0); 1997 + reg_00.raw = io_apic_read(ioapic_idx, 0); 2001 1998 raw_spin_unlock_irqrestore(&ioapic_lock, flags); 2002 1999 2003 - old_id = mpc_ioapic_id(apic_id); 2000 + old_id = mpc_ioapic_id(ioapic_idx); 2004 2001 2005 - if (mpc_ioapic_id(apic_id) >= get_physical_broadcast()) { 2002 + if (mpc_ioapic_id(ioapic_idx) >= get_physical_broadcast()) { 2006 2003 printk(KERN_ERR "BIOS bug, IO-APIC#%d ID is %d in the MPC table!...\n", 2007 - apic_id, mpc_ioapic_id(apic_id)); 2004 + ioapic_idx, mpc_ioapic_id(ioapic_idx)); 2008 2005 printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n", 2009 2006 reg_00.bits.ID); 2010 - ioapics[apic_id].mp_config.apicid = reg_00.bits.ID; 2007 + ioapics[ioapic_idx].mp_config.apicid = reg_00.bits.ID; 2011 2008 } 2012 2009 2013 2010 /* ··· 2015 2014 * 'stuck on smp_invalidate_needed IPI wait' messages. 2016 2015 */ 2017 2016 if (apic->check_apicid_used(&phys_id_present_map, 2018 - mpc_ioapic_id(apic_id))) { 2017 + mpc_ioapic_id(ioapic_idx))) { 2019 2018 printk(KERN_ERR "BIOS bug, IO-APIC#%d ID %d is already used!...\n", 2020 - apic_id, mpc_ioapic_id(apic_id)); 2019 + ioapic_idx, mpc_ioapic_id(ioapic_idx)); 2021 2020 for (i = 0; i < get_physical_broadcast(); i++) 2022 2021 if (!physid_isset(i, phys_id_present_map)) 2023 2022 break; ··· 2026 2025 printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n", 2027 2026 i); 2028 2027 physid_set(i, phys_id_present_map); 2029 - ioapics[apic_id].mp_config.apicid = i; 2028 + ioapics[ioapic_idx].mp_config.apicid = i; 2030 2029 } else { 2031 2030 physid_mask_t tmp; 2032 - apic->apicid_to_cpu_present(mpc_ioapic_id(apic_id), 2031 + apic->apicid_to_cpu_present(mpc_ioapic_id(ioapic_idx), 2033 2032 &tmp); 2034 2033 apic_printk(APIC_VERBOSE, "Setting %d in the " 2035 2034 "phys_id_present_map\n", 2036 - mpc_ioapic_id(apic_id)); 2035 + mpc_ioapic_id(ioapic_idx)); 2037 2036 physids_or(phys_id_present_map, phys_id_present_map, tmp); 2038 2037 } 2039 2038 ··· 2041 2040 * We need to adjust the IRQ routing table 2042 2041 * if the ID changed. 2043 2042 */ 2044 - if (old_id != mpc_ioapic_id(apic_id)) 2043 + if (old_id != mpc_ioapic_id(ioapic_idx)) 2045 2044 for (i = 0; i < mp_irq_entries; i++) 2046 2045 if (mp_irqs[i].dstapic == old_id) 2047 2046 mp_irqs[i].dstapic 2048 - = mpc_ioapic_id(apic_id); 2047 + = mpc_ioapic_id(ioapic_idx); 2049 2048 2050 2049 /* 2051 2050 * Update the ID register according to the right value 2052 2051 * from the MPC table if they are different. 2053 2052 */ 2054 - if (mpc_ioapic_id(apic_id) == reg_00.bits.ID) 2053 + if (mpc_ioapic_id(ioapic_idx) == reg_00.bits.ID) 2055 2054 continue; 2056 2055 2057 2056 apic_printk(APIC_VERBOSE, KERN_INFO 2058 2057 "...changing IO-APIC physical APIC ID to %d ...", 2059 - mpc_ioapic_id(apic_id)); 2058 + mpc_ioapic_id(ioapic_idx)); 2060 2059 2061 - reg_00.bits.ID = mpc_ioapic_id(apic_id); 2060 + reg_00.bits.ID = mpc_ioapic_id(ioapic_idx); 2062 2061 raw_spin_lock_irqsave(&ioapic_lock, flags); 2063 - io_apic_write(apic_id, 0, reg_00.raw); 2062 + io_apic_write(ioapic_idx, 0, reg_00.raw); 2064 2063 raw_spin_unlock_irqrestore(&ioapic_lock, flags); 2065 2064 2066 2065 /* 2067 2066 * Sanity check 2068 2067 */ 2069 2068 raw_spin_lock_irqsave(&ioapic_lock, flags); 2070 - reg_00.raw = io_apic_read(apic_id, 0); 2069 + reg_00.raw = io_apic_read(ioapic_idx, 0); 2071 2070 raw_spin_unlock_irqrestore(&ioapic_lock, flags); 2072 - if (reg_00.bits.ID != mpc_ioapic_id(apic_id)) 2071 + if (reg_00.bits.ID != mpc_ioapic_id(ioapic_idx)) 2073 2072 printk("could not set ID!\n"); 2074 2073 else 2075 2074 apic_printk(APIC_VERBOSE, " ok.\n"); ··· 2969 2968 2970 2969 late_initcall(io_apic_bug_finalize); 2971 2970 2972 - static void resume_ioapic_id(int ioapic_id) 2971 + static void resume_ioapic_id(int ioapic_idx) 2973 2972 { 2974 2973 unsigned long flags; 2975 2974 union IO_APIC_reg_00 reg_00; 2976 2975 2977 - 2978 2976 raw_spin_lock_irqsave(&ioapic_lock, flags); 2979 - reg_00.raw = io_apic_read(ioapic_id, 0); 2980 - if (reg_00.bits.ID != mpc_ioapic_id(ioapic_id)) { 2981 - reg_00.bits.ID = mpc_ioapic_id(ioapic_id); 2982 - io_apic_write(ioapic_id, 0, reg_00.raw); 2977 + reg_00.raw = io_apic_read(ioapic_idx, 0); 2978 + if (reg_00.bits.ID != mpc_ioapic_id(ioapic_idx)) { 2979 + reg_00.bits.ID = mpc_ioapic_id(ioapic_idx); 2980 + io_apic_write(ioapic_idx, 0, reg_00.raw); 2983 2981 } 2984 2982 raw_spin_unlock_irqrestore(&ioapic_lock, flags); 2985 2983 } 2986 2984 2987 2985 static void ioapic_resume(void) 2988 2986 { 2989 - int ioapic_id; 2987 + int ioapic_idx; 2990 2988 2991 - for (ioapic_id = nr_ioapics - 1; ioapic_id >= 0; ioapic_id--) 2992 - resume_ioapic_id(ioapic_id); 2989 + for (ioapic_idx = nr_ioapics - 1; ioapic_idx >= 0; ioapic_idx--) 2990 + resume_ioapic_id(ioapic_idx); 2993 2991 2994 2992 restore_ioapic_entries(); 2995 2993 } ··· 3597 3597 int io_apic_setup_irq_pin_once(unsigned int irq, int node, 3598 3598 struct io_apic_irq_attr *attr) 3599 3599 { 3600 - unsigned int id = attr->ioapic, pin = attr->ioapic_pin; 3600 + unsigned int ioapic_idx = attr->ioapic, pin = attr->ioapic_pin; 3601 3601 int ret; 3602 3602 3603 3603 /* Avoid redundant programming */ 3604 - if (test_bit(pin, ioapics[id].pin_programmed)) { 3604 + if (test_bit(pin, ioapics[ioapic_idx].pin_programmed)) { 3605 3605 pr_debug("Pin %d-%d already programmed\n", 3606 - mpc_ioapic_id(id), pin); 3606 + mpc_ioapic_id(ioapic_idx), pin); 3607 3607 return 0; 3608 3608 } 3609 3609 ret = io_apic_setup_irq_pin(irq, node, attr); 3610 3610 if (!ret) 3611 - set_bit(pin, ioapics[id].pin_programmed); 3611 + set_bit(pin, ioapics[ioapic_idx].pin_programmed); 3612 3612 return ret; 3613 3613 } 3614 3614