All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: jgarzik@pobox.com, albertcc@tw.ibm.com, alan@lxorguk.ukuu.org.uk,
	linux-ide@vger.kernel.org
Cc: Tejun Heo <htejun@gmail.com>
Subject: [PATCH 2/4] libata: implement ata_dev_init()
Date: Sun, 12 Mar 2006 16:02:35 +0900	[thread overview]
Message-ID: <11421469552851-git-send-email-htejun@gmail.com> (raw)
In-Reply-To: <11421469551948-git-send-email-htejun@gmail.com>

Implement ata_dev_init() which is called before probing for new
device.  Note that ata_dev_init() is called only once for each
attached device while ata_dev_configure() can be called multiple times
for the same device.

This change will be used by following per-dev xfer_mask patch.

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

---

 drivers/scsi/libata-core.c |   33 +++++++++++++++++++++++++--------
 1 files changed, 25 insertions(+), 8 deletions(-)

85ebfaba5b9f0c02afa9a3a2bde8eb6bf14380d4
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 96954c7..eef67f5 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -1042,6 +1042,25 @@ unsigned int ata_pio_need_iordy(const st
 }
 
 /**
+ *	ata_dev_init - initialize ata_device structure
+ *	@ap: Port on which target device resides
+ *	@dev: Target device to initialize
+ *
+ *	Initialize @dev in preparation for device probing.  This
+ *	function is called only when a new device is about to be
+ *	probed.  ie. ata_dev_configure() is responsible for cleaning
+ *	up affected fields across revalidations.
+ *
+ *	LOCKING:
+ *	none.
+ */
+static void ata_dev_init(struct ata_port *ap, struct ata_device *dev)
+{
+	memset(dev, 0, sizeof(*dev));
+	dev->devno = dev - ap->device;
+}
+
+/**
  *	ata_dev_read_id - Read ID data from the specified device
  *	@ap: port on which target device resides
  *	@dev: target device
@@ -1367,11 +1386,14 @@ static int ata_bus_probe(struct ata_port
 
 	ata_port_probe(ap);
 
+	/* initialize devices and classes */
+	for (i = 0; i < ATA_MAX_DEVICES; i++) {
+		ata_dev_init(ap, &ap->device[i]);
+		classes[i] = ATA_DEV_UNKNOWN;
+	}
+
 	/* reset */
 	if (ap->ops->probe_reset) {
-		for (i = 0; i < ATA_MAX_DEVICES; i++)
-			classes[i] = ATA_DEV_UNKNOWN;
-
 		rc = ap->ops->probe_reset(ap, classes);
 		if (rc) {
 			printk("ata%u: reset failed (errno=%d)\n", ap->id, rc);
@@ -4606,8 +4628,6 @@ static void ata_host_init(struct ata_por
 			  struct ata_host_set *host_set,
 			  const struct ata_probe_ent *ent, unsigned int port_no)
 {
-	unsigned int i;
-
 	host->max_id = 16;
 	host->max_lun = 1;
 	host->max_channel = 1;
@@ -4634,9 +4654,6 @@ static void ata_host_init(struct ata_por
 	INIT_WORK(&ap->port_task, NULL, NULL);
 	INIT_LIST_HEAD(&ap->eh_done_q);
 
-	for (i = 0; i < ATA_MAX_DEVICES; i++)
-		ap->device[i].devno = i;
-
 #ifdef ATA_IRQ_TRAP
 	ap->stats.unhandled_irq = 1;
 	ap->stats.idle_irq = 1;
-- 
1.2.4



  parent reply	other threads:[~2006-03-12  7:02 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-12  7:02 [PATCHSET] libata: implement per-dev xfer masks Tejun Heo
2006-03-12  7:02 ` [PATCH 1/4] libata: implement ata_unpack_xfermask() Tejun Heo
2006-03-13  8:23   ` Jeff Garzik
2006-03-12  7:02 ` Tejun Heo [this message]
2006-03-13  6:19   ` [PATCH 2/4] libata: implement ata_dev_init() Tejun Heo
2006-03-13  8:26     ` Jeff Garzik
2006-03-13  9:25       ` Tejun Heo
2006-03-12  7:02 ` [PATCH 3/4] libata: add per-dev pio/mwdma/udma_mask Tejun Heo
2006-03-13  8:29   ` Jeff Garzik
2006-03-13  9:30     ` Tejun Heo
2006-03-13  9:52       ` Jeff Garzik
2006-03-13 10:09         ` Tejun Heo
2006-03-13 10:13           ` Jeff Garzik
2006-03-13 10:24             ` Tejun Heo
2006-03-21  1:56               ` Jeff Garzik
2006-03-21 10:25                 ` Alan Cox
2006-03-12  7:02 ` [PATCH 4/4] libata: make per-dev transfer mode limits per-dev Tejun Heo
2006-03-13  8:30   ` Jeff Garzik
2006-03-13  9:33     ` Tejun Heo
2006-03-12 13:37 ` [PATCHSET] libata: implement per-dev xfer masks Alan Cox
2006-03-13  6:12   ` Tejun Heo
2006-03-13 11:41     ` Alan Cox

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=11421469552851-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 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.