All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: linux-ide@vger.kernel.org
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 8/9] qd65xx: return error value in qd_probe()
Date: Sat, 16 Feb 2008 21:27:22 +0100	[thread overview]
Message-ID: <20080216202722.25536.36800.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20080216202634.25536.78915.sendpatchset@localhost.localdomain>

Return error value in qd_probe() and use it in qd65xx_init()
instead of checking ide_hwifs[].chipset.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/legacy/qd65xx.c |   25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

Index: b/drivers/ide/legacy/qd65xx.c
===================================================================
--- a/drivers/ide/legacy/qd65xx.c
+++ b/drivers/ide/legacy/qd65xx.c
@@ -396,7 +396,7 @@ static int __init qd_probe(int base)
 	config = inb(QD_CONFIG_PORT);
 
 	if (! ((config & QD_CONFIG_BASEPORT) >> 1 == (base == 0xb0)) )
-		return 1;
+		return -ENODEV;
 
 	unit = ! (config & QD_CONFIG_IDE_BASEPORT);
 
@@ -410,7 +410,8 @@ static int __init qd_probe(int base)
 
 	if ((config & 0xf0) == QD_CONFIG_QD6500) {
 
-		if (qd_testreg(base)) return 1;		/* bad register */
+		if (qd_testreg(base))
+			 return -ENODEV;	/* bad register */
 
 		/* qd6500 found */
 
@@ -421,7 +422,7 @@ static int __init qd_probe(int base)
 		
 		if (config & QD_CONFIG_DISABLED) {
 			printk(KERN_WARNING "qd6500 is disabled !\n");
-			return 1;
+			return -ENODEV;
 		}
 
 		ide_init_port_hw(hwif, &hw[unit]);
@@ -443,8 +444,8 @@ static int __init qd_probe(int base)
 
 		u8 control;
 
-		if (qd_testreg(base) || qd_testreg(base+0x02)) return 1;
-			/* bad registers */
+		if (qd_testreg(base) || qd_testreg(base + 0x02))
+			return -ENODEV;	/* bad registers */
 
 		/* qd6580 found */
 
@@ -508,7 +509,7 @@ static int __init qd_probe(int base)
 		}
 	}
 	/* no qd65xx found */
-	return 1;
+	return -ENODEV;
 }
 
 int probe_qd65xx = 0;
@@ -518,14 +519,18 @@ MODULE_PARM_DESC(probe, "probe for QD65x
 
 static int __init qd65xx_init(void)
 {
+	int rc1, rc2 = -ENODEV;
+
 	if (probe_qd65xx == 0)
 		return -ENODEV;
 
-	if (qd_probe(0x30))
-		qd_probe(0xb0);
-	if (ide_hwifs[0].chipset != ide_qd65xx &&
-	    ide_hwifs[1].chipset != ide_qd65xx)
+	rc1 = qd_probe(0x30);
+	if (rc1)
+		rc2 = qd_probe(0xb0);
+
+	if (rc1 < 0 && rc2 < 0)
 		return -ENODEV;
+
 	return 0;
 }
 

  parent reply	other threads:[~2008-02-16 20:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-16 20:26 [PATCH 1/9] sgiioc4: use ide_find_port() Bartlomiej Zolnierkiewicz
2008-02-16 20:26 ` [PATCH 2/9] au1xxx-ide: " Bartlomiej Zolnierkiewicz
2008-02-16 20:26 ` [PATCH 3/9] cmd640: remove cmd_drives[] Bartlomiej Zolnierkiewicz
2008-02-16 20:26 ` [PATCH 4/9] cmd640: use ide_find_port() Bartlomiej Zolnierkiewicz
2008-02-16 20:27 ` [PATCH 5/9] scc_pata: store 'hwif' pointer in struct scc_ports Bartlomiej Zolnierkiewicz
2008-02-16 20:27 ` [PATCH 6/9] umc8672: don't use ide_hwifs[] in umc_set_pio_mode() Bartlomiej Zolnierkiewicz
2008-02-16 20:27 ` [PATCH 7/9] ht6560b: use driver name for resource allocation Bartlomiej Zolnierkiewicz
2008-02-18 15:24   ` Sergei Shtylyov
2008-02-16 20:27 ` Bartlomiej Zolnierkiewicz [this message]
2008-02-18 17:00   ` [PATCH 8/9] qd65xx: return error value in qd_probe() Sergei Shtylyov
2008-02-16 20:27 ` [PATCH 9/9] ide: IDE_HFLAG_BOOTABLE -> IDE_HFLAG_NON_BOOTABLE Bartlomiej Zolnierkiewicz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080216202722.25536.36800.sendpatchset@localhost.localdomain \
    --to=bzolnier@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.