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/interface.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/interface.c')
-rw-r--r-- | drivers/pnp/interface.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c index 77d8bf01b485..5d9301de1778 100644 --- a/drivers/pnp/interface.c +++ b/drivers/pnp/interface.c | |||
@@ -321,7 +321,6 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr, | |||
321 | { | 321 | { |
322 | struct pnp_dev *dev = to_pnp_dev(dmdev); | 322 | struct pnp_dev *dev = to_pnp_dev(dmdev); |
323 | struct pnp_resource *pnp_res; | 323 | struct pnp_resource *pnp_res; |
324 | struct resource *res; | ||
325 | char *buf = (void *)ubuf; | 324 | char *buf = (void *)ubuf; |
326 | int retval = 0; | 325 | int retval = 0; |
327 | resource_size_t start, end; | 326 | resource_size_t start, end; |
@@ -402,24 +401,20 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr, | |||
402 | buf += 3; | 401 | buf += 3; |
403 | while (isspace(*buf)) | 402 | while (isspace(*buf)) |
404 | ++buf; | 403 | ++buf; |
405 | pnp_res = pnp_get_pnp_resource(dev, | 404 | start = simple_strtoul(buf, &buf, 0); |
406 | IORESOURCE_MEM, nmem); | ||
407 | if (!pnp_res) | ||
408 | break; | ||
409 | pnp_res->index = nmem; | ||
410 | res = &pnp_res->res; | ||
411 | res->start = simple_strtoul(buf, &buf, 0); | ||
412 | while (isspace(*buf)) | 405 | while (isspace(*buf)) |
413 | ++buf; | 406 | ++buf; |
414 | if (*buf == '-') { | 407 | if (*buf == '-') { |
415 | buf += 1; | 408 | buf += 1; |
416 | while (isspace(*buf)) | 409 | while (isspace(*buf)) |
417 | ++buf; | 410 | ++buf; |
418 | res->end = simple_strtoul(buf, &buf, 0); | 411 | end = simple_strtoul(buf, &buf, 0); |
419 | } else | 412 | } else |
420 | res->end = res->start; | 413 | end = start; |
421 | res->flags = IORESOURCE_MEM; | 414 | pnp_res = pnp_add_mem_resource(dev, start, end, |
422 | nmem++; | 415 | 0); |
416 | if (pnp_res) | ||
417 | pnp_res->index = nmem++; | ||
423 | continue; | 418 | continue; |
424 | } | 419 | } |
425 | if (!strnicmp(buf, "irq", 3)) { | 420 | if (!strnicmp(buf, "irq", 3)) { |