aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/resource.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2008-04-28 18:34:21 -0400
committerLen Brown <len.brown@intel.com>2008-04-29 03:22:25 -0400
commitdb9eaeab3e7ab72d773820820f1ba33960ad24c4 (patch)
tree230be670c84af99ab617d89ae89a1f115d766e0f /drivers/pnp/resource.c
parent470feb113a23de365b6051efde0d69de86d9d2f8 (diff)
PNP: check for conflicts with all resources, not just earlier ones
This patch removes a use of "idx" in pnp_check_port() and similar functions, in preparation for replacing idx with a pointer to the resource itself. I split this out because it changes the behavior slightly: we used to check for conflicts only with earlier resources, e.g., we checked resource 2 against resources 0 and 1 but not against 3, 4, etc. Now we will check against all resources except 2. Since resources are assigned in ascending order, the old behavior was probably safe, but I don't like to depend on that ordering. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Acked-By: Rene Herman <rene.herman@gmail.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/pnp/resource.c')
-rw-r--r--drivers/pnp/resource.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c
index f89945ebd8b6..eab16e5520ae 100644
--- a/drivers/pnp/resource.c
+++ b/drivers/pnp/resource.c
@@ -270,9 +270,9 @@ int pnp_check_port(struct pnp_dev *dev, int idx)
270 } 270 }
271 271
272 /* check for internal conflicts */ 272 /* check for internal conflicts */
273 for (i = 0; i < PNP_MAX_PORT && i != idx; i++) { 273 for (i = 0; i < PNP_MAX_PORT; i++) {
274 tres = &dev->res.port_resource[i]; 274 tres = &dev->res.port_resource[i];
275 if (tres->flags & IORESOURCE_IO) { 275 if (tres != res && tres->flags & IORESOURCE_IO) {
276 tport = &tres->start; 276 tport = &tres->start;
277 tend = &tres->end; 277 tend = &tres->end;
278 if (ranged_conflict(port, end, tport, tend)) 278 if (ranged_conflict(port, end, tport, tend))
@@ -331,9 +331,9 @@ int pnp_check_mem(struct pnp_dev *dev, int idx)
331 } 331 }
332 332
333 /* check for internal conflicts */ 333 /* check for internal conflicts */
334 for (i = 0; i < PNP_MAX_MEM && i != idx; i++) { 334 for (i = 0; i < PNP_MAX_MEM; i++) {
335 tres = &dev->res.mem_resource[i]; 335 tres = &dev->res.mem_resource[i];
336 if (tres->flags & IORESOURCE_MEM) { 336 if (tres != res && tres->flags & IORESOURCE_MEM) {
337 taddr = &tres->start; 337 taddr = &tres->start;
338 tend = &tres->end; 338 tend = &tres->end;
339 if (ranged_conflict(addr, end, taddr, tend)) 339 if (ranged_conflict(addr, end, taddr, tend))
@@ -391,9 +391,9 @@ int pnp_check_irq(struct pnp_dev *dev, int idx)
391 } 391 }
392 392
393 /* check for internal conflicts */ 393 /* check for internal conflicts */
394 for (i = 0; i < PNP_MAX_IRQ && i != idx; i++) { 394 for (i = 0; i < PNP_MAX_IRQ; i++) {
395 tres = &dev->res.irq_resource[i]; 395 tres = &dev->res.irq_resource[i];
396 if (tres->flags & IORESOURCE_IRQ) { 396 if (tres != res && tres->flags & IORESOURCE_IRQ) {
397 if (tres->start == *irq) 397 if (tres->start == *irq)
398 return 0; 398 return 0;
399 } 399 }
@@ -465,9 +465,9 @@ int pnp_check_dma(struct pnp_dev *dev, int idx)
465 } 465 }
466 466
467 /* check for internal conflicts */ 467 /* check for internal conflicts */
468 for (i = 0; i < PNP_MAX_DMA && i != idx; i++) { 468 for (i = 0; i < PNP_MAX_DMA; i++) {
469 tres = &dev->res.dma_resource[i]; 469 tres = &dev->res.dma_resource[i];
470 if (tres->flags & IORESOURCE_DMA) { 470 if (tres != res && tres->flags & IORESOURCE_DMA) {
471 if (tres->start == *dma) 471 if (tres->start == *dma)
472 return 0; 472 return 0;
473 } 473 }