summaryrefslogtreecommitdiff
path: root/drivers/pnp/interface.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2008-04-28 16:34:36 -0600
committerLen Brown <len.brown@intel.com>2008-04-29 03:22:29 -0400
commitcc8c2e308194f0997c718c7c735550ff06754d20 (patch)
tree1464d278291fd285653ff026f62c5f4f6d75286c /drivers/pnp/interface.c
parentdc16f5f2ede8cc2acf8ac22857a7fecf3a4296c2 (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.c20
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,
struct resource *res;
char *buf = (void *)ubuf;
int retval = 0;
- resource_size_t start;
+ resource_size_t start, end;
if (dev->status & PNP_ATTACHED) {
retval = -EBUSY;
@@ -382,24 +382,20 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr,
buf += 2;
while (isspace(*buf))
++buf;
- pnp_res = pnp_get_pnp_resource(dev,
- IORESOURCE_IO, nport);
- if (!pnp_res)
- break;
- pnp_res->index = nport;
- res = &pnp_res->res;
- res->start = simple_strtoul(buf, &buf, 0);
+ start = simple_strtoul(buf, &buf, 0);
while (isspace(*buf))
++buf;
if (*buf == '-') {
buf += 1;
while (isspace(*buf))
++buf;
- res->end = simple_strtoul(buf, &buf, 0);
+ end = simple_strtoul(buf, &buf, 0);
} else
- res->end = res->start;
- res->flags = IORESOURCE_IO;
- nport++;
+ end = start;
+ pnp_res = pnp_add_io_resource(dev, start, end,
+ 0);
+ if (pnp_res)
+ pnp_res->index = nport++;
continue;
}
if (!strnicmp(buf, "mem", 3)) {