aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/resource.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pnp/resource.c')
-rw-r--r--drivers/pnp/resource.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c
index b2516d62fcf6..84362818fa8b 100644
--- a/drivers/pnp/resource.c
+++ b/drivers/pnp/resource.c
@@ -269,9 +269,8 @@ int pnp_check_port(struct pnp_dev *dev, struct resource *res)
269 } 269 }
270 270
271 /* check for internal conflicts */ 271 /* check for internal conflicts */
272 for (i = 0; i < PNP_MAX_PORT; i++) { 272 for (i = 0; (tres = pnp_get_resource(dev, IORESOURCE_IO, i)); i++) {
273 tres = pnp_get_resource(dev, IORESOURCE_IO, i); 273 if (tres != res && tres->flags & IORESOURCE_IO) {
274 if (tres && tres != res && tres->flags & IORESOURCE_IO) {
275 tport = &tres->start; 274 tport = &tres->start;
276 tend = &tres->end; 275 tend = &tres->end;
277 if (ranged_conflict(port, end, tport, tend)) 276 if (ranged_conflict(port, end, tport, tend))
@@ -283,9 +282,10 @@ int pnp_check_port(struct pnp_dev *dev, struct resource *res)
283 pnp_for_each_dev(tdev) { 282 pnp_for_each_dev(tdev) {
284 if (tdev == dev) 283 if (tdev == dev)
285 continue; 284 continue;
286 for (i = 0; i < PNP_MAX_PORT; i++) { 285 for (i = 0;
287 tres = pnp_get_resource(tdev, IORESOURCE_IO, i); 286 (tres = pnp_get_resource(tdev, IORESOURCE_IO, i));
288 if (tres && tres->flags & IORESOURCE_IO) { 287 i++) {
288 if (tres->flags & IORESOURCE_IO) {
289 if (cannot_compare(tres->flags)) 289 if (cannot_compare(tres->flags))
290 continue; 290 continue;
291 tport = &tres->start; 291 tport = &tres->start;
@@ -329,9 +329,8 @@ int pnp_check_mem(struct pnp_dev *dev, struct resource *res)
329 } 329 }
330 330
331 /* check for internal conflicts */ 331 /* check for internal conflicts */
332 for (i = 0; i < PNP_MAX_MEM; i++) { 332 for (i = 0; (tres = pnp_get_resource(dev, IORESOURCE_MEM, i)); i++) {
333 tres = pnp_get_resource(dev, IORESOURCE_MEM, i); 333 if (tres != res && tres->flags & IORESOURCE_MEM) {
334 if (tres && tres != res && tres->flags & IORESOURCE_MEM) {
335 taddr = &tres->start; 334 taddr = &tres->start;
336 tend = &tres->end; 335 tend = &tres->end;
337 if (ranged_conflict(addr, end, taddr, tend)) 336 if (ranged_conflict(addr, end, taddr, tend))
@@ -343,9 +342,10 @@ int pnp_check_mem(struct pnp_dev *dev, struct resource *res)
343 pnp_for_each_dev(tdev) { 342 pnp_for_each_dev(tdev) {
344 if (tdev == dev) 343 if (tdev == dev)
345 continue; 344 continue;
346 for (i = 0; i < PNP_MAX_MEM; i++) { 345 for (i = 0;
347 tres = pnp_get_resource(tdev, IORESOURCE_MEM, i); 346 (tres = pnp_get_resource(tdev, IORESOURCE_MEM, i));
348 if (tres && tres->flags & IORESOURCE_MEM) { 347 i++) {
348 if (tres->flags & IORESOURCE_MEM) {
349 if (cannot_compare(tres->flags)) 349 if (cannot_compare(tres->flags))
350 continue; 350 continue;
351 taddr = &tres->start; 351 taddr = &tres->start;
@@ -388,9 +388,8 @@ int pnp_check_irq(struct pnp_dev *dev, struct resource *res)
388 } 388 }
389 389
390 /* check for internal conflicts */ 390 /* check for internal conflicts */
391 for (i = 0; i < PNP_MAX_IRQ; i++) { 391 for (i = 0; (tres = pnp_get_resource(dev, IORESOURCE_IRQ, i)); i++) {
392 tres = pnp_get_resource(dev, IORESOURCE_IRQ, i); 392 if (tres != res && tres->flags & IORESOURCE_IRQ) {
393 if (tres && tres != res && tres->flags & IORESOURCE_IRQ) {
394 if (tres->start == *irq) 393 if (tres->start == *irq)
395 return 0; 394 return 0;
396 } 395 }
@@ -422,9 +421,10 @@ int pnp_check_irq(struct pnp_dev *dev, struct resource *res)
422 pnp_for_each_dev(tdev) { 421 pnp_for_each_dev(tdev) {
423 if (tdev == dev) 422 if (tdev == dev)
424 continue; 423 continue;
425 for (i = 0; i < PNP_MAX_IRQ; i++) { 424 for (i = 0;
426 tres = pnp_get_resource(tdev, IORESOURCE_IRQ, i); 425 (tres = pnp_get_resource(tdev, IORESOURCE_IRQ, i));
427 if (tres && tres->flags & IORESOURCE_IRQ) { 426 i++) {
427 if (tres->flags & IORESOURCE_IRQ) {
428 if (cannot_compare(tres->flags)) 428 if (cannot_compare(tres->flags))
429 continue; 429 continue;
430 if (tres->start == *irq) 430 if (tres->start == *irq)
@@ -461,9 +461,8 @@ int pnp_check_dma(struct pnp_dev *dev, struct resource *res)
461 } 461 }
462 462
463 /* check for internal conflicts */ 463 /* check for internal conflicts */
464 for (i = 0; i < PNP_MAX_DMA; i++) { 464 for (i = 0; (tres = pnp_get_resource(dev, IORESOURCE_DMA, i)); i++) {
465 tres = pnp_get_resource(dev, IORESOURCE_DMA, i); 465 if (tres != res && tres->flags & IORESOURCE_DMA) {
466 if (tres && tres != res && tres->flags & IORESOURCE_DMA) {
467 if (tres->start == *dma) 466 if (tres->start == *dma)
468 return 0; 467 return 0;
469 } 468 }
@@ -481,9 +480,10 @@ int pnp_check_dma(struct pnp_dev *dev, struct resource *res)
481 pnp_for_each_dev(tdev) { 480 pnp_for_each_dev(tdev) {
482 if (tdev == dev) 481 if (tdev == dev)
483 continue; 482 continue;
484 for (i = 0; i < PNP_MAX_DMA; i++) { 483 for (i = 0;
485 tres = pnp_get_resource(tdev, IORESOURCE_DMA, i); 484 (tres = pnp_get_resource(tdev, IORESOURCE_DMA, i));
486 if (tres && tres->flags & IORESOURCE_DMA) { 485 i++) {
486 if (tres->flags & IORESOURCE_DMA) {
487 if (cannot_compare(tres->flags)) 487 if (cannot_compare(tres->flags))
488 continue; 488 continue;
489 if (tres->start == *dma) 489 if (tres->start == *dma)