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, alan@lxorguk.ukuu.org.uk
Cc: Tejun Heo <htejun@gmail.com>
Subject: [PATCH 12/16] libata: reorganize ata_bus_probe()
Date: Fri, 27 Jan 2006 00:39:11 +0900	[thread overview]
Message-ID: <11382899511457-git-send-email-htejun@gmail.com> (raw)
In-Reply-To: <1138289951261-git-send-email-htejun@gmail.com>

Now that reset and configure are converted such that they don't modify
or disable libata core data structures, reorganize ata_bus_probe() to
reflect this change.

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

---

 drivers/scsi/libata-core.c |   39 +++++++++++++++++++++------------------
 1 files changed, 21 insertions(+), 18 deletions(-)

20afcd17a5a534cf8ca54b381822368d8eb69ba2
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 7bc3a59..ab6b38c 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -1587,32 +1587,36 @@ err_out_nosup:
 
 static int ata_bus_probe(struct ata_port *ap)
 {
-	unsigned int i, found = 0;
+	unsigned int classes[ATA_MAX_DEVICES];
+	unsigned int i, rc, found = 0;
 
-	if (ap->ops->probe_reset) {
-		unsigned int classes[ATA_MAX_DEVICES];
-		int rc;
-
-		ata_port_probe(ap);
+	ata_port_probe(ap);
 
+	/* reset */
+	if (ap->ops->probe_reset) {
 		rc = ap->ops->probe_reset(ap, classes);
-		if (rc == 0) {
-			for (i = 0; i < ATA_MAX_DEVICES; i++)
-				ap->device[i].class = classes[i];
-		} else {
-			printk(KERN_ERR "ata%u: probe reset failed, "
-			       "disabling port\n", ap->id);
-			ata_port_disable(ap);
+		if (rc) {
+			printk("ata%u: reset failed (errno=%d)\n", ap->id, rc);
+			return rc;
 		}
-	} else
+	} else {
 		ap->ops->phy_reset(ap);
 
-	if (ap->flags & ATA_FLAG_PORT_DISABLED)
-		goto err_out;
+		for (i = 0; i < ATA_MAX_DEVICES; i++) {
+			if (!(ap->flags & ATA_FLAG_PORT_DISABLED))
+				classes[i] = ap->device[i].class;
+			else
+				ap->device[i].class = ATA_DEV_UNKNOWN;
+		}
+		ata_port_probe(ap);
+	}
 
+	/* read IDENTIFY page and configure devices */
 	for (i = 0; i < ATA_MAX_DEVICES; i++) {
 		struct ata_device *dev = &ap->device[i];
 
+		dev->class = classes[i];
+
 		if (!ata_dev_present(dev))
 			continue;
 
@@ -1629,7 +1633,7 @@ static int ata_bus_probe(struct ata_port
 		found = 1;
 	}
 
-	if ((!found) || (ap->flags & ATA_FLAG_PORT_DISABLED))
+	if (!found)
 		goto err_out_disable;
 
 	ata_set_mode(ap);
@@ -1640,7 +1644,6 @@ static int ata_bus_probe(struct ata_port
 
 err_out_disable:
 	ap->ops->port_disable(ap);
-err_out:
 	return -1;
 }
 
-- 
1.1.3



  parent reply	other threads:[~2006-01-26 15:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-26 15:39 [PATCHSET] libata: reorganize configuration and implement revalidation Tejun Heo
2006-01-26 15:39 ` [PATCH 02/16] libata: use ata_dev_id_c_string() Tejun Heo
2006-01-26 15:39 ` [PATCH 07/16] libata: convert dev->id to pointer Tejun Heo
2006-01-26 15:39 ` [PATCH 05/16] libata: make ata_dump_id() take @id instead of @dev Tejun Heo
2006-01-26 15:39 ` [PATCH 01/16] libata: implement ata_dev_id_c_string() Tejun Heo
2006-01-26 15:39 ` [PATCH 11/16] libata: fold ata_dev_config() into ata_dev_configure() Tejun Heo
2006-01-26 15:39 ` [PATCH 09/16] libata: kill ata_dev_reread_id() Tejun Heo
2006-01-26 15:39 ` [PATCH 04/16] libata: separate out ata_id_major_version() Tejun Heo
2006-01-26 15:39 ` Tejun Heo [this message]
2006-01-26 15:39 ` [PATCH 13/16] libata: re-initialize parameters before configuring Tejun Heo
2006-01-26 15:39 ` [PATCH 15/16] libata: implement ata_dev_revalidate() Tejun Heo
2006-01-26 15:39 ` [PATCH 16/16] libata: revalidate after transfer mode configuration Tejun Heo
2006-01-26 17:42 ` [PATCHSET] libata: reorganize configuration and implement revalidation Mark Lord

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=11382899511457-git-send-email-htejun@gmail.com \
    --to=htejun@gmail.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --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).