aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/pnp/base.h3
-rw-r--r--drivers/pnp/resource.c24
2 files changed, 21 insertions, 6 deletions
diff --git a/drivers/pnp/base.h b/drivers/pnp/base.h
index 1d6bb351d323..49b4138f3476 100644
--- a/drivers/pnp/base.h
+++ b/drivers/pnp/base.h
@@ -21,6 +21,9 @@ void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc);
21 21
22void pnp_init_resource(struct resource *res); 22void pnp_init_resource(struct resource *res);
23 23
24struct pnp_resource *pnp_get_pnp_resource(struct pnp_dev *dev,
25 unsigned int type, unsigned int num);
26
24#define PNP_MAX_PORT 40 27#define PNP_MAX_PORT 40
25#define PNP_MAX_MEM 24 28#define PNP_MAX_MEM 24
26#define PNP_MAX_IRQ 2 29#define PNP_MAX_IRQ 2
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c
index 7e9f4300e5f6..c57cfe51d52a 100644
--- a/drivers/pnp/resource.c
+++ b/drivers/pnp/resource.c
@@ -499,8 +499,8 @@ int pnp_check_dma(struct pnp_dev *dev, struct resource *res)
499#endif 499#endif
500} 500}
501 501
502struct resource *pnp_get_resource(struct pnp_dev *dev, 502struct pnp_resource *pnp_get_pnp_resource(struct pnp_dev *dev,
503 unsigned int type, unsigned int num) 503 unsigned int type, unsigned int num)
504{ 504{
505 struct pnp_resource_table *res = dev->res; 505 struct pnp_resource_table *res = dev->res;
506 506
@@ -508,22 +508,34 @@ struct resource *pnp_get_resource(struct pnp_dev *dev,
508 case IORESOURCE_IO: 508 case IORESOURCE_IO:
509 if (num >= PNP_MAX_PORT) 509 if (num >= PNP_MAX_PORT)
510 return NULL; 510 return NULL;
511 return &res->port[num].res; 511 return &res->port[num];
512 case IORESOURCE_MEM: 512 case IORESOURCE_MEM:
513 if (num >= PNP_MAX_MEM) 513 if (num >= PNP_MAX_MEM)
514 return NULL; 514 return NULL;
515 return &res->mem[num].res; 515 return &res->mem[num];
516 case IORESOURCE_IRQ: 516 case IORESOURCE_IRQ:
517 if (num >= PNP_MAX_IRQ) 517 if (num >= PNP_MAX_IRQ)
518 return NULL; 518 return NULL;
519 return &res->irq[num].res; 519 return &res->irq[num];
520 case IORESOURCE_DMA: 520 case IORESOURCE_DMA:
521 if (num >= PNP_MAX_DMA) 521 if (num >= PNP_MAX_DMA)
522 return NULL; 522 return NULL;
523 return &res->dma[num].res; 523 return &res->dma[num];
524 } 524 }
525 return NULL; 525 return NULL;
526} 526}
527
528struct resource *pnp_get_resource(struct pnp_dev *dev,
529 unsigned int type, unsigned int num)
530{
531 struct pnp_resource *pnp_res;
532
533 pnp_res = pnp_get_pnp_resource(dev, type, num);
534 if (pnp_res)
535 return &pnp_res->res;
536
537 return NULL;
538}
527EXPORT_SYMBOL(pnp_get_resource); 539EXPORT_SYMBOL(pnp_get_resource);
528 540
529/* format is: pnp_reserve_irq=irq1[,irq2] .... */ 541/* format is: pnp_reserve_irq=irq1[,irq2] .... */