]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/pnp/resource.c
PNP: add pnp_get_resource() interface
[linux-2.6-omap-h63xx.git] / drivers / pnp / resource.c
index eee6d8eddcb4c49c911f966a5198a5f36ba3fe32..ef8835ec57780a32c87e37b0526c206630fb956b 100644 (file)
@@ -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)
 {