diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2008-04-28 18:34:36 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-04-29 03:22:29 -0400 |
commit | cc8c2e308194f0997c718c7c735550ff06754d20 (patch) | |
tree | 1464d278291fd285653ff026f62c5f4f6d75286c /drivers/pnp/interface.c | |
parent | dc16f5f2ede8cc2acf8ac22857a7fecf3a4296c2 (diff) |
PNP: make generic pnp_add_io_resource()
Add a pnp_add_io_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 | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c index 00c8a970a97e..77d8bf01b485 100644 --- a/drivers/pnp/interface.c +++ b/drivers/pnp/interface.c | |||
@@ -324,7 +324,7 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr, | |||
324 | struct resource *res; | 324 | struct resource *res; |
325 | char *buf = (void *)ubuf; | 325 | char *buf = (void *)ubuf; |
326 | int retval = 0; | 326 | int retval = 0; |
327 | resource_size_t start; | 327 | resource_size_t start, end; |
328 | 328 | ||
329 | if (dev->status & PNP_ATTACHED) { | 329 | if (dev->status & PNP_ATTACHED) { |
330 | retval = -EBUSY; | 330 | retval = -EBUSY; |
@@ -382,24 +382,20 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr, | |||
382 | buf += 2; | 382 | buf += 2; |
383 | while (isspace(*buf)) | 383 | while (isspace(*buf)) |
384 | ++buf; | 384 | ++buf; |
385 | pnp_res = pnp_get_pnp_resource(dev, | 385 | start = simple_strtoul(buf, &buf, 0); |
386 | IORESOURCE_IO, nport); | ||
387 | if (!pnp_res) | ||
388 | break; | ||
389 | pnp_res->index = nport; | ||
390 | res = &pnp_res->res; | ||
391 | res->start = simple_strtoul(buf, &buf, 0); | ||
392 | while (isspace(*buf)) | 386 | while (isspace(*buf)) |
393 | ++buf; | 387 | ++buf; |
394 | if (*buf == '-') { | 388 | if (*buf == '-') { |
395 | buf += 1; | 389 | buf += 1; |
396 | while (isspace(*buf)) | 390 | while (isspace(*buf)) |
397 | ++buf; | 391 | ++buf; |
398 | res->end = simple_strtoul(buf, &buf, 0); | 392 | end = simple_strtoul(buf, &buf, 0); |
399 | } else | 393 | } else |
400 | res->end = res->start; | 394 | end = start; |
401 | res->flags = IORESOURCE_IO; | 395 | pnp_res = pnp_add_io_resource(dev, start, end, |
402 | nport++; | 396 | 0); |
397 | if (pnp_res) | ||
398 | pnp_res->index = nport++; | ||
403 | continue; | 399 | continue; |
404 | } | 400 | } |
405 | if (!strnicmp(buf, "mem", 3)) { | 401 | if (!strnicmp(buf, "mem", 3)) { |