summaryrefslogtreecommitdiffstats
path: root/drivers/pnp/resource.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2008-04-29 00:34:34 +0200
committerLen Brown <len.brown@intel.com>2008-04-29 09:22:28 +0200
commitdbddd0383c59d588f8db5e773b062756e39117ec (patch)
tree77009fb218b4fc21090ae83105aa0f84664ae61c /drivers/pnp/resource.c
parentPNP: add pnp_new_resource() to find a new unset pnp_resource (diff)
downloadlinux-dbddd0383c59d588f8db5e773b062756e39117ec.tar.xz
linux-dbddd0383c59d588f8db5e773b062756e39117ec.zip
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/resource.c')
-rw-r--r--drivers/pnp/resource.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c
index 1f4134eea7b7..082a556b9dcc 100644
--- a/drivers/pnp/resource.c
+++ b/drivers/pnp/resource.c
@@ -576,6 +576,32 @@ static struct pnp_resource *pnp_new_resource(struct pnp_dev *dev, int type)
return NULL;
}
+struct pnp_resource *pnp_add_irq_resource(struct pnp_dev *dev, int irq,
+ int flags)
+{
+ struct pnp_resource *pnp_res;
+ struct resource *res;
+ static unsigned char warned;
+
+ pnp_res = pnp_new_resource(dev, IORESOURCE_IRQ);
+ if (!pnp_res) {
+ if (!warned) {
+ dev_err(&dev->dev, "can't add resource for IRQ %d\n",
+ irq);
+ warned = 1;
+ }
+ return NULL;
+ }
+
+ res = &pnp_res->res;
+ res->flags = IORESOURCE_IRQ | flags;
+ res->start = irq;
+ res->end = irq;
+
+ dev_dbg(&dev->dev, " add irq %d flags %#x\n", irq, flags);
+ return pnp_res;
+}
+
/* format is: pnp_reserve_irq=irq1[,irq2] .... */
static int __init pnp_setup_reserve_irq(char *str)
{