diff options
author | Yinghai Lu <yinghai@kernel.org> | 2009-05-15 16:05:16 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-05-18 02:38:55 -0400 |
commit | e5198075c67a22ec9a09565b1ce88d3d3f5ba855 (patch) | |
tree | 3d4ea0efd8575e677509b022e649c62d4786ed55 /arch/x86/kernel/apic | |
parent | b5710ce92a8cf8e3fc0ffc230cfdbfa23463f1c8 (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.c | 43 |
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 74d2b480a20b..ce1ac74baa73 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) | |||
1096 | * Not an __init, possibly needed by modules | 1096 | * Not an __init, possibly needed by modules |
1097 | */ | 1097 | */ |
1098 | int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin, | 1098 | int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin, |
1099 | int *ioapic, int *ioapic_pin, | 1099 | struct io_apic_irq_attr *irq_attr) |
1100 | int *trigger, int *polarity) | ||
1101 | { | 1100 | { |
1102 | int apic, i, best_guess = -1; | 1101 | int apic, i, best_guess = -1; |
1103 | 1102 | ||
@@ -1127,10 +1126,10 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin, | |||
1127 | continue; | 1126 | continue; |
1128 | 1127 | ||
1129 | if (pin == (mp_irqs[i].srcbusirq & 3)) { | 1128 | if (pin == (mp_irqs[i].srcbusirq & 3)) { |
1130 | *ioapic = apic; | 1129 | set_io_apic_irq_attr(irq_attr, apic, |
1131 | *ioapic_pin = mp_irqs[i].dstirq; | 1130 | mp_irqs[i].dstirq, |
1132 | *trigger = irq_trigger(i); | 1131 | irq_trigger(i), |
1133 | *polarity = irq_polarity(i); | 1132 | irq_polarity(i)); |
1134 | return irq; | 1133 | return irq; |
1135 | } | 1134 | } |
1136 | /* | 1135 | /* |
@@ -1138,10 +1137,10 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin, | |||
1138 | * best-guess fuzzy result for broken mptables. | 1137 | * best-guess fuzzy result for broken mptables. |
1139 | */ | 1138 | */ |
1140 | if (best_guess < 0) { | 1139 | if (best_guess < 0) { |
1141 | *ioapic = apic; | 1140 | set_io_apic_irq_attr(irq_attr, apic, |
1142 | *ioapic_pin = mp_irqs[i].dstirq; | 1141 | mp_irqs[i].dstirq, |
1143 | *trigger = irq_trigger(i); | 1142 | irq_trigger(i), |
1144 | *polarity = irq_polarity(i); | 1143 | irq_polarity(i)); |
1145 | best_guess = irq; | 1144 | best_guess = irq; |
1146 | } | 1145 | } |
1147 | } | 1146 | } |
@@ -3865,13 +3864,16 @@ int __init arch_probe_nr_irqs(void) | |||
3865 | } | 3864 | } |
3866 | #endif | 3865 | #endif |
3867 | 3866 | ||
3868 | static int __io_apic_set_pci_routing(struct device *dev, int ioapic, int pin, int irq, | 3867 | static int __io_apic_set_pci_routing(struct device *dev, int irq, |
3869 | int triggering, int polarity) | 3868 | struct io_apic_irq_attr *irq_attr) |
3870 | { | 3869 | { |
3871 | struct irq_desc *desc; | 3870 | struct irq_desc *desc; |
3872 | struct irq_cfg *cfg; | 3871 | struct irq_cfg *cfg; |
3873 | int node; | 3872 | int node; |
3873 | int ioapic, pin; | ||
3874 | int trigger, polarity; | ||
3874 | 3875 | ||
3876 | ioapic = irq_attr->ioapic; | ||
3875 | if (!IO_APIC_IRQ(irq)) { | 3877 | if (!IO_APIC_IRQ(irq)) { |
3876 | apic_printk(APIC_QUIET,KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ 0\n", | 3878 | apic_printk(APIC_QUIET,KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ 0\n", |
3877 | ioapic); | 3879 | ioapic); |
@@ -3889,6 +3891,10 @@ static int __io_apic_set_pci_routing(struct device *dev, int ioapic, int pin, in | |||
3889 | return 0; | 3891 | return 0; |
3890 | } | 3892 | } |
3891 | 3893 | ||
3894 | pin = irq_attr->ioapic_pin; | ||
3895 | trigger = irq_attr->trigger; | ||
3896 | polarity = irq_attr->polarity; | ||
3897 | |||
3892 | /* | 3898 | /* |
3893 | * IRQs < 16 are already in the irq_2_pin[] map | 3899 | * IRQs < 16 are already in the irq_2_pin[] map |
3894 | */ | 3900 | */ |
@@ -3897,20 +3903,22 @@ static int __io_apic_set_pci_routing(struct device *dev, int ioapic, int pin, in | |||
3897 | add_pin_to_irq_node(cfg, node, ioapic, pin); | 3903 | add_pin_to_irq_node(cfg, node, ioapic, pin); |
3898 | } | 3904 | } |
3899 | 3905 | ||
3900 | setup_IO_APIC_irq(ioapic, pin, irq, desc, triggering, polarity); | 3906 | setup_IO_APIC_irq(ioapic, pin, irq, desc, trigger, polarity); |
3901 | 3907 | ||
3902 | return 0; | 3908 | return 0; |
3903 | } | 3909 | } |
3904 | 3910 | ||
3905 | int io_apic_set_pci_routing(struct device *dev, int ioapic, int pin, int irq, | 3911 | int io_apic_set_pci_routing(struct device *dev, int irq, |
3906 | int triggering, int polarity) | 3912 | struct io_apic_irq_attr *irq_attr) |
3907 | { | 3913 | { |
3908 | 3914 | int ioapic, pin; | |
3909 | /* | 3915 | /* |
3910 | * Avoid pin reprogramming. PRTs typically include entries | 3916 | * Avoid pin reprogramming. PRTs typically include entries |
3911 | * with redundant pin->gsi mappings (but unique PCI devices); | 3917 | * with redundant pin->gsi mappings (but unique PCI devices); |
3912 | * we only program the IOAPIC on the first. | 3918 | * we only program the IOAPIC on the first. |
3913 | */ | 3919 | */ |
3920 | ioapic = irq_attr->ioapic; | ||
3921 | pin = irq_attr->ioapic_pin; | ||
3914 | if (test_bit(pin, mp_ioapic_routing[ioapic].pin_programmed)) { | 3922 | if (test_bit(pin, mp_ioapic_routing[ioapic].pin_programmed)) { |
3915 | pr_debug("Pin %d-%d already programmed\n", | 3923 | pr_debug("Pin %d-%d already programmed\n", |
3916 | mp_ioapics[ioapic].apicid, pin); | 3924 | mp_ioapics[ioapic].apicid, pin); |
@@ -3918,8 +3926,7 @@ int io_apic_set_pci_routing(struct device *dev, int ioapic, int pin, int irq, | |||
3918 | } | 3926 | } |
3919 | set_bit(pin, mp_ioapic_routing[ioapic].pin_programmed); | 3927 | set_bit(pin, mp_ioapic_routing[ioapic].pin_programmed); |
3920 | 3928 | ||
3921 | return __io_apic_set_pci_routing(dev, ioapic, pin, irq, | 3929 | return __io_apic_set_pci_routing(dev, irq, irq_attr); |
3922 | triggering, polarity); | ||
3923 | } | 3930 | } |
3924 | 3931 | ||
3925 | /* -------------------------------------------------------------------------- | 3932 | /* -------------------------------------------------------------------------- |