diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2008-06-27 18:56:53 -0400 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2008-07-16 17:27:05 -0400 |
commit | 87e4acf3ebc02c9d0a2f7a37b655c49176c4d765 (patch) | |
tree | 1d5ee98084c9de22d2de95dad84ae23a188f6429 /drivers/pnp/interface.c | |
parent | b897f46cf7941fff8130ccdaf85f39528bff6a51 (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.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c index 5695a79f3a52..3f8007ab94e3 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, | |||
320 | const char *ubuf, size_t count) | 320 | const char *ubuf, size_t count) |
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; | ||
324 | char *buf = (void *)ubuf; | 323 | char *buf = (void *)ubuf; |
325 | int retval = 0; | 324 | int retval = 0; |
326 | resource_size_t start, end; | 325 | resource_size_t start, end; |
@@ -368,7 +367,6 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr, | |||
368 | goto done; | 367 | goto done; |
369 | } | 368 | } |
370 | if (!strnicmp(buf, "set", 3)) { | 369 | if (!strnicmp(buf, "set", 3)) { |
371 | int nport = 0, nmem = 0, nirq = 0, ndma = 0; | ||
372 | if (dev->active) | 370 | if (dev->active) |
373 | goto done; | 371 | goto done; |
374 | buf += 3; | 372 | buf += 3; |
@@ -391,10 +389,7 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr, | |||
391 | end = simple_strtoul(buf, &buf, 0); | 389 | end = simple_strtoul(buf, &buf, 0); |
392 | } else | 390 | } else |
393 | end = start; | 391 | end = start; |
394 | pnp_res = pnp_add_io_resource(dev, start, end, | 392 | pnp_add_io_resource(dev, start, end, 0); |
395 | 0); | ||
396 | if (pnp_res) | ||
397 | pnp_res->index = nport++; | ||
398 | continue; | 393 | continue; |
399 | } | 394 | } |
400 | if (!strnicmp(buf, "mem", 3)) { | 395 | if (!strnicmp(buf, "mem", 3)) { |
@@ -411,10 +406,7 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr, | |||
411 | end = simple_strtoul(buf, &buf, 0); | 406 | end = simple_strtoul(buf, &buf, 0); |
412 | } else | 407 | } else |
413 | end = start; | 408 | end = start; |
414 | pnp_res = pnp_add_mem_resource(dev, start, end, | 409 | pnp_add_mem_resource(dev, start, end, 0); |
415 | 0); | ||
416 | if (pnp_res) | ||
417 | pnp_res->index = nmem++; | ||
418 | continue; | 410 | continue; |
419 | } | 411 | } |
420 | if (!strnicmp(buf, "irq", 3)) { | 412 | if (!strnicmp(buf, "irq", 3)) { |
@@ -422,9 +414,7 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr, | |||
422 | while (isspace(*buf)) | 414 | while (isspace(*buf)) |
423 | ++buf; | 415 | ++buf; |
424 | start = simple_strtoul(buf, &buf, 0); | 416 | start = simple_strtoul(buf, &buf, 0); |
425 | pnp_res = pnp_add_irq_resource(dev, start, 0); | 417 | pnp_add_irq_resource(dev, start, 0); |
426 | if (pnp_res) | ||
427 | pnp_res->index = nirq++; | ||
428 | continue; | 418 | continue; |
429 | } | 419 | } |
430 | if (!strnicmp(buf, "dma", 3)) { | 420 | if (!strnicmp(buf, "dma", 3)) { |
@@ -432,9 +422,7 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr, | |||
432 | while (isspace(*buf)) | 422 | while (isspace(*buf)) |
433 | ++buf; | 423 | ++buf; |
434 | start = simple_strtoul(buf, &buf, 0); | 424 | start = simple_strtoul(buf, &buf, 0); |
435 | pnp_res = pnp_add_dma_resource(dev, start, 0); | 425 | pnp_add_dma_resource(dev, start, 0); |
436 | if (pnp_res) | ||
437 | pnp_res->index = ndma++; | ||
438 | continue; | 426 | continue; |
439 | } | 427 | } |
440 | break; | 428 | break; |