summaryrefslogtreecommitdiff
path: root/drivers/pnp/pnpacpi
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2008-04-28 16:34:34 -0600
committerLen Brown <len.brown@intel.com>2008-04-29 03:22:28 -0400
commitdbddd0383c59d588f8db5e773b062756e39117ec (patch)
tree77009fb218b4fc21090ae83105aa0f84664ae61c /drivers/pnp/pnpacpi
parenta50b6d7b8d7e1a8b13bd1be65a865b115e1190d9 (diff)
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 <bjorn.helgaas@hp.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/pnp/pnpacpi')
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c33
1 files changed, 7 insertions, 26 deletions
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index 3634f2f3f745..0b67dff1e7c3 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)