aboutsummaryrefslogtreecommitdiff
path: root/drivers/pnp/interface.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2008-06-27 16:56:53 -0600
committerAndi Kleen <andi@basil.nowhere.org>2008-07-16 23:27:05 +0200
commit87e4acf3ebc02c9d0a2f7a37b655c49176c4d765 (patch)
tree1d5ee98084c9de22d2de95dad84ae23a188f6429 /drivers/pnp/interface.c
parentb897f46cf7941fff8130ccdaf85f39528bff6a51 (diff)
PNP: remove pnp_resource.index
We used pnp_resource.index to keep track of which ISAPNP configuration register a resource should be written to. We needed this only to handle the case where a register is disabled but a subsequent register in the same set is enabled. Rather than explicitly maintaining the pnp_resource.index, this patch adds a resource every time we read an ISAPNP configuration register and marks the resource as IORESOURCE_DISABLED when appropriate. This makes the position in the pnp_resource_table always correspond to the config register index. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Len Brown <len.brown@intel.com> Signed-off-by: Andi Kleen <ak@linux.intel.com>
Diffstat (limited to 'drivers/pnp/interface.c')
-rw-r--r--drivers/pnp/interface.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c
index 5695a79f3a5..3f8007ab94e 100644
--- a/drivers/pnp/interface.c
+++ b/drivers/pnp/interface.c
@@ -320,7 +320,6 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr,
const char *ubuf, size_t count)
{
struct pnp_dev *dev = to_pnp_dev(dmdev);
- struct pnp_resource *pnp_res;
char *buf = (void *)ubuf;
int retval = 0;
resource_size_t start, end;
@@ -368,7 +367,6 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr,
goto done;
}
if (!strnicmp(buf, "set", 3)) {
- int nport = 0, nmem = 0, nirq = 0, ndma = 0;
if (dev->active)
goto done;
buf += 3;
@@ -391,10 +389,7 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr,
end = simple_strtoul(buf, &buf, 0);
} else
end = start;
- pnp_res = pnp_add_io_resource(dev, start, end,
- 0);
- if (pnp_res)
- pnp_res->index = nport++;
+ pnp_add_io_resource(dev, start, end, 0);
continue;
}
if (!strnicmp(buf, "mem", 3)) {
@@ -411,10 +406,7 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr,
end = simple_strtoul(buf, &buf, 0);
} else
end = start;
- pnp_res = pnp_add_mem_resource(dev, start, end,
- 0);
- if (pnp_res)
- pnp_res->index = nmem++;
+ pnp_add_mem_resource(dev, start, end, 0);
continue;
}
if (!strnicmp(buf, "irq", 3)) {
@@ -422,9 +414,7 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr,
while (isspace(*buf))
++buf;
start = simple_strtoul(buf, &buf, 0);
- pnp_res = pnp_add_irq_resource(dev, start, 0);
- if (pnp_res)
- pnp_res->index = nirq++;
+ pnp_add_irq_resource(dev, start, 0);
continue;
}
if (!strnicmp(buf, "dma", 3)) {
@@ -432,9 +422,7 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr,
while (isspace(*buf))
++buf;
start = simple_strtoul(buf, &buf, 0);
- pnp_res = pnp_add_dma_resource(dev, start, 0);
- if (pnp_res)
- pnp_res->index = ndma++;
+ pnp_add_dma_resource(dev, start, 0);
continue;
}
break;