diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2008-04-28 16:34:37 -0600 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-04-29 03:22:29 -0400 |
commit | d6180f36617953990bf90d4c1ff85b77e9995cd1 (patch) | |
tree | a9fa336f7cb1f99a62c859926c6cbcfb53f5b81e /drivers/pnp/pnpacpi | |
parent | cc8c2e308194f0997c718c7c735550ff06754d20 (diff) | |
download | op-kernel-dev-d6180f36617953990bf90d4c1ff85b77e9995cd1.zip op-kernel-dev-d6180f36617953990bf90d4c1ff85b77e9995cd1.tar.gz |
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/pnpacpi')
-rw-r--r-- | drivers/pnp/pnpacpi/rsparser.c | 34 |
1 files changed, 9 insertions, 25 deletions
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index d3ca8e0..a512908b 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c @@ -173,34 +173,18 @@ static void pnpacpi_parse_allocated_ioresource(struct pnp_dev *dev, u64 start, } static void pnpacpi_parse_allocated_memresource(struct pnp_dev *dev, - u64 mem, u64 len, + u64 start, u64 len, int write_protect) { - struct resource *res; - int i; - static unsigned char warned; + int flags = 0; + u64 end = start + len - 1; - for (i = 0; i < PNP_MAX_MEM; i++) { - res = pnp_get_resource(dev, IORESOURCE_MEM, i); - if (!pnp_resource_valid(res)) - break; - } - if (i < PNP_MAX_MEM) { - res->flags = IORESOURCE_MEM; // Also clears _UNSET flag - if (len <= 0) { - res->flags |= IORESOURCE_DISABLED; - return; - } - if (write_protect == ACPI_READ_WRITE_MEMORY) - res->flags |= IORESOURCE_MEM_WRITEABLE; - - res->start = mem; - res->end = mem + len - 1; - } else if (!warned) { - printk(KERN_WARNING "pnpacpi: exceeded the max number of mem " - "resources: %d\n", PNP_MAX_MEM); - warned = 1; - } + if (len == 0) + flags |= IORESOURCE_DISABLED; + if (write_protect == ACPI_READ_WRITE_MEMORY) + flags |= IORESOURCE_MEM_WRITEABLE; + + pnp_add_mem_resource(dev, start, end, flags); } static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev, |