linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Lord <liml@rtr.ca>
To: Jeff Garzik <jgarzik@pobox.com>, Tejun Heo <htejun@gmail.com>,
	Alan Cox <alan@redhat.com>,
	IDE/ATA development list <linux-ide@vger.kernel.org>
Subject: [PATCH 2/4] libata sata_qstor nuke idle state
Date: Wed, 07 Nov 2007 10:52:55 -0500	[thread overview]
Message-ID: <4731DF57.9010701@rtr.ca> (raw)
In-Reply-To: <4731DF06.3050202@rtr.ca>

sata_qstor nuke idle state.

We're really only ever in one of two hardware states:  packet, or mmio.
Get rid of unnecessary "qs_state_idle" state.

This belongs in 2.6.24.

Signed-off-by:  Mark Lord <mlord@pobox.com>
---

--- old/drivers/ata/sata_qstor.c	2007-11-07 07:41:28.000000000 -0500
+++ linux/drivers/ata/sata_qstor.c	2007-11-07 08:06:29.000000000 -0500
@@ -103,7 +103,7 @@
 	QS_DMA_BOUNDARY		= ~0UL
 };
 
-typedef enum { qs_state_idle, qs_state_pkt, qs_state_mmio } qs_state_t;
+typedef enum { qs_state_mmio, qs_state_pkt } qs_state_t;
 
 struct qs_port_priv {
 	u8			*pkt;
@@ -222,7 +222,9 @@
 static inline void qs_enter_reg_mode(struct ata_port *ap)
 {
 	u8 __iomem *chan = qs_mmio_base(ap->host) + (ap->port_no * 0x4000);
+	struct qs_port_priv *pp = ap->private_data;
 
+	pp->state = qs_state_mmio;
 	writeb(QS_CTR0_REG, chan + QS_CCT_CTR0);
 	readb(chan + QS_CCT_CTR0);        /* flush */
 }
@@ -238,19 +240,12 @@
 
 static void qs_phy_reset(struct ata_port *ap)
 {
-	struct qs_port_priv *pp = ap->private_data;
-
-	pp->state = qs_state_idle;
 	qs_reset_channel_logic(ap);
 	sata_phy_reset(ap);
 }
 
 static void qs_eng_timeout(struct ata_port *ap)
 {
-	struct qs_port_priv *pp = ap->private_data;
-
-	if (pp->state != qs_state_idle) /* healthy paranoia */
-		pp->state = qs_state_mmio;
 	qs_reset_channel_logic(ap);
 	ata_eng_timeout(ap);
 }
@@ -409,7 +404,6 @@
 					switch (sHST) {
 					case 0: /* successful CPB */
 					case 3: /* device error */
-						pp->state = qs_state_idle;
 						qs_enter_reg_mode(qc->ap);
 						qc->err_mask |= ac_err_mask(sDST);
 						ata_qc_complete(qc);
@@ -448,7 +442,6 @@
 					ap->print_id, qc->tf.protocol, status);
 
 				/* complete taskfile transaction */
-				pp->state = qs_state_idle;
 				qc->err_mask |= ac_err_mask(status);
 				ata_qc_complete(qc);
 				handled = 1;
@@ -504,7 +497,6 @@
 	rc = ata_port_start(ap);
 	if (rc)
 		return rc;
-	qs_enter_reg_mode(ap);
 	pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL);
 	if (!pp)
 		return -ENOMEM;
@@ -515,6 +507,7 @@
 	memset(pp->pkt, 0, QS_PKT_BYTES);
 	ap->private_data = pp;
 
+	qs_enter_reg_mode(ap);
 	addr = (u64)pp->pkt_dma;
 	writel((u32) addr,        chan + QS_CCF_CPBA);
 	writel((u32)(addr >> 32), chan + QS_CCF_CPBA + 4);

  reply	other threads:[~2007-11-07 15:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-07 15:51 [PATCH 1/4] libata sata_qstor fix oops on rmmod Mark Lord
2007-11-07 15:52 ` Mark Lord [this message]
2007-11-08 18:14   ` [PATCH 2/4] libata sata_qstor nuke idle state Jeff Garzik
2007-11-07 15:53 ` [PATCH 3/4] libata sata_qstor workaround for spurious interrupts Mark Lord
2007-11-07 15:54 ` [PATCH 4/4] libata sata_qstor conversion to new error handling (EH) Mark Lord
2007-11-07 23:27   ` Jeff Garzik
2007-11-07 23:32     ` Mark Lord
2007-11-07 23:36       ` Mark Lord
2007-11-07 23:45         ` Jeff Garzik
2007-11-07 23:58           ` Mark Lord
2007-11-07 16:24 ` [PATCH 1/4] libata sata_qstor fix oops on rmmod Mark Lord
2007-11-08  2:30 ` Tejun Heo
2007-11-08 13:45 ` 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=4731DF57.9010701@rtr.ca \
    --to=liml@rtr.ca \
    --cc=alan@redhat.com \
    --cc=htejun@gmail.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).