Re: [PATCH 5/7] x86/pci: add 4 more return param inIO_APIC_get_PCI_irq_vector

From: Ingo Molnar
Date: Mon May 11 2009 - 04:29:57 EST



* Yinghai Lu <yinghai@xxxxxxxxxx> wrote:

> +int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin,
> + int *ioapic, int *ioapic_pin,
> + int *trigger, int *polarity)

> if (io_apic_assign_pci_irqs) {
> int irq;
> + int ioapic = -1, ioapic_pin = -1;
> + int triggering, polarity;

please put this into a helper function/inline.

>
> - irq = IO_APIC_get_PCI_irq_vector(dev->bus->number, PCI_SLOT(dev->devfn), pin - 1);
> + irq = IO_APIC_get_PCI_irq_vector(dev->bus->number,
> + PCI_SLOT(dev->devfn),
> + pin - 1,
> + &ioapic, &ioapic_pin,
> + &triggering, &polarity);
> /*
> * Busses behind bridges are typically not listed in the MP-table.
> * In this case we have to look up the IRQ based on the parent bus,
> @@ -1235,7 +1248,10 @@ static int pirq_enable_irq(struct pci_de
>
> pin = pci_swizzle_interrupt_pin(dev, pin);
> irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number,
> - PCI_SLOT(bridge->devfn), pin - 1);
> + PCI_SLOT(bridge->devfn),
> + pin - 1,
> + &ioapic, &ioapic_pin,
> + &triggering, &polarity);
> if (irq >= 0)
> dev_warn(&dev->dev, "using bridge %s "
> "INT %c to get IRQ %d\n",

That function has way too many parameters. Please introduce a helper
structure (struct io_apic_irq_attr) where the parameters can be
passed along in a clean and short fashion. We update them by
reference anyway.

I've applied the patch, but we need these cleanups too, the code has
become too ugly.

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/