diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2008-04-28 16:34:21 -0600 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-04-29 03:22:25 -0400 |
commit | db9eaeab3e7ab72d773820820f1ba33960ad24c4 (patch) | |
tree | 230be670c84af99ab617d89ae89a1f115d766e0f /drivers | |
parent | 470feb113a23de365b6051efde0d69de86d9d2f8 (diff) | |
download | blackbird-op-linux-db9eaeab3e7ab72d773820820f1ba33960ad24c4.tar.gz blackbird-op-linux-db9eaeab3e7ab72d773820820f1ba33960ad24c4.zip |
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')
-rw-r--r-- | drivers/pnp/resource.c | 16 |
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) } /* check for internal conflicts */ - for (i = 0; i < PNP_MAX_PORT && i != idx; i++) { + for (i = 0; i < PNP_MAX_PORT; i++) { tres = &dev->res.port_resource[i]; - if (tres->flags & IORESOURCE_IO) { + if (tres != res && tres->flags & IORESOURCE_IO) { tport = &tres->start; tend = &tres->end; if (ranged_conflict(port, end, tport, tend)) @@ -331,9 +331,9 @@ int pnp_check_mem(struct pnp_dev *dev, int idx) } /* check for internal conflicts */ - for (i = 0; i < PNP_MAX_MEM && i != idx; i++) { + for (i = 0; i < PNP_MAX_MEM; i++) { tres = &dev->res.mem_resource[i]; - if (tres->flags & IORESOURCE_MEM) { + if (tres != res && tres->flags & IORESOURCE_MEM) { taddr = &tres->start; tend = &tres->end; if (ranged_conflict(addr, end, taddr, tend)) @@ -391,9 +391,9 @@ int pnp_check_irq(struct pnp_dev *dev, int idx) } /* check for internal conflicts */ - for (i = 0; i < PNP_MAX_IRQ && i != idx; i++) { + for (i = 0; i < PNP_MAX_IRQ; i++) { tres = &dev->res.irq_resource[i]; - if (tres->flags & IORESOURCE_IRQ) { + if (tres != res && tres->flags & IORESOURCE_IRQ) { if (tres->start == *irq) return 0; } @@ -465,9 +465,9 @@ int pnp_check_dma(struct pnp_dev *dev, int idx) } /* check for internal conflicts */ - for (i = 0; i < PNP_MAX_DMA && i != idx; i++) { + for (i = 0; i < PNP_MAX_DMA; i++) { tres = &dev->res.dma_resource[i]; - if (tres->flags & IORESOURCE_DMA) { + if (tres != res && tres->flags & IORESOURCE_DMA) { if (tres->start == *dma) return 0; } |