diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2008-04-28 18:34:37 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-04-29 03:22:29 -0400 |
commit | d6180f36617953990bf90d4c1ff85b77e9995cd1 (patch) | |
tree | a9fa336f7cb1f99a62c859926c6cbcfb53f5b81e /drivers/pnp/resource.c | |
parent | cc8c2e308194f0997c718c7c735550ff06754d20 (diff) |
PNP: make generic pnp_add_mem_resource()
Add a pnp_add_mem_resource() that can be used by all the PNP
backends. This consolidates a little more pnp_resource_table
knowledge into one place.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/pnp/resource.c')
-rw-r--r-- | drivers/pnp/resource.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c index 64387b70026a..2041620d5682 100644 --- a/drivers/pnp/resource.c +++ b/drivers/pnp/resource.c | |||
@@ -657,6 +657,35 @@ struct pnp_resource *pnp_add_io_resource(struct pnp_dev *dev, | |||
657 | return pnp_res; | 657 | return pnp_res; |
658 | } | 658 | } |
659 | 659 | ||
660 | struct pnp_resource *pnp_add_mem_resource(struct pnp_dev *dev, | ||
661 | resource_size_t start, | ||
662 | resource_size_t end, int flags) | ||
663 | { | ||
664 | struct pnp_resource *pnp_res; | ||
665 | struct resource *res; | ||
666 | static unsigned char warned; | ||
667 | |||
668 | pnp_res = pnp_new_resource(dev, IORESOURCE_MEM); | ||
669 | if (!pnp_res) { | ||
670 | if (!warned) { | ||
671 | dev_err(&dev->dev, "can't add resource for MEM " | ||
672 | "%#llx-%#llx\n",(unsigned long long) start, | ||
673 | (unsigned long long) end); | ||
674 | warned = 1; | ||
675 | } | ||
676 | return NULL; | ||
677 | } | ||
678 | |||
679 | res = &pnp_res->res; | ||
680 | res->flags = IORESOURCE_MEM | flags; | ||
681 | res->start = start; | ||
682 | res->end = end; | ||
683 | |||
684 | dev_dbg(&dev->dev, " add mem %#llx-%#llx flags %#x\n", | ||
685 | (unsigned long long) start, (unsigned long long) end, flags); | ||
686 | return pnp_res; | ||
687 | } | ||
688 | |||
660 | /* format is: pnp_reserve_irq=irq1[,irq2] .... */ | 689 | /* format is: pnp_reserve_irq=irq1[,irq2] .... */ |
661 | static int __init pnp_setup_reserve_irq(char *str) | 690 | static int __init pnp_setup_reserve_irq(char *str) |
662 | { | 691 | { |