From dbddd0383c59d588f8db5e773b062756e39117ec Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Mon, 28 Apr 2008 16:34:34 -0600 Subject: PNP: make generic pnp_add_irq_resource() Add a pnp_add_irq_resource() that can be used by all the PNP backends. This consolidates a little more pnp_resource_table knowledge into one place. Signed-off-by: Bjorn Helgaas Signed-off-by: Len Brown --- drivers/pnp/pnpacpi/rsparser.c | 33 +++++++-------------------------- 1 file changed, 7 insertions(+), 26 deletions(-) (limited to 'drivers/pnp/pnpacpi/rsparser.c') diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 3634f2f3f74..0b67dff1e7c 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c @@ -82,28 +82,12 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_dev *dev, u32 gsi, int triggering, int polarity, int shareable) { - struct resource *res; - int i; - int irq; + int irq, flags; int p, t; - static unsigned char warned; if (!valid_IRQ(gsi)) return; - for (i = 0; i < PNP_MAX_IRQ; i++) { - res = pnp_get_resource(dev, IORESOURCE_IRQ, i); - if (!pnp_resource_valid(res)) - break; - } - if (i >= PNP_MAX_IRQ) { - if (!warned) { - printk(KERN_WARNING "pnpacpi: exceeded the max number" - " of IRQ resources: %d\n", PNP_MAX_IRQ); - warned = 1; - } - return; - } /* * in IO-APIC mode, use overrided attribute. Two reasons: * 1. BIOS bug in DSDT @@ -121,17 +105,14 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_dev *dev, } } - res->flags = IORESOURCE_IRQ; // Also clears _UNSET flag - res->flags |= irq_flags(triggering, polarity, shareable); + flags = irq_flags(triggering, polarity, shareable); irq = acpi_register_gsi(gsi, triggering, polarity); - if (irq < 0) { - res->flags |= IORESOURCE_DISABLED; - return; - } + if (irq >= 0) + pcibios_penalize_isa_irq(irq, 1); + else + flags |= IORESOURCE_DISABLED; - res->start = irq; - res->end = irq; - pcibios_penalize_isa_irq(irq, 1); + pnp_add_irq_resource(dev, irq, flags); } static int dma_flags(int type, int bus_master, int transfer) -- cgit v1.2.3-70-g09d2