aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/legacy
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-26 11:36:35 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-26 11:36:35 -0400
commit7daf66dd142b1978bf8670d9d959d835de37476f (patch)
treed321cb9c1ec4b7052f3d31f7fd1747034e69fa35 /drivers/ide/legacy
parent2e4ed2955d0de73cd43793ff495ea027e9fd2f44 (diff)
qd65xx: return error value in qd_probe()
Return error value in qd_probe() and use it in qd65xx_init() instead of checking ide_hwifs[].chipset. Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/legacy')
-rw-r--r--drivers/ide/legacy/qd65xx.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c
index 7016bdf4fcc1..5c92fb6d81a1 100644
--- a/drivers/ide/legacy/qd65xx.c
+++ b/drivers/ide/legacy/qd65xx.c
@@ -359,7 +359,7 @@ static int __init qd_probe(int base)
359 config = inb(QD_CONFIG_PORT); 359 config = inb(QD_CONFIG_PORT);
360 360
361 if (! ((config & QD_CONFIG_BASEPORT) >> 1 == (base == 0xb0)) ) 361 if (! ((config & QD_CONFIG_BASEPORT) >> 1 == (base == 0xb0)) )
362 return 1; 362 return -ENODEV;
363 363
364 unit = ! (config & QD_CONFIG_IDE_BASEPORT); 364 unit = ! (config & QD_CONFIG_IDE_BASEPORT);
365 365
@@ -373,7 +373,8 @@ static int __init qd_probe(int base)
373 373
374 if ((config & 0xf0) == QD_CONFIG_QD6500) { 374 if ((config & 0xf0) == QD_CONFIG_QD6500) {
375 375
376 if (qd_testreg(base)) return 1; /* bad register */ 376 if (qd_testreg(base))
377 return -ENODEV; /* bad register */
377 378
378 /* qd6500 found */ 379 /* qd6500 found */
379 380
@@ -384,7 +385,7 @@ static int __init qd_probe(int base)
384 385
385 if (config & QD_CONFIG_DISABLED) { 386 if (config & QD_CONFIG_DISABLED) {
386 printk(KERN_WARNING "qd6500 is disabled !\n"); 387 printk(KERN_WARNING "qd6500 is disabled !\n");
387 return 1; 388 return -ENODEV;
388 } 389 }
389 390
390 ide_init_port_hw(hwif, &hw[unit]); 391 ide_init_port_hw(hwif, &hw[unit]);
@@ -406,8 +407,8 @@ static int __init qd_probe(int base)
406 407
407 u8 control; 408 u8 control;
408 409
409 if (qd_testreg(base) || qd_testreg(base+0x02)) return 1; 410 if (qd_testreg(base) || qd_testreg(base + 0x02))
410 /* bad registers */ 411 return -ENODEV; /* bad registers */
411 412
412 /* qd6580 found */ 413 /* qd6580 found */
413 414
@@ -469,7 +470,7 @@ static int __init qd_probe(int base)
469 } 470 }
470 } 471 }
471 /* no qd65xx found */ 472 /* no qd65xx found */
472 return 1; 473 return -ENODEV;
473} 474}
474 475
475int probe_qd65xx = 0; 476int probe_qd65xx = 0;
@@ -479,14 +480,18 @@ MODULE_PARM_DESC(probe, "probe for QD65xx chipsets");
479 480
480static int __init qd65xx_init(void) 481static int __init qd65xx_init(void)
481{ 482{
483 int rc1, rc2 = -ENODEV;
484
482 if (probe_qd65xx == 0) 485 if (probe_qd65xx == 0)
483 return -ENODEV; 486 return -ENODEV;
484 487
485 if (qd_probe(0x30)) 488 rc1 = qd_probe(0x30);
486 qd_probe(0xb0); 489 if (rc1)
487 if (ide_hwifs[0].chipset != ide_qd65xx && 490 rc2 = qd_probe(0xb0);
488 ide_hwifs[1].chipset != ide_qd65xx) 491
492 if (rc1 < 0 && rc2 < 0)
489 return -ENODEV; 493 return -ENODEV;
494
490 return 0; 495 return 0;
491} 496}
492 497