diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2008-04-28 18:34:14 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-04-29 03:22:23 -0400 |
commit | b90eca0a61ebd010036242e29610bc6a909e3f19 (patch) | |
tree | 7f92620157786997dc0123b75b8c38b61e8dd2be /drivers/pnp | |
parent | d948a8daa059cf5b3e7f002e7b92acf00fc70c49 (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')
-rw-r--r-- | drivers/pnp/resource.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c index eee6d8eddcb4..ef8835ec5778 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) | |||
487 | #endif | 487 | #endif |
488 | } | 488 | } |
489 | 489 | ||
490 | struct resource *pnp_get_resource(struct pnp_dev *dev, | ||
491 | unsigned int type, unsigned int num) | ||
492 | { | ||
493 | struct pnp_resource_table *res = &dev->res; | ||
494 | |||
495 | switch (type) { | ||
496 | case IORESOURCE_IO: | ||
497 | if (num >= PNP_MAX_PORT) | ||
498 | return NULL; | ||
499 | return &res->port_resource[num]; | ||
500 | case IORESOURCE_MEM: | ||
501 | if (num >= PNP_MAX_MEM) | ||
502 | return NULL; | ||
503 | return &res->mem_resource[num]; | ||
504 | case IORESOURCE_IRQ: | ||
505 | if (num >= PNP_MAX_IRQ) | ||
506 | return NULL; | ||
507 | return &res->irq_resource[num]; | ||
508 | case IORESOURCE_DMA: | ||
509 | if (num >= PNP_MAX_DMA) | ||
510 | return NULL; | ||
511 | return &res->dma_resource[num]; | ||
512 | } | ||
513 | return NULL; | ||
514 | } | ||
515 | EXPORT_SYMBOL(pnp_get_resource); | ||
516 | |||
490 | /* format is: pnp_reserve_irq=irq1[,irq2] .... */ | 517 | /* format is: pnp_reserve_irq=irq1[,irq2] .... */ |
491 | static int __init pnp_setup_reserve_irq(char *str) | 518 | static int __init pnp_setup_reserve_irq(char *str) |
492 | { | 519 | { |