diff options
Diffstat (limited to 'drivers/pnp')
-rw-r--r-- | drivers/pnp/resource.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c index c57cfe51d52a..1f4134eea7b7 100644 --- a/drivers/pnp/resource.c +++ b/drivers/pnp/resource.c | |||
@@ -538,6 +538,44 @@ struct resource *pnp_get_resource(struct pnp_dev *dev, | |||
538 | } | 538 | } |
539 | EXPORT_SYMBOL(pnp_get_resource); | 539 | EXPORT_SYMBOL(pnp_get_resource); |
540 | 540 | ||
541 | static struct pnp_resource *pnp_new_resource(struct pnp_dev *dev, int type) | ||
542 | { | ||
543 | struct pnp_resource *pnp_res; | ||
544 | int i; | ||
545 | |||
546 | switch (type) { | ||
547 | case IORESOURCE_IO: | ||
548 | for (i = 0; i < PNP_MAX_PORT; i++) { | ||
549 | pnp_res = pnp_get_pnp_resource(dev, IORESOURCE_IO, i); | ||
550 | if (pnp_res && !pnp_resource_valid(&pnp_res->res)) | ||
551 | return pnp_res; | ||
552 | } | ||
553 | break; | ||
554 | case IORESOURCE_MEM: | ||
555 | for (i = 0; i < PNP_MAX_MEM; i++) { | ||
556 | pnp_res = pnp_get_pnp_resource(dev, IORESOURCE_MEM, i); | ||
557 | if (pnp_res && !pnp_resource_valid(&pnp_res->res)) | ||
558 | return pnp_res; | ||
559 | } | ||
560 | break; | ||
561 | case IORESOURCE_IRQ: | ||
562 | for (i = 0; i < PNP_MAX_IRQ; i++) { | ||
563 | pnp_res = pnp_get_pnp_resource(dev, IORESOURCE_IRQ, i); | ||
564 | if (pnp_res && !pnp_resource_valid(&pnp_res->res)) | ||
565 | return pnp_res; | ||
566 | } | ||
567 | break; | ||
568 | case IORESOURCE_DMA: | ||
569 | for (i = 0; i < PNP_MAX_DMA; i++) { | ||
570 | pnp_res = pnp_get_pnp_resource(dev, IORESOURCE_DMA, i); | ||
571 | if (pnp_res && !pnp_resource_valid(&pnp_res->res)) | ||
572 | return pnp_res; | ||
573 | } | ||
574 | break; | ||
575 | } | ||
576 | return NULL; | ||
577 | } | ||
578 | |||
541 | /* format is: pnp_reserve_irq=irq1[,irq2] .... */ | 579 | /* format is: pnp_reserve_irq=irq1[,irq2] .... */ |
542 | static int __init pnp_setup_reserve_irq(char *str) | 580 | static int __init pnp_setup_reserve_irq(char *str) |
543 | { | 581 | { |