diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2008-04-28 18:34:32 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-04-29 03:22:28 -0400 |
commit | 21855d69d1e3ace3efdb8159a4a7ab1ab98a6f19 (patch) | |
tree | bfa5bc70ab7dabe5e4117fde96199df6c05cd261 /drivers/pnp/interface.c | |
parent | 0a977f15469457d9a19eed992caf71995c674064 (diff) |
PNP: add pnp_resource index for ISAPNP
Save the ISAPNP config register index in the struct pnp_resource.
We need this because it is important to write ISAPNP configuration
back to the same registers we read it from. For example, if we
read valid regions from memory descriptors 0, 1, and 3, we'd
better write them back to the same registers, without compressing
them to descriptors 0, 1, and 2.
This was previously guaranteed by using the index into the
pnp_resource_table array as the ISAPNP config register index.
However, I am removing those fixed-size arrays, so we need to
save the ISAPNP register index elsewhere.
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 | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c index e9e66ed4fa31..ead151242a64 100644 --- a/drivers/pnp/interface.c +++ b/drivers/pnp/interface.c | |||
@@ -320,6 +320,7 @@ 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; | ||
323 | struct resource *res; | 324 | struct resource *res; |
324 | char *buf = (void *)ubuf; | 325 | char *buf = (void *)ubuf; |
325 | int retval = 0; | 326 | int retval = 0; |
@@ -380,10 +381,12 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr, | |||
380 | buf += 2; | 381 | buf += 2; |
381 | while (isspace(*buf)) | 382 | while (isspace(*buf)) |
382 | ++buf; | 383 | ++buf; |
383 | res = pnp_get_resource(dev, IORESOURCE_IO, | 384 | pnp_res = pnp_get_pnp_resource(dev, |
384 | nport); | 385 | IORESOURCE_IO, nport); |
385 | if (!res) | 386 | if (!pnp_res) |
386 | break; | 387 | break; |
388 | pnp_res->index = nport; | ||
389 | res = &pnp_res->res; | ||
387 | res->start = simple_strtoul(buf, &buf, 0); | 390 | res->start = simple_strtoul(buf, &buf, 0); |
388 | while (isspace(*buf)) | 391 | while (isspace(*buf)) |
389 | ++buf; | 392 | ++buf; |
@@ -402,10 +405,12 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr, | |||
402 | buf += 3; | 405 | buf += 3; |
403 | while (isspace(*buf)) | 406 | while (isspace(*buf)) |
404 | ++buf; | 407 | ++buf; |
405 | res = pnp_get_resource(dev, IORESOURCE_MEM, | 408 | pnp_res = pnp_get_pnp_resource(dev, |
406 | nmem); | 409 | IORESOURCE_MEM, nmem); |
407 | if (!res) | 410 | if (!pnp_res) |
408 | break; | 411 | break; |
412 | pnp_res->index = nmem; | ||
413 | res = &pnp_res->res; | ||
409 | res->start = simple_strtoul(buf, &buf, 0); | 414 | res->start = simple_strtoul(buf, &buf, 0); |
410 | while (isspace(*buf)) | 415 | while (isspace(*buf)) |
411 | ++buf; | 416 | ++buf; |
@@ -424,10 +429,12 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr, | |||
424 | buf += 3; | 429 | buf += 3; |
425 | while (isspace(*buf)) | 430 | while (isspace(*buf)) |
426 | ++buf; | 431 | ++buf; |
427 | res = pnp_get_resource(dev, IORESOURCE_IRQ, | 432 | pnp_res = pnp_get_pnp_resource(dev, |
428 | nirq); | 433 | IORESOURCE_IRQ, nirq); |
429 | if (!res) | 434 | if (!pnp_res) |
430 | break; | 435 | break; |
436 | pnp_res->index = nirq; | ||
437 | res = &pnp_res->res; | ||
431 | res->start = res->end = | 438 | res->start = res->end = |
432 | simple_strtoul(buf, &buf, 0); | 439 | simple_strtoul(buf, &buf, 0); |
433 | res->flags = IORESOURCE_IRQ; | 440 | res->flags = IORESOURCE_IRQ; |
@@ -438,10 +445,12 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr, | |||
438 | buf += 3; | 445 | buf += 3; |
439 | while (isspace(*buf)) | 446 | while (isspace(*buf)) |
440 | ++buf; | 447 | ++buf; |
441 | res = pnp_get_resource(dev, IORESOURCE_DMA, | 448 | pnp_res = pnp_get_pnp_resource(dev, |
442 | ndma); | 449 | IORESOURCE_DMA, ndma); |
443 | if (!res) | 450 | if (!pnp_res) |
444 | break; | 451 | break; |
452 | pnp_res->index = ndma; | ||
453 | res = &pnp_res->res; | ||
445 | res->start = res->end = | 454 | res->start = res->end = |
446 | simple_strtoul(buf, &buf, 0); | 455 | simple_strtoul(buf, &buf, 0); |
447 | res->flags = IORESOURCE_DMA; | 456 | res->flags = IORESOURCE_DMA; |