linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: jgarzik@pobox.com, linux-ide@vger.kernel.org, albertcc@tw.ibm.com
Cc: Tejun Heo <htejun@gmail.com>
Subject: [PATCH 02/12] libata: modify ata_dev_try_classify
Date: Tue, 24 Jan 2006 17:05:22 +0900	[thread overview]
Message-ID: <11380899223675-git-send-email-htejun@gmail.com> (raw)
In-Reply-To: <1138089921565-git-send-email-htejun@gmail.com>

Make ata_dev_try_classify take @r_err to store tf error register value
on completion and return device class instead of directly manipulating
dev->class.  This is preparation for new reset mechanism.

Signed-off-by: Tejun Heo <htejun@gmail.com>

---

 drivers/scsi/libata-core.c |   30 ++++++++++++++++--------------
 1 files changed, 16 insertions(+), 14 deletions(-)

0ac93b37ce5955cee51d85fa2810cb40b8909c33
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index bc13729..e10169d 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -830,6 +830,7 @@ unsigned int ata_dev_classify(const stru
  *	ata_dev_try_classify - Parse returned ATA device signature
  *	@ap: ATA channel to examine
  *	@device: Device to examine (starting at zero)
+ *	@r_err: Value of error register on completion
  *
  *	After an event -- SRST, E.D.D., or SATA COMRESET -- occurs,
  *	an ATA/ATAPI-defined set of values is placed in the ATA
@@ -842,11 +843,14 @@ unsigned int ata_dev_classify(const stru
  *
  *	LOCKING:
  *	caller.
+ *
+ *	RETURNS:
+ *	Device type - %ATA_DEV_ATA, %ATA_DEV_ATAPI or %ATA_DEV_NONE.
  */
 
-static u8 ata_dev_try_classify(struct ata_port *ap, unsigned int device)
+static unsigned int
+ata_dev_try_classify(struct ata_port *ap, unsigned int device, u8 *r_err)
 {
-	struct ata_device *dev = &ap->device[device];
 	struct ata_taskfile tf;
 	unsigned int class;
 	u8 err;
@@ -857,8 +861,8 @@ static u8 ata_dev_try_classify(struct at
 
 	ap->ops->tf_read(ap, &tf);
 	err = tf.feature;
-
-	dev->class = ATA_DEV_NONE;
+	if (r_err)
+		*r_err = err;
 
 	/* see if device passed diags */
 	if (err == 1)
@@ -866,18 +870,16 @@ static u8 ata_dev_try_classify(struct at
 	else if ((device == 0) && (err == 0x81))
 		/* do nothing */ ;
 	else
-		return err;
+		return ATA_DEV_NONE;
 
-	/* determine if device if ATA or ATAPI */
+	/* determine if device is ATA or ATAPI */
 	class = ata_dev_classify(&tf);
+
 	if (class == ATA_DEV_UNKNOWN)
-		return err;
+		return ATA_DEV_NONE;
 	if ((class == ATA_DEV_ATA) && (ata_chk_status(ap) == 0))
-		return err;
-
-	dev->class = class;
-
-	return err;
+		return ATA_DEV_NONE;
+	return class;
 }
 
 /**
@@ -2224,9 +2226,9 @@ void ata_bus_reset(struct ata_port *ap)
 	/*
 	 * determine by signature whether we have ATA or ATAPI devices
 	 */
-	err = ata_dev_try_classify(ap, 0);
+	ap->device[0].class = ata_dev_try_classify(ap, 0, &err);
 	if ((slave_possible) && (err != 0x81))
-		ata_dev_try_classify(ap, 1);
+		ap->device[1].class = ata_dev_try_classify(ap, 1, &err);
 
 	/* re-enable interrupts */
 	if (ap->ioaddr.ctl_addr)	/* FIXME: hack. create a hook instead */
-- 
1.1.3



  parent reply	other threads:[~2006-01-24  8:05 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-24  8:05 [PATCHSET] libata: new reset mechanism, take#2 Tejun Heo
2006-01-24  8:05 ` [PATCH 01/12] libata: export ata_busy_sleep Tejun Heo
2006-01-27  4:18   ` Jeff Garzik
2006-01-24  8:05 ` [PATCH 05/12] libata: implement standard reset component operations and ->probe_reset Tejun Heo
2006-01-28  1:58   ` Jeff Garzik
2006-01-24  8:05 ` [PATCH 09/12] ata_piix: convert pata to new reset mechanism Tejun Heo
2006-01-24  8:05 ` [PATCH 12/12] ahci: add softreset Tejun Heo
2006-01-24  8:05 ` [PATCH 06/12] sata_sil: convert to new reset mechanism Tejun Heo
2006-01-28 18:09   ` Jeff Garzik
2006-01-28 18:27     ` Jeff Garzik
2006-01-28 23:17     ` Tejun
2006-01-29  2:41       ` Jeff Garzik
2006-01-24  8:05 ` [PATCH 03/12] libata: new ->probe_reset operation Tejun Heo
2006-01-24  8:05 ` [PATCH 08/12] sata_sil24: add hardreset Tejun Heo
2006-01-24  8:05 ` [PATCH 04/12] libata: implement ata_drive_probe_reset() Tejun Heo
2006-01-28  1:58   ` Jeff Garzik
2006-01-24  8:05 ` [PATCH 10/12] ata_piix: convert sata to new reset mechanism Tejun Heo
2006-01-24  8:05 ` [PATCH 11/12] ahci: convert " Tejun Heo
2006-01-24  8:05 ` Tejun Heo [this message]
2006-01-27  4:20   ` [PATCH 02/12] libata: modify ata_dev_try_classify Jeff Garzik
2006-01-24  8:05 ` [PATCH 07/12] sata_sil24: convert to new reset mechanism Tejun Heo

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=11380899223675-git-send-email-htejun@gmail.com \
    --to=htejun@gmail.com \
    --cc=albertcc@tw.ibm.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-ide@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).