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: default avatarSergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent 2e4ed295
...@@ -359,7 +359,7 @@ static int __init qd_probe(int base) ...@@ -359,7 +359,7 @@ static int __init qd_probe(int base)
config = inb(QD_CONFIG_PORT); config = inb(QD_CONFIG_PORT);
if (! ((config & QD_CONFIG_BASEPORT) >> 1 == (base == 0xb0)) ) if (! ((config & QD_CONFIG_BASEPORT) >> 1 == (base == 0xb0)) )
return 1; return -ENODEV;
unit = ! (config & QD_CONFIG_IDE_BASEPORT); unit = ! (config & QD_CONFIG_IDE_BASEPORT);
...@@ -373,7 +373,8 @@ static int __init qd_probe(int base) ...@@ -373,7 +373,8 @@ static int __init qd_probe(int base)
if ((config & 0xf0) == QD_CONFIG_QD6500) { if ((config & 0xf0) == QD_CONFIG_QD6500) {
if (qd_testreg(base)) return 1; /* bad register */ if (qd_testreg(base))
return -ENODEV; /* bad register */
/* qd6500 found */ /* qd6500 found */
...@@ -384,7 +385,7 @@ static int __init qd_probe(int base) ...@@ -384,7 +385,7 @@ static int __init qd_probe(int base)
if (config & QD_CONFIG_DISABLED) { if (config & QD_CONFIG_DISABLED) {
printk(KERN_WARNING "qd6500 is disabled !\n"); printk(KERN_WARNING "qd6500 is disabled !\n");
return 1; return -ENODEV;
} }
ide_init_port_hw(hwif, &hw[unit]); ide_init_port_hw(hwif, &hw[unit]);
...@@ -406,8 +407,8 @@ static int __init qd_probe(int base) ...@@ -406,8 +407,8 @@ static int __init qd_probe(int base)
u8 control; u8 control;
if (qd_testreg(base) || qd_testreg(base+0x02)) return 1; if (qd_testreg(base) || qd_testreg(base + 0x02))
/* bad registers */ return -ENODEV; /* bad registers */
/* qd6580 found */ /* qd6580 found */
...@@ -469,7 +470,7 @@ static int __init qd_probe(int base) ...@@ -469,7 +470,7 @@ static int __init qd_probe(int base)
} }
} }
/* no qd65xx found */ /* no qd65xx found */
return 1; return -ENODEV;
} }
int probe_qd65xx = 0; int probe_qd65xx = 0;
...@@ -479,14 +480,18 @@ MODULE_PARM_DESC(probe, "probe for QD65xx chipsets"); ...@@ -479,14 +480,18 @@ MODULE_PARM_DESC(probe, "probe for QD65xx chipsets");
static int __init qd65xx_init(void) static int __init qd65xx_init(void)
{ {
int rc1, rc2 = -ENODEV;
if (probe_qd65xx == 0) if (probe_qd65xx == 0)
return -ENODEV; return -ENODEV;
if (qd_probe(0x30)) rc1 = qd_probe(0x30);
qd_probe(0xb0); if (rc1)
if (ide_hwifs[0].chipset != ide_qd65xx && rc2 = qd_probe(0xb0);
ide_hwifs[1].chipset != ide_qd65xx)
if (rc1 < 0 && rc2 < 0)
return -ENODEV; return -ENODEV;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment