linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Albert Lee <albertcc@tw.ibm.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: Linux IDE <linux-ide@vger.kernel.org>,
	Doug Maxey <dwm@maxeymade.com>,
	Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
	Tejun Heo <htejun@gmail.com>
Subject: [PATCH 1/2] libata: ata_pio_complete() and ata_pio_block() return value
Date: Fri, 02 Sep 2005 23:53:33 +0800	[thread overview]
Message-ID: <4318757D.5000705@tw.ibm.com> (raw)
In-Reply-To: <43187433.9080204@tw.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 190 bytes --]

Jeff,

PATCH 1/2:
Modify ata_pio_complete() and ata_pio_block() to return
whether qc has been completed.

For your review, thanks.

Albert

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>



[-- Attachment #2: pio1.diff --]
[-- Type: text/plain, Size: 1986 bytes --]

--- linux/drivers/scsi/libata-core.c.ori	2005-09-02 17:59:15.000000000 +0800
+++ pio1/drivers/scsi/libata-core.c	2005-09-02 18:37:26.000000000 +0800
@@ -2461,9 +2461,12 @@
  *
  *	LOCKING:
  *	None.  (executing in kernel thread context)
+ *
+ *	RETURNS:
+ *	Zero if qc completed, non-zero otherwise.
  */
 
-static void ata_pio_complete (struct ata_port *ap)
+static int ata_pio_complete (struct ata_port *ap)
 {
 	struct ata_queued_cmd *qc;
 	u8 drv_stat;
@@ -2482,14 +2485,14 @@
 		if (drv_stat & (ATA_BUSY | ATA_DRQ)) {
 			ap->pio_task_state = PIO_ST_LAST_POLL;
 			ap->pio_task_timeout = jiffies + ATA_TMOUT_PIO;
-			return;
+			return 1; /* qc not completed */
 		}
 	}
 
 	drv_stat = ata_wait_idle(ap);
 	if (!ata_ok(drv_stat)) {
 		ap->pio_task_state = PIO_ST_ERR;
-		return;
+		return 1; /* qc not completed */
 	}
 
 	qc = ata_qc_from_tag(ap, ap->active_tag);
@@ -2498,6 +2501,7 @@
 	ap->pio_task_state = PIO_ST_IDLE;
 
 	ata_poll_qc_complete(qc, drv_stat);
+	return 0; /* qc completed */
 }
 
 
@@ -2813,9 +2817,12 @@
  *
  *	LOCKING:
  *	None.  (executing in kernel thread context)
+ *
+ *	RETURNS:
+ *	Zero if qc completed, non-zero otherwise.
  */
 
-static void ata_pio_block(struct ata_port *ap)
+static int ata_pio_block(struct ata_port *ap)
 {
 	struct ata_queued_cmd *qc;
 	u8 status;
@@ -2835,7 +2842,7 @@
 		if (status & ATA_BUSY) {
 			ap->pio_task_state = PIO_ST_POLL;
 			ap->pio_task_timeout = jiffies + ATA_TMOUT_PIO;
-			return;
+			return 1; /* qc not completed */
 		}
 	}
 
@@ -2848,7 +2855,7 @@
 			ap->pio_task_state = PIO_ST_IDLE;
 
 			ata_poll_qc_complete(qc, status);
-			return;
+			return 0; /* qc completed */
 		}
 
 		atapi_pio_bytes(qc);
@@ -2856,11 +2863,13 @@
 		/* handle BSY=0, DRQ=0 as error */
 		if ((status & ATA_DRQ) == 0) {
 			ap->pio_task_state = PIO_ST_ERR;
-			return;
+			return 1; /* qc not completed */
 		}
 
 		ata_pio_sector(qc);
 	}
+
+	return 1; /* qc not completed */
 }
 
 static void ata_pio_error(struct ata_port *ap)

  reply	other threads:[~2005-09-02 15:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-02 15:48 [PATCH 0/2] libata: ata_pio_task() accessing 'ap->pio_task_state' fix Albert Lee
2005-09-02 15:53 ` Albert Lee [this message]
2005-09-02 15:55 ` [PATCH 2/2] libata: ata_pio_task() fix Albert Lee
2005-09-07  5:41 ` [PATCH 0/2] libata: ata_pio_task() accessing 'ap->pio_task_state' fix Jeff Garzik
2005-09-07 10:03   ` Albert Lee
2005-09-08  0:43     ` Jeff Garzik
2005-09-08  6:25       ` Albert Lee

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=4318757D.5000705@tw.ibm.com \
    --to=albertcc@tw.ibm.com \
    --cc=bzolnier@gmail.com \
    --cc=dwm@maxeymade.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).