aboutsummaryrefslogtreecommitdiff
path: root/arch/x86/kernel/apic
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2009-05-15 13:05:16 -0700
committerIngo Molnar <mingo@elte.hu>2009-05-18 08:38:55 +0200
commite5198075c67a22ec9a09565b1ce88d3d3f5ba855 (patch)
tree3d4ea0efd8575e677509b022e649c62d4786ed55 /arch/x86/kernel/apic
parentb5710ce92a8cf8e3fc0ffc230cfdbfa23463f1c8 (diff)
x86, apic: introduce io_apic_irq_attr
according to Ingo, io_apic irq-setup related functions have too many parameters with a repetitive signature. So reduce related funcs to get less params by passing a pointer to a newly defined io_apic_irq_attr structure. v2: io_apic_irq ==> irq_attr triggering ==> trigger v3: add set_io_apic_irq_attr [ Impact: cleanup ] Signed-off-by: Yinghai Lu <yinghai@kernel.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Jesse Barnes <jbarnes@virtuousgeek.org> Cc: Len Brown <lenb@kernel.org> LKML-Reference: <4A08ACD3.2070401@kernel.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/apic')
-rw-r--r--arch/x86/kernel/apic/io_apic.c43
1 files changed, 25 insertions, 18 deletions
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 74d2b480a20..ce1ac74baa7 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -1096,8 +1096,7 @@ static int pin_2_irq(int idx, int apic, int pin)
* Not an __init, possibly needed by modules
*/
int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin,
- int *ioapic, int *ioapic_pin,
- int *trigger, int *polarity)
+ struct io_apic_irq_attr *irq_attr)
{
int apic, i, best_guess = -1;
@@ -1127,10 +1126,10 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin,
continue;
if (pin == (mp_irqs[i].srcbusirq & 3)) {
- *ioapic = apic;
- *ioapic_pin = mp_irqs[i].dstirq;
- *trigger = irq_trigger(i);
- *polarity = irq_polarity(i);
+ set_io_apic_irq_attr(irq_attr, apic,
+ mp_irqs[i].dstirq,
+ irq_trigger(i),
+ irq_polarity(i));
return irq;
}
/*
@@ -1138,10 +1137,10 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin,
* best-guess fuzzy result for broken mptables.
*/
if (best_guess < 0) {
- *ioapic = apic;
- *ioapic_pin = mp_irqs[i].dstirq;
- *trigger = irq_trigger(i);
- *polarity = irq_polarity(i);
+ set_io_apic_irq_attr(irq_attr, apic,
+ mp_irqs[i].dstirq,
+ irq_trigger(i),
+ irq_polarity(i));
best_guess = irq;
}
}
@@ -3865,13 +3864,16 @@ int __init arch_probe_nr_irqs(void)
}
#endif
-static int __io_apic_set_pci_routing(struct device *dev, int ioapic, int pin, int irq,
- int triggering, int polarity)
+static int __io_apic_set_pci_routing(struct device *dev, int irq,
+ struct io_apic_irq_attr *irq_attr)
{
struct irq_desc *desc;
struct irq_cfg *cfg;
int node;
+ int ioapic, pin;
+ int trigger, polarity;
+ ioapic = irq_attr->ioapic;
if (!IO_APIC_IRQ(irq)) {
apic_printk(APIC_QUIET,KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ 0\n",
ioapic);
@@ -3889,6 +3891,10 @@ static int __io_apic_set_pci_routing(struct device *dev, int ioapic, int pin, in
return 0;
}
+ pin = irq_attr->ioapic_pin;
+ trigger = irq_attr->trigger;
+ polarity = irq_attr->polarity;
+
/*
* IRQs < 16 are already in the irq_2_pin[] map
*/
@@ -3897,20 +3903,22 @@ static int __io_apic_set_pci_routing(struct device *dev, int ioapic, int pin, in
add_pin_to_irq_node(cfg, node, ioapic, pin);
}
- setup_IO_APIC_irq(ioapic, pin, irq, desc, triggering, polarity);
+ setup_IO_APIC_irq(ioapic, pin, irq, desc, trigger, polarity);
return 0;
}
-int io_apic_set_pci_routing(struct device *dev, int ioapic, int pin, int irq,
- int triggering, int polarity)
+int io_apic_set_pci_routing(struct device *dev, int irq,
+ struct io_apic_irq_attr *irq_attr)
{
-
+ int ioapic, pin;
/*
* Avoid pin reprogramming. PRTs typically include entries
* with redundant pin->gsi mappings (but unique PCI devices);
* we only program the IOAPIC on the first.
*/
+ ioapic = irq_attr->ioapic;
+ pin = irq_attr->ioapic_pin;
if (test_bit(pin, mp_ioapic_routing[ioapic].pin_programmed)) {
pr_debug("Pin %d-%d already programmed\n",
mp_ioapics[ioapic].apicid, pin);
@@ -3918,8 +3926,7 @@ int io_apic_set_pci_routing(struct device *dev, int ioapic, int pin, int irq,
}
set_bit(pin, mp_ioapic_routing[ioapic].pin_programmed);
- return __io_apic_set_pci_routing(dev, ioapic, pin, irq,
- triggering, polarity);
+ return __io_apic_set_pci_routing(dev, irq, irq_attr);
}
/* --------------------------------------------------------------------------