aboutsummaryrefslogtreecommitdiff
path: root/drivers/pnp/resource.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2008-04-28 16:34:14 -0600
committerLen Brown <len.brown@intel.com>2008-04-29 03:22:23 -0400
commitb90eca0a61ebd010036242e29610bc6a909e3f19 (patch)
tree7f92620157786997dc0123b75b8c38b61e8dd2be /drivers/pnp/resource.c
parentd948a8daa059cf5b3e7f002e7b92acf00fc70c49 (diff)
PNP: add pnp_get_resource() interface
This adds a pnp_get_resource() that works the same way as platform_get_resource(). This will enable us to consolidate many pnp_resource_table references in one place, which will make it easier to make the table dynamic. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Acked-By: Rene Herman <rene.herman@gmail.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/pnp/resource.c')
-rw-r--r--drivers/pnp/resource.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c
index eee6d8eddcb..ef8835ec577 100644
--- a/drivers/pnp/resource.c
+++ b/drivers/pnp/resource.c
@@ -487,6 +487,33 @@ int pnp_check_dma(struct pnp_dev *dev, int idx)
#endif
}
+struct resource *pnp_get_resource(struct pnp_dev *dev,
+ unsigned int type, unsigned int num)
+{
+ struct pnp_resource_table *res = &dev->res;
+
+ switch (type) {
+ case IORESOURCE_IO:
+ if (num >= PNP_MAX_PORT)
+ return NULL;
+ return &res->port_resource[num];
+ case IORESOURCE_MEM:
+ if (num >= PNP_MAX_MEM)
+ return NULL;
+ return &res->mem_resource[num];
+ case IORESOURCE_IRQ:
+ if (num >= PNP_MAX_IRQ)
+ return NULL;
+ return &res->irq_resource[num];
+ case IORESOURCE_DMA:
+ if (num >= PNP_MAX_DMA)
+ return NULL;
+ return &res->dma_resource[num];
+ }
+ return NULL;
+}
+EXPORT_SYMBOL(pnp_get_resource);
+
/* format is: pnp_reserve_irq=irq1[,irq2] .... */
static int __init pnp_setup_reserve_irq(char *str)
{