aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/pnp/resource.c27
-rw-r--r--include/linux/pnp.h1
2 files changed, 28 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)
{
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index e8187d9faf0..b5fd03854fa 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -25,6 +25,7 @@ struct pnp_dev;
/*
* Resource Management
*/
+struct resource *pnp_get_resource(struct pnp_dev *, unsigned int, unsigned int);
/* Use these instead of directly reading pnp_dev to get resource information */
#define pnp_port_start(dev,bar) ((dev)->res.port_resource[(bar)].start)