All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] ide: remove ->end_request method
@ 2009-02-01 19:27 Bartlomiej Zolnierkiewicz
  2009-02-01 19:27 ` [PATCH 1/8] ide: remove no longer needed PC_FLAG_TIMEDOUT packet command flag Bartlomiej Zolnierkiewicz
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-02-01 19:27 UTC (permalink / raw)
  To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel


by-product of some other WIP...

on top of "[PATCH 00/15] weekly IDE updates" patchset
[ http://marc.info/?l=linux-kernel&m=123351051303529&w=2 ]

diffstat:
 drivers/ide/ide-atapi.c    |   17 +++--
 drivers/ide/ide-cd.c       |    1 
 drivers/ide/ide-disk.c     |    1 
 drivers/ide/ide-floppy.c   |  130 ++++++++++++++++-----------------------------
 drivers/ide/ide-gd.c       |    6 --
 drivers/ide/ide-gd.h       |    2 
 drivers/ide/ide-io.c       |   21 ++++---
 drivers/ide/ide-tape.c     |  124 ++++++++++++++----------------------------
 drivers/ide/ide-taskfile.c |   16 +----
 include/linux/ide.h        |   16 +++--
 10 files changed, 127 insertions(+), 207 deletions(-)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/8] ide: remove no longer needed PC_FLAG_TIMEDOUT packet command flag
  2009-02-01 19:27 [PATCH 0/8] ide: remove ->end_request method Bartlomiej Zolnierkiewicz
@ 2009-02-01 19:27 ` Bartlomiej Zolnierkiewicz
  2009-02-01 19:27 ` [PATCH 2/8] ide-floppy: remove superfluous check from ide_floppy_end_request() Bartlomiej Zolnierkiewicz
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-02-01 19:27 UTC (permalink / raw)
  To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide: remove no longer needed PC_FLAG_TIMEDOUT packet command flag

There should be no functional changes caused by this patch.

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ide-atapi.c |    5 -----
 include/linux/ide.h     |    2 --
 2 files changed, 7 deletions(-)

Index: b/drivers/ide/ide-atapi.c
===================================================================
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -324,11 +324,6 @@ static ide_startstop_t ide_pc_intr(ide_d
 	timeout = (drive->media == ide_floppy) ? WAIT_FLOPPY_CMD
 					       : WAIT_TAPE_CMD;
 
-	if (pc->flags & PC_FLAG_TIMEDOUT) {
-		drive->pc_callback(drive, 0);
-		return ide_stopped;
-	}
-
 	/* Clear the interrupt */
 	stat = tp_ops->read_status(hwif);
 
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -350,8 +350,6 @@ enum {
 	PC_FLAG_DMA_IN_PROGRESS		= (1 << 4),
 	PC_FLAG_DMA_ERROR		= (1 << 5),
 	PC_FLAG_WRITING			= (1 << 6),
-	/* command timed out */
-	PC_FLAG_TIMEDOUT		= (1 << 7),
 };
 
 /*

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 2/8] ide-floppy: remove superfluous check from ide_floppy_end_request()
  2009-02-01 19:27 [PATCH 0/8] ide: remove ->end_request method Bartlomiej Zolnierkiewicz
  2009-02-01 19:27 ` [PATCH 1/8] ide: remove no longer needed PC_FLAG_TIMEDOUT packet command flag Bartlomiej Zolnierkiewicz
@ 2009-02-01 19:27 ` Bartlomiej Zolnierkiewicz
  2009-02-01 19:27 ` [PATCH 3/8] ide-tape: remove superfluous tape->lock Bartlomiej Zolnierkiewicz
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-02-01 19:27 UTC (permalink / raw)
  To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide-floppy: remove superfluous check from ide_floppy_end_request()

There should be no functional changes caused by this patch.

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ide-floppy.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Index: b/drivers/ide/ide-floppy.c
===================================================================
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -91,9 +91,7 @@ static int ide_floppy_end_request(ide_dr
 
 	if (error)
 		floppy->failed_pc = NULL;
-	/* Why does this happen? */
-	if (!rq)
-		return 0;
+
 	if (!blk_special_request(rq)) {
 		/* our real local end request function */
 		ide_end_request(drive, uptodate, nsecs);

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 3/8] ide-tape: remove superfluous tape->lock
  2009-02-01 19:27 [PATCH 0/8] ide: remove ->end_request method Bartlomiej Zolnierkiewicz
  2009-02-01 19:27 ` [PATCH 1/8] ide: remove no longer needed PC_FLAG_TIMEDOUT packet command flag Bartlomiej Zolnierkiewicz
  2009-02-01 19:27 ` [PATCH 2/8] ide-floppy: remove superfluous check from ide_floppy_end_request() Bartlomiej Zolnierkiewicz
@ 2009-02-01 19:27 ` Bartlomiej Zolnierkiewicz
  2009-02-01 19:28 ` [PATCH 4/8] ide: move ->failed_pc to ide_drive_t Bartlomiej Zolnierkiewicz
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-02-01 19:27 UTC (permalink / raw)
  To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide-tape: remove superfluous tape->lock

tape->lock is not needed (->queue_lock protects queue).

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ide-tape.c |    9 ---------
 1 file changed, 9 deletions(-)

Index: b/drivers/ide/ide-tape.c
===================================================================
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -245,9 +245,6 @@ typedef struct ide_tape_obj {
 	/* Wasted space in each stage */
 	int excess_bh_size;
 
-	/* protects the ide-tape queue */
-	spinlock_t lock;
-
 	/* Measures average tape speed */
 	unsigned long avg_time;
 	int avg_size;
@@ -481,7 +478,6 @@ static int idetape_end_request(ide_drive
 {
 	struct request *rq = drive->hwif->rq;
 	idetape_tape_t *tape = drive->driver_data;
-	unsigned long flags;
 	int error;
 
 	debug_log(DBG_PROCS, "Enter %s\n", __func__);
@@ -500,11 +496,8 @@ static int idetape_end_request(ide_drive
 		return 0;
 	}
 
-	spin_lock_irqsave(&tape->lock, flags);
-
 	ide_complete_rq(drive, 0);
 
-	spin_unlock_irqrestore(&tape->lock, flags);
 	return 0;
 }
 
@@ -2192,8 +2185,6 @@ static void idetape_setup(ide_drive_t *d
 	drive->pc_update_buffers = idetape_update_buffers;
 	drive->pc_io_buffers	 = ide_tape_io_buffers;
 
-	spin_lock_init(&tape->lock);
-
 	drive->dev_flags |= IDE_DFLAG_DSC_OVERLAP;
 
 	if (drive->hwif->host_flags & IDE_HFLAG_NO_DSC) {

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 4/8] ide: move ->failed_pc to ide_drive_t
  2009-02-01 19:27 [PATCH 0/8] ide: remove ->end_request method Bartlomiej Zolnierkiewicz
                   ` (2 preceding siblings ...)
  2009-02-01 19:27 ` [PATCH 3/8] ide-tape: remove superfluous tape->lock Bartlomiej Zolnierkiewicz
@ 2009-02-01 19:28 ` Bartlomiej Zolnierkiewicz
  2009-02-01 19:28 ` [PATCH 5/8] ide: use ->end_request only for private device driver requests Bartlomiej Zolnierkiewicz
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-02-01 19:28 UTC (permalink / raw)
  To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide: move ->failed_pc to ide_drive_t

Move ->failed_pc from struct ide_{disk,tape}_obj to ide_drive_t.

There should be no functional changes caused by this patch.

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ide-floppy.c |   21 ++++++++++-----------
 drivers/ide/ide-gd.h     |    2 --
 drivers/ide/ide-tape.c   |   29 ++++++++++-------------------
 include/linux/ide.h      |    3 +++
 4 files changed, 23 insertions(+), 32 deletions(-)

Index: b/drivers/ide/ide-floppy.c
===================================================================
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -70,7 +70,6 @@
  */
 static int ide_floppy_end_request(ide_drive_t *drive, int uptodate, int nsecs)
 {
-	struct ide_disk_obj *floppy = drive->driver_data;
 	struct request *rq = drive->hwif->rq;
 	int error;
 
@@ -90,7 +89,7 @@ static int ide_floppy_end_request(ide_dr
 	}
 
 	if (error)
-		floppy->failed_pc = NULL;
+		drive->failed_pc = NULL;
 
 	if (!blk_special_request(rq)) {
 		/* our real local end request function */
@@ -121,8 +120,8 @@ static void ide_floppy_callback(ide_driv
 
 	ide_debug_log(IDE_DBG_FUNC, "enter");
 
-	if (floppy->failed_pc == pc)
-		floppy->failed_pc = NULL;
+	if (drive->failed_pc == pc)
+		drive->failed_pc = NULL;
 
 	if (pc->c[0] == GPCMD_READ_10 || pc->c[0] == GPCMD_WRITE_10 ||
 	    (pc->rq && blk_pc_request(pc->rq)))
@@ -137,9 +136,9 @@ static void ide_floppy_callback(ide_driv
 			floppy->progress_indication = buf[15] & 0x80 ?
 				(u16)get_unaligned((u16 *)&buf[16]) : 0x10000;
 
-			if (floppy->failed_pc)
+			if (drive->failed_pc)
 				ide_debug_log(IDE_DBG_PC, "pc = %x",
-					      floppy->failed_pc->c[0]);
+					      drive->failed_pc->c[0]);
 
 			ide_debug_log(IDE_DBG_SENSE, "sense key = %x, asc = %x,"
 				      "ascq = %x", floppy->sense_key,
@@ -173,9 +172,9 @@ static ide_startstop_t idefloppy_issue_p
 {
 	struct ide_disk_obj *floppy = drive->driver_data;
 
-	if (floppy->failed_pc == NULL &&
+	if (drive->failed_pc == NULL &&
 	    pc->c[0] != GPCMD_REQUEST_SENSE)
-		floppy->failed_pc = pc;
+		drive->failed_pc = pc;
 
 	/* Set the current packet command */
 	drive->pc = pc;
@@ -186,7 +185,7 @@ static ide_startstop_t idefloppy_issue_p
 		/* Giving up */
 		pc->error = IDEFLOPPY_ERROR_GENERAL;
 
-		floppy->failed_pc = NULL;
+		drive->failed_pc = NULL;
 		drive->pc_callback(drive, 0);
 		return ide_stopped;
 	}
@@ -290,8 +289,8 @@ static ide_startstop_t ide_floppy_do_req
 					: "dev?"));
 
 	if (rq->errors >= ERROR_MAX) {
-		if (floppy->failed_pc)
-			ide_floppy_report_error(floppy, floppy->failed_pc);
+		if (drive->failed_pc)
+			ide_floppy_report_error(floppy, drive->failed_pc);
 		else
 			printk(KERN_ERR PFX "%s: I/O error\n", drive->name);
 
Index: b/drivers/ide/ide-gd.h
===================================================================
--- a/drivers/ide/ide-gd.h
+++ b/drivers/ide/ide-gd.h
@@ -20,8 +20,6 @@ struct ide_disk_obj {
 	struct kref		kref;
 	unsigned int		openers;	/* protected by BKL for now */
 
-	/* Last failed packet command */
-	struct ide_atapi_pc *failed_pc;
 	/* used for blk_{fs,pc}_request() requests */
 	struct ide_atapi_pc queued_pc;
 
Index: b/drivers/ide/ide-tape.c
===================================================================
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -171,14 +171,6 @@ typedef struct ide_tape_obj {
 	struct gendisk		*disk;
 	struct kref		kref;
 
-	/*
-	 *	failed_pc points to the last failed packet command, or contains
-	 *	NULL if we do not need to retry any packet command. This is
-	 *	required since an additional packet command is needed before the
-	 *	retry, to get detailed information on what went wrong.
-	 */
-	/* Last failed packet command */
-	struct ide_atapi_pc *failed_pc;
 	/* used by REQ_IDETAPE_{READ,WRITE} requests */
 	struct ide_atapi_pc queued_pc;
 
@@ -397,7 +389,7 @@ static void idetape_update_buffers(ide_d
 static void idetape_analyze_error(ide_drive_t *drive, u8 *sense)
 {
 	idetape_tape_t *tape = drive->driver_data;
-	struct ide_atapi_pc *pc = tape->failed_pc;
+	struct ide_atapi_pc *pc = drive->failed_pc;
 
 	tape->sense_key = sense[2] & 0xF;
 	tape->asc       = sense[12];
@@ -477,7 +469,6 @@ static void ide_tape_kfree_buffer(idetap
 static int idetape_end_request(ide_drive_t *drive, int uptodate, int nr_sects)
 {
 	struct request *rq = drive->hwif->rq;
-	idetape_tape_t *tape = drive->driver_data;
 	int error;
 
 	debug_log(DBG_PROCS, "Enter %s\n", __func__);
@@ -489,7 +480,7 @@ static int idetape_end_request(ide_drive
 	}
 	rq->errors = error;
 	if (error)
-		tape->failed_pc = NULL;
+		drive->failed_pc = NULL;
 
 	if (!blk_special_request(rq)) {
 		ide_end_request(drive, uptodate, nr_sects);
@@ -514,8 +505,8 @@ static void ide_tape_callback(ide_drive_
 	if (dsc)
 		ide_tape_handle_dsc(drive);
 
-	if (tape->failed_pc == pc)
-		tape->failed_pc = NULL;
+	if (drive->failed_pc == pc)
+		drive->failed_pc = NULL;
 
 	if (pc->c[0] == REQUEST_SENSE) {
 		if (uptodate)
@@ -653,8 +644,8 @@ static ide_startstop_t idetape_issue_pc(
 			"Two request sense in serial were issued\n");
 	}
 
-	if (tape->failed_pc == NULL && pc->c[0] != REQUEST_SENSE)
-		tape->failed_pc = pc;
+	if (drive->failed_pc == NULL && pc->c[0] != REQUEST_SENSE)
+		drive->failed_pc = pc;
 
 	/* Set the current packet command */
 	drive->pc = pc;
@@ -680,7 +671,7 @@ static ide_startstop_t idetape_issue_pc(
 			/* Giving up */
 			pc->error = IDETAPE_ERROR_GENERAL;
 		}
-		tape->failed_pc = NULL;
+		drive->failed_pc = NULL;
 		drive->pc_callback(drive, 0);
 		return ide_stopped;
 	}
@@ -740,7 +731,7 @@ static ide_startstop_t idetape_media_acc
 		pc->error = 0;
 	} else {
 		pc->error = IDETAPE_ERROR_GENERAL;
-		tape->failed_pc = NULL;
+		drive->failed_pc = NULL;
 	}
 	drive->pc_callback(drive, 0);
 	return ide_stopped;
@@ -799,8 +790,8 @@ static ide_startstop_t idetape_do_reques
 	}
 
 	/* Retry a failed packet command */
-	if (tape->failed_pc && drive->pc->c[0] == REQUEST_SENSE) {
-		pc = tape->failed_pc;
+	if (drive->failed_pc && drive->pc->c[0] == REQUEST_SENSE) {
+		pc = drive->failed_pc;
 		goto out;
 	}
 
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -609,6 +609,9 @@ struct ide_drive_s {
 	/* current packet command */
 	struct ide_atapi_pc *pc;
 
+	/* last failed packet command */
+	struct ide_atapi_pc *failed_pc;
+
 	/* callback for packet commands */
 	void (*pc_callback)(struct ide_drive_s *, int);
 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 5/8] ide: use ->end_request only for private device driver requests
  2009-02-01 19:27 [PATCH 0/8] ide: remove ->end_request method Bartlomiej Zolnierkiewicz
                   ` (3 preceding siblings ...)
  2009-02-01 19:28 ` [PATCH 4/8] ide: move ->failed_pc to ide_drive_t Bartlomiej Zolnierkiewicz
@ 2009-02-01 19:28 ` Bartlomiej Zolnierkiewicz
  2009-02-01 19:28 ` [PATCH 6/8] ide-{floppy,tape}: cleanup ide*_end_request() Bartlomiej Zolnierkiewicz
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-02-01 19:28 UTC (permalink / raw)
  To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide: use ->end_request only for private device driver requests

* Move IDE{FLOPPY,TAPE}_ERROR_* defines to <linux/ide.h> and rename them
  to IDE_DRV_ERROR_*.

* Handle ->end_request special cases for floppy/tape media in ide_kill_rq().

* Call ->end_request only for private device driver requests.

There should be no functional changes caused by this patch.

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ide-floppy.c   |    7 ++-----
 drivers/ide/ide-io.c       |    7 ++++++-
 drivers/ide/ide-tape.c     |   19 +++++++------------
 drivers/ide/ide-taskfile.c |   16 +++-------------
 include/linux/ide.h        |    7 +++++++
 5 files changed, 25 insertions(+), 31 deletions(-)

Index: b/drivers/ide/ide-floppy.c
===================================================================
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -61,9 +61,6 @@
  */
 #define IDEFLOPPY_PC_DELAY	(HZ/20)	/* default delay for ZIP 100 (50ms) */
 
-/* Error code returned in rq->errors to the higher part of the driver. */
-#define	IDEFLOPPY_ERROR_GENERAL		101
-
 /*
  * Used to finish servicing a request. For read/write requests, we will call
  * ide_end_request to pass to the next buffer.
@@ -77,7 +74,7 @@ static int ide_floppy_end_request(ide_dr
 
 	switch (uptodate) {
 	case 0:
-		error = IDEFLOPPY_ERROR_GENERAL;
+		error = IDE_DRV_ERROR_GENERAL;
 		break;
 
 	case 1:
@@ -183,7 +180,7 @@ static ide_startstop_t idefloppy_issue_p
 		if (!(pc->flags & PC_FLAG_SUPPRESS_ERROR))
 			ide_floppy_report_error(floppy, pc);
 		/* Giving up */
-		pc->error = IDEFLOPPY_ERROR_GENERAL;
+		pc->error = IDE_DRV_ERROR_GENERAL;
 
 		drive->failed_pc = NULL;
 		drive->pc_callback(drive, 0);
Index: b/drivers/ide/ide-io.c
===================================================================
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -174,7 +174,12 @@ EXPORT_SYMBOL(ide_complete_rq);
 
 void ide_kill_rq(ide_drive_t *drive, struct request *rq)
 {
-	if (rq->rq_disk) {
+	drive->failed_pc = NULL;
+
+	if (drive->media == ide_tape)
+		rq->errors = IDE_DRV_ERROR_GENERAL;
+
+	if (blk_special_request(rq) && rq->rq_disk) {
 		struct ide_driver *drv;
 
 		drv = *(struct ide_driver **)rq->rq_disk->private_data;
Index: b/drivers/ide/ide-tape.c
===================================================================
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -152,11 +152,6 @@ struct idetape_bh {
 #define IDETAPE_LU_RETENSION_MASK	2
 #define IDETAPE_LU_EOT_MASK		4
 
-/* Error codes returned in rq->errors to the higher part of the driver. */
-#define IDETAPE_ERROR_GENERAL		101
-#define IDETAPE_ERROR_FILEMARK		102
-#define IDETAPE_ERROR_EOD		103
-
 /* Structures related to the SELECT SENSE / MODE SENSE packet commands. */
 #define IDETAPE_BLOCK_DESCRIPTOR	0
 #define IDETAPE_CAPABILITIES_PAGE	0x2a
@@ -422,19 +417,19 @@ static void idetape_analyze_error(ide_dr
 		}
 	}
 	if (pc->c[0] == READ_6 && (sense[2] & 0x80)) {
-		pc->error = IDETAPE_ERROR_FILEMARK;
+		pc->error = IDE_DRV_ERROR_FILEMARK;
 		pc->flags |= PC_FLAG_ABORT;
 	}
 	if (pc->c[0] == WRITE_6) {
 		if ((sense[2] & 0x40) || (tape->sense_key == 0xd
 		     && tape->asc == 0x0 && tape->ascq == 0x2)) {
-			pc->error = IDETAPE_ERROR_EOD;
+			pc->error = IDE_DRV_ERROR_EOD;
 			pc->flags |= PC_FLAG_ABORT;
 		}
 	}
 	if (pc->c[0] == READ_6 || pc->c[0] == WRITE_6) {
 		if (tape->sense_key == 8) {
-			pc->error = IDETAPE_ERROR_EOD;
+			pc->error = IDE_DRV_ERROR_EOD;
 			pc->flags |= PC_FLAG_ABORT;
 		}
 		if (!(pc->flags & PC_FLAG_ABORT) &&
@@ -474,7 +469,7 @@ static int idetape_end_request(ide_drive
 	debug_log(DBG_PROCS, "Enter %s\n", __func__);
 
 	switch (uptodate) {
-	case 0:	error = IDETAPE_ERROR_GENERAL; break;
+	case 0: error = IDE_DRV_ERROR_GENERAL; break;
 	case 1: error = 0; break;
 	default: error = uptodate;
 	}
@@ -669,7 +664,7 @@ static ide_startstop_t idetape_issue_pc(
 						tape->ascq);
 			}
 			/* Giving up */
-			pc->error = IDETAPE_ERROR_GENERAL;
+			pc->error = IDE_DRV_ERROR_GENERAL;
 		}
 		drive->failed_pc = NULL;
 		drive->pc_callback(drive, 0);
@@ -730,7 +725,7 @@ static ide_startstop_t idetape_media_acc
 		}
 		pc->error = 0;
 	} else {
-		pc->error = IDETAPE_ERROR_GENERAL;
+		pc->error = IDE_DRV_ERROR_GENERAL;
 		drive->failed_pc = NULL;
 	}
 	drive->pc_callback(drive, 0);
@@ -1210,7 +1205,7 @@ static int idetape_queue_rw_tail(ide_dri
 
 	if (tape->merge_bh)
 		idetape_init_merge_buffer(tape);
-	if (errors == IDETAPE_ERROR_GENERAL)
+	if (errors == IDE_DRV_ERROR_GENERAL)
 		return -EIO;
 	return ret;
 }
Index: b/drivers/ide/ide-taskfile.c
===================================================================
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -311,12 +311,8 @@ static ide_startstop_t task_error(ide_dr
 			break;
 		}
 
-		if (sectors > 0) {
-			struct ide_driver *drv;
-
-			drv = *(struct ide_driver **)rq->rq_disk->private_data;
-			drv->end_request(drive, 1, sectors);
-		}
+		if (sectors > 0)
+			ide_end_request(drive, 1, sectors);
 	}
 	return ide_error(drive, s, stat);
 }
@@ -333,13 +329,7 @@ void task_end_request(ide_drive_t *drive
 		return;
 	}
 
-	if (rq->rq_disk) {
-		struct ide_driver *drv;
-
-		drv = *(struct ide_driver **)rq->rq_disk->private_data;;
-		drv->end_request(drive, 1, rq->nr_sectors);
-	} else
-		ide_end_request(drive, 1, rq->nr_sectors);
+	ide_end_request(drive, 1, rq->nr_sectors);
 }
 
 /*
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -40,6 +40,13 @@
 #define ERROR_RESET	3	/* Reset controller every 4th retry */
 #define ERROR_RECAL	1	/* Recalibrate every 2nd retry */
 
+/* Error codes returned in rq->errors to the higher part of the driver. */
+enum {
+	IDE_DRV_ERROR_GENERAL	= 101,
+	IDE_DRV_ERROR_FILEMARK	= 102,
+	IDE_DRV_ERROR_EOD	= 103,
+};
+
 /*
  * Definitions for accessing IDE controller registers
  */

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 6/8] ide-{floppy,tape}: cleanup ide*_end_request()
  2009-02-01 19:27 [PATCH 0/8] ide: remove ->end_request method Bartlomiej Zolnierkiewicz
                   ` (4 preceding siblings ...)
  2009-02-01 19:28 ` [PATCH 5/8] ide: use ->end_request only for private device driver requests Bartlomiej Zolnierkiewicz
@ 2009-02-01 19:28 ` Bartlomiej Zolnierkiewicz
  2009-02-01 19:28 ` [PATCH 7/8] ide: remove ->end_request method Bartlomiej Zolnierkiewicz
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-02-01 19:28 UTC (permalink / raw)
  To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide-{floppy,tape}: cleanup ide*_end_request()

* ide*_end_request() is only called with uptodate == 0 or uptodate == 1
  so cleanup it accordingly.

* Inline ide*_end_request() content at call sites so the only user left
  is ->end_request method.

* ->end_request is now used only for private driver requests so remove
  handling of other requests from ide*_end_request().

There should be no functional changes caused by this patch.

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ide-floppy.c |   66 ++++++++++++++++++++++-------------------------
 drivers/ide/ide-tape.c   |   40 +++++++++++++++-------------
 2 files changed, 53 insertions(+), 53 deletions(-)

Index: b/drivers/ide/ide-floppy.c
===================================================================
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -62,40 +62,21 @@
 #define IDEFLOPPY_PC_DELAY	(HZ/20)	/* default delay for ZIP 100 (50ms) */
 
 /*
- * Used to finish servicing a request. For read/write requests, we will call
- * ide_end_request to pass to the next buffer.
+ * Used to finish servicing a private request.
  */
 static int ide_floppy_end_request(ide_drive_t *drive, int uptodate, int nsecs)
 {
 	struct request *rq = drive->hwif->rq;
-	int error;
 
 	ide_debug_log(IDE_DBG_FUNC, "enter");
 
-	switch (uptodate) {
-	case 0:
-		error = IDE_DRV_ERROR_GENERAL;
-		break;
-
-	case 1:
-		error = 0;
-		break;
-
-	default:
-		error = uptodate;
-	}
-
-	if (error)
+	if (uptodate == 0)
 		drive->failed_pc = NULL;
 
-	if (!blk_special_request(rq)) {
-		/* our real local end request function */
-		ide_end_request(drive, uptodate, nsecs);
-		return 0;
-	}
-	rq->errors = error;
-	/* fixme: need to move this local also */
+	rq->errors = uptodate ? 0 : IDE_DRV_ERROR_GENERAL;
+
 	ide_complete_rq(drive, 0);
+
 	return 0;
 }
 
@@ -106,13 +87,14 @@ static void idefloppy_update_buffers(ide
 	struct bio *bio = rq->bio;
 
 	while ((bio = rq->bio) != NULL)
-		ide_floppy_end_request(drive, 1, 0);
+		ide_end_request(drive, 1, 0);
 }
 
 static void ide_floppy_callback(ide_drive_t *drive, int dsc)
 {
 	struct ide_disk_obj *floppy = drive->driver_data;
 	struct ide_atapi_pc *pc = drive->pc;
+	struct request *rq = pc->rq;
 	int uptodate = pc->error ? 0 : 1;
 
 	ide_debug_log(IDE_DBG_FUNC, "enter");
@@ -121,7 +103,7 @@ static void ide_floppy_callback(ide_driv
 		drive->failed_pc = NULL;
 
 	if (pc->c[0] == GPCMD_READ_10 || pc->c[0] == GPCMD_WRITE_10 ||
-	    (pc->rq && blk_pc_request(pc->rq)))
+	    (rq && blk_pc_request(rq)))
 		uptodate = 1; /* FIXME */
 	else if (pc->c[0] == GPCMD_REQUEST_SENSE) {
 		u8 *buf = pc->buf;
@@ -145,7 +127,14 @@ static void ide_floppy_callback(ide_driv
 			       "Aborting request!\n");
 	}
 
-	ide_floppy_end_request(drive, uptodate, 0);
+	if (uptodate == 0)
+		drive->failed_pc = NULL;
+
+	if (blk_special_request(rq)) {
+		rq->errors = uptodate ? 0 : IDE_DRV_ERROR_GENERAL;
+		ide_complete_rq(drive, 0);
+	} else
+		ide_end_request(drive, uptodate, 0);
 }
 
 static void ide_floppy_report_error(struct ide_disk_obj *floppy,
@@ -286,21 +275,25 @@ static ide_startstop_t ide_floppy_do_req
 					: "dev?"));
 
 	if (rq->errors >= ERROR_MAX) {
-		if (drive->failed_pc)
+		if (drive->failed_pc) {
 			ide_floppy_report_error(floppy, drive->failed_pc);
-		else
+			drive->failed_pc = NULL;
+		} else
 			printk(KERN_ERR PFX "%s: I/O error\n", drive->name);
 
-		ide_floppy_end_request(drive, 0, 0);
-		return ide_stopped;
+		if (blk_special_request(rq)) {
+			rq->errors = IDE_DRV_ERROR_GENERAL;
+			ide_complete_rq(drive, 0);
+			return ide_stopped;
+		} else
+			goto out_end;
 	}
 	if (blk_fs_request(rq)) {
 		if (((long)rq->sector % floppy->bs_factor) ||
 		    (rq->nr_sectors % floppy->bs_factor)) {
 			printk(KERN_ERR PFX "%s: unsupported r/w rq size\n",
 				drive->name);
-			ide_floppy_end_request(drive, 0, 0);
-			return ide_stopped;
+			goto out_end;
 		}
 		pc = &floppy->queued_pc;
 		idefloppy_create_rw_cmd(drive, pc, rq, (unsigned long)block);
@@ -311,8 +304,7 @@ static ide_startstop_t ide_floppy_do_req
 		idefloppy_blockpc_cmd(floppy, pc, rq);
 	} else {
 		blk_dump_rq_flags(rq, PFX "unsupported command in queue");
-		ide_floppy_end_request(drive, 0, 0);
-		return ide_stopped;
+		goto out_end;
 	}
 
 	ide_init_sg_cmd(drive, rq);
@@ -324,6 +316,10 @@ static ide_startstop_t ide_floppy_do_req
 	pc->rq = rq;
 
 	return idefloppy_issue_pc(drive, pc);
+out_end:
+	drive->failed_pc = NULL;
+	ide_end_request(drive, 0, 0);
+	return ide_stopped;
 }
 
 /*
Index: b/drivers/ide/ide-tape.c
===================================================================
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -464,23 +464,13 @@ static void ide_tape_kfree_buffer(idetap
 static int idetape_end_request(ide_drive_t *drive, int uptodate, int nr_sects)
 {
 	struct request *rq = drive->hwif->rq;
-	int error;
 
 	debug_log(DBG_PROCS, "Enter %s\n", __func__);
 
-	switch (uptodate) {
-	case 0: error = IDE_DRV_ERROR_GENERAL; break;
-	case 1: error = 0; break;
-	default: error = uptodate;
-	}
-	rq->errors = error;
-	if (error)
-		drive->failed_pc = NULL;
+	rq->errors = uptodate ? 0 : IDE_DRV_ERROR_GENERAL;
 
-	if (!blk_special_request(rq)) {
-		ide_end_request(drive, uptodate, nr_sects);
-		return 0;
-	}
+	if (uptodate == 0)
+		drive->failed_pc = NULL;
 
 	ide_complete_rq(drive, 0);
 
@@ -493,7 +483,9 @@ static void ide_tape_callback(ide_drive_
 {
 	idetape_tape_t *tape = drive->driver_data;
 	struct ide_atapi_pc *pc = drive->pc;
+	struct request *rq = drive->hwif->rq;
 	int uptodate = pc->error ? 0 : 1;
+	int err = uptodate ? 0 : IDE_DRV_ERROR_GENERAL;
 
 	debug_log(DBG_PROCS, "Enter %s\n", __func__);
 
@@ -510,7 +502,6 @@ static void ide_tape_callback(ide_drive_
 			printk(KERN_ERR "ide-tape: Error in REQUEST SENSE "
 					"itself - Aborting request!\n");
 	} else if (pc->c[0] == READ_6 || pc->c[0] == WRITE_6) {
-		struct request *rq = drive->hwif->rq;
 		int blocks = pc->xferred / tape->blk_size;
 
 		tape->avg_size += blocks * tape->blk_size;
@@ -525,8 +516,10 @@ static void ide_tape_callback(ide_drive_
 		tape->first_frame += blocks;
 		rq->current_nr_sectors -= blocks;
 
-		if (pc->error)
-			uptodate = pc->error;
+		if (pc->error) {
+			uptodate = 0;
+			err = pc->error;
+		}
 	} else if (pc->c[0] == READ_POSITION && uptodate) {
 		u8 *readpos = pc->buf;
 
@@ -540,6 +533,7 @@ static void ide_tape_callback(ide_drive_
 					 "to the tape\n");
 			clear_bit(IDE_AFLAG_ADDRESS_VALID, &drive->atapi_flags);
 			uptodate = 0;
+			err = IDE_DRV_ERROR_GENERAL;
 		} else {
 			debug_log(DBG_SENSE, "Block Location - %u\n",
 					be32_to_cpup((__be32 *)&readpos[4]));
@@ -550,7 +544,15 @@ static void ide_tape_callback(ide_drive_
 		}
 	}
 
-	idetape_end_request(drive, uptodate, 0);
+	rq->errors = err;
+
+	if (uptodate == 0)
+		drive->failed_pc = NULL;
+
+	if (blk_special_request(rq))
+		ide_complete_rq(drive, 0);
+	else
+		ide_end_request(drive, uptodate, 0);
 }
 
 /*
@@ -794,7 +796,9 @@ static ide_startstop_t idetape_do_reques
 		if (rq != postponed_rq) {
 			printk(KERN_ERR "ide-tape: ide-tape.c bug - "
 					"Two DSC requests were queued\n");
-			idetape_end_request(drive, 0, 0);
+			rq->errors = IDE_DRV_ERROR_GENERAL;
+			drive->failed_pc = NULL;
+			ide_complete_rq(drive, 0);
 			return ide_stopped;
 		}
 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 7/8] ide: remove ->end_request method
  2009-02-01 19:27 [PATCH 0/8] ide: remove ->end_request method Bartlomiej Zolnierkiewicz
                   ` (5 preceding siblings ...)
  2009-02-01 19:28 ` [PATCH 6/8] ide-{floppy,tape}: cleanup ide*_end_request() Bartlomiej Zolnierkiewicz
@ 2009-02-01 19:28 ` Bartlomiej Zolnierkiewicz
  2009-02-01 19:28 ` [PATCH 8/8] ide: return request status from ->pc_callback method Bartlomiej Zolnierkiewicz
  2009-02-05  6:50 ` [PATCH 0/8] ide: remove ->end_request method Borislav Petkov
  8 siblings, 0 replies; 10+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-02-01 19:28 UTC (permalink / raw)
  To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide: remove ->end_request method

* Handle completion of private driver requests explicitly
  for ide_floppy and ide_tape media in ide_kill_rq().

* Remove no longer needed ->end_request method.

There should be no functional changes caused by this patch.

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ide-cd.c     |    1 -
 drivers/ide/ide-disk.c   |    1 -
 drivers/ide/ide-floppy.c |   20 --------------------
 drivers/ide/ide-gd.c     |    6 ------
 drivers/ide/ide-io.c     |   14 +++++++-------
 drivers/ide/ide-tape.c   |   17 -----------------
 include/linux/ide.h      |    2 --
 7 files changed, 7 insertions(+), 54 deletions(-)

Index: b/drivers/ide/ide-cd.c
===================================================================
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1824,7 +1824,6 @@ static struct ide_driver ide_cdrom_drive
 	.remove			= ide_cd_remove,
 	.version		= IDECD_VERSION,
 	.do_request		= ide_cd_do_request,
-	.end_request		= ide_end_request,
 #ifdef CONFIG_IDE_PROC_FS
 	.proc_entries		= ide_cd_proc_entries,
 	.proc_devsets		= ide_cd_proc_devsets,
Index: b/drivers/ide/ide-disk.c
===================================================================
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -734,6 +734,5 @@ const struct ide_disk_ops ide_ata_disk_o
 	.init_media	= ide_disk_init_media,
 	.set_doorlock	= ide_disk_set_doorlock,
 	.do_request	= ide_do_rw_disk,
-	.end_request	= ide_end_request,
 	.ioctl		= ide_disk_ioctl,
 };
Index: b/drivers/ide/ide-floppy.c
===================================================================
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -61,25 +61,6 @@
  */
 #define IDEFLOPPY_PC_DELAY	(HZ/20)	/* default delay for ZIP 100 (50ms) */
 
-/*
- * Used to finish servicing a private request.
- */
-static int ide_floppy_end_request(ide_drive_t *drive, int uptodate, int nsecs)
-{
-	struct request *rq = drive->hwif->rq;
-
-	ide_debug_log(IDE_DBG_FUNC, "enter");
-
-	if (uptodate == 0)
-		drive->failed_pc = NULL;
-
-	rq->errors = uptodate ? 0 : IDE_DRV_ERROR_GENERAL;
-
-	ide_complete_rq(drive, 0);
-
-	return 0;
-}
-
 static void idefloppy_update_buffers(ide_drive_t *drive,
 				struct ide_atapi_pc *pc)
 {
@@ -558,6 +539,5 @@ const struct ide_disk_ops ide_atapi_disk
 	.init_media	= ide_floppy_init_media,
 	.set_doorlock	= ide_set_media_lock,
 	.do_request	= ide_floppy_do_request,
-	.end_request	= ide_floppy_end_request,
 	.ioctl		= ide_floppy_ioctl,
 };
Index: b/drivers/ide/ide-gd.c
===================================================================
--- a/drivers/ide/ide-gd.c
+++ b/drivers/ide/ide-gd.c
@@ -144,11 +144,6 @@ static ide_startstop_t ide_gd_do_request
 	return drive->disk_ops->do_request(drive, rq, sector);
 }
 
-static int ide_gd_end_request(ide_drive_t *drive, int uptodate, int nrsecs)
-{
-	return drive->disk_ops->end_request(drive, uptodate, nrsecs);
-}
-
 static struct ide_driver ide_gd_driver = {
 	.gen_driver = {
 		.owner		= THIS_MODULE,
@@ -161,7 +156,6 @@ static struct ide_driver ide_gd_driver =
 	.shutdown		= ide_gd_shutdown,
 	.version		= IDE_GD_VERSION,
 	.do_request		= ide_gd_do_request,
-	.end_request		= ide_gd_end_request,
 #ifdef CONFIG_IDE_PROC_FS
 	.proc_entries		= ide_disk_proc_entries,
 	.proc_devsets		= ide_disk_proc_devsets,
Index: b/drivers/ide/ide-io.c
===================================================================
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -174,17 +174,17 @@ EXPORT_SYMBOL(ide_complete_rq);
 
 void ide_kill_rq(ide_drive_t *drive, struct request *rq)
 {
+	u8 drv_req = blk_special_request(rq) && rq->rq_disk;
+	u8 media = drive->media;
+
 	drive->failed_pc = NULL;
 
-	if (drive->media == ide_tape)
+	if ((media == ide_floppy && drv_req) || media == ide_tape)
 		rq->errors = IDE_DRV_ERROR_GENERAL;
 
-	if (blk_special_request(rq) && rq->rq_disk) {
-		struct ide_driver *drv;
-
-		drv = *(struct ide_driver **)rq->rq_disk->private_data;
-		drv->end_request(drive, 0, 0);
-	} else
+	if ((media == ide_floppy || media == ide_tape) && drv_req)
+		ide_complete_rq(drive, 0);
+	else
 		ide_end_request(drive, 0, 0);
 }
 
Index: b/drivers/ide/ide-tape.c
===================================================================
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -461,22 +461,6 @@ static void ide_tape_kfree_buffer(idetap
 	}
 }
 
-static int idetape_end_request(ide_drive_t *drive, int uptodate, int nr_sects)
-{
-	struct request *rq = drive->hwif->rq;
-
-	debug_log(DBG_PROCS, "Enter %s\n", __func__);
-
-	rq->errors = uptodate ? 0 : IDE_DRV_ERROR_GENERAL;
-
-	if (uptodate == 0)
-		drive->failed_pc = NULL;
-
-	ide_complete_rq(drive, 0);
-
-	return 0;
-}
-
 static void ide_tape_handle_dsc(ide_drive_t *);
 
 static void ide_tape_callback(ide_drive_t *drive, int dsc)
@@ -2304,7 +2288,6 @@ static struct ide_driver idetape_driver 
 	.remove			= ide_tape_remove,
 	.version		= IDETAPE_VERSION,
 	.do_request		= idetape_do_request,
-	.end_request		= idetape_end_request,
 #ifdef CONFIG_IDE_PROC_FS
 	.proc_entries		= ide_tape_proc_entries,
 	.proc_devsets		= ide_tape_proc_devsets,
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -427,7 +427,6 @@ struct ide_disk_ops {
 					int);
 	ide_startstop_t	(*do_request)(struct ide_drive_s *, struct request *,
 				      sector_t);
-	int		(*end_request)(struct ide_drive_s *, int, int);
 	int		(*ioctl)(struct ide_drive_s *, struct block_device *,
 				 fmode_t, unsigned int, unsigned long);
 };
@@ -1095,7 +1094,6 @@ void ide_check_pm_state(ide_drive_t *, s
 struct ide_driver {
 	const char			*version;
 	ide_startstop_t	(*do_request)(ide_drive_t *, struct request *, sector_t);
-	int		(*end_request)(ide_drive_t *, int, int);
 	struct device_driver	gen_driver;
 	int		(*probe)(ide_drive_t *);
 	void		(*remove)(ide_drive_t *);

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 8/8] ide: return request status from ->pc_callback method
  2009-02-01 19:27 [PATCH 0/8] ide: remove ->end_request method Bartlomiej Zolnierkiewicz
                   ` (6 preceding siblings ...)
  2009-02-01 19:28 ` [PATCH 7/8] ide: remove ->end_request method Bartlomiej Zolnierkiewicz
@ 2009-02-01 19:28 ` Bartlomiej Zolnierkiewicz
  2009-02-05  6:50 ` [PATCH 0/8] ide: remove ->end_request method Borislav Petkov
  8 siblings, 0 replies; 10+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-02-01 19:28 UTC (permalink / raw)
  To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide: return request status from ->pc_callback method

Make ->pc_callback method return request status and then move
the request completion from ->pc_callback to ide_pc_intr().

There should be no functional changes caused by this patch.

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ide-atapi.c  |   12 +++++++++++-
 drivers/ide/ide-floppy.c |   12 ++++--------
 drivers/ide/ide-tape.c   |   10 ++--------
 include/linux/ide.h      |    2 +-
 4 files changed, 18 insertions(+), 18 deletions(-)

Index: b/drivers/ide/ide-atapi.c
===================================================================
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -345,6 +345,8 @@ static ide_startstop_t ide_pc_intr(ide_d
 
 	/* No more interrupts */
 	if ((stat & ATA_DRQ) == 0) {
+		int uptodate;
+
 		debug_log("Packet command completed, %d bytes transferred\n",
 			  pc->xferred);
 
@@ -383,7 +385,15 @@ static ide_startstop_t ide_pc_intr(ide_d
 			dsc = 1;
 
 		/* Command finished - Call the callback function */
-		drive->pc_callback(drive, dsc);
+		uptodate = drive->pc_callback(drive, dsc);
+
+		if (uptodate == 0)
+			drive->failed_pc = NULL;
+
+		if (blk_special_request(rq))
+			ide_complete_rq(drive, 0);
+		else
+			ide_end_request(drive, uptodate, 0);
 
 		return ide_stopped;
 	}
Index: b/drivers/ide/ide-floppy.c
===================================================================
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -71,7 +71,7 @@ static void idefloppy_update_buffers(ide
 		ide_end_request(drive, 1, 0);
 }
 
-static void ide_floppy_callback(ide_drive_t *drive, int dsc)
+static int ide_floppy_callback(ide_drive_t *drive, int dsc)
 {
 	struct ide_disk_obj *floppy = drive->driver_data;
 	struct ide_atapi_pc *pc = drive->pc;
@@ -108,14 +108,10 @@ static void ide_floppy_callback(ide_driv
 			       "Aborting request!\n");
 	}
 
-	if (uptodate == 0)
-		drive->failed_pc = NULL;
-
-	if (blk_special_request(rq)) {
+	if (blk_special_request(rq))
 		rq->errors = uptodate ? 0 : IDE_DRV_ERROR_GENERAL;
-		ide_complete_rq(drive, 0);
-	} else
-		ide_end_request(drive, uptodate, 0);
+
+	return uptodate;
 }
 
 static void ide_floppy_report_error(struct ide_disk_obj *floppy,
Index: b/drivers/ide/ide-tape.c
===================================================================
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -463,7 +463,7 @@ static void ide_tape_kfree_buffer(idetap
 
 static void ide_tape_handle_dsc(ide_drive_t *);
 
-static void ide_tape_callback(ide_drive_t *drive, int dsc)
+static int ide_tape_callback(ide_drive_t *drive, int dsc)
 {
 	idetape_tape_t *tape = drive->driver_data;
 	struct ide_atapi_pc *pc = drive->pc;
@@ -530,13 +530,7 @@ static void ide_tape_callback(ide_drive_
 
 	rq->errors = err;
 
-	if (uptodate == 0)
-		drive->failed_pc = NULL;
-
-	if (blk_special_request(rq))
-		ide_complete_rq(drive, 0);
-	else
-		ide_end_request(drive, uptodate, 0);
+	return uptodate;
 }
 
 /*
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -619,7 +619,7 @@ struct ide_drive_s {
 	struct ide_atapi_pc *failed_pc;
 
 	/* callback for packet commands */
-	void (*pc_callback)(struct ide_drive_s *, int);
+	int  (*pc_callback)(struct ide_drive_s *, int);
 
 	void (*pc_update_buffers)(struct ide_drive_s *, struct ide_atapi_pc *);
 	int  (*pc_io_buffers)(struct ide_drive_s *, struct ide_atapi_pc *,

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/8] ide: remove ->end_request method
  2009-02-01 19:27 [PATCH 0/8] ide: remove ->end_request method Bartlomiej Zolnierkiewicz
                   ` (7 preceding siblings ...)
  2009-02-01 19:28 ` [PATCH 8/8] ide: return request status from ->pc_callback method Bartlomiej Zolnierkiewicz
@ 2009-02-05  6:50 ` Borislav Petkov
  8 siblings, 0 replies; 10+ messages in thread
From: Borislav Petkov @ 2009-02-05  6:50 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide, linux-kernel

On Sun, Feb 01, 2009 at 08:27:32PM +0100, Bartlomiej Zolnierkiewicz wrote:
> 
> by-product of some other WIP...
> 
> on top of "[PATCH 00/15] weekly IDE updates" patchset
> [ http://marc.info/?l=linux-kernel&m=123351051303529&w=2 ]
> 
> diffstat:
>  drivers/ide/ide-atapi.c    |   17 +++--
>  drivers/ide/ide-cd.c       |    1 
>  drivers/ide/ide-disk.c     |    1 
>  drivers/ide/ide-floppy.c   |  130 ++++++++++++++++-----------------------------
>  drivers/ide/ide-gd.c       |    6 --
>  drivers/ide/ide-gd.h       |    2 
>  drivers/ide/ide-io.c       |   21 ++++---
>  drivers/ide/ide-tape.c     |  124 ++++++++++++++----------------------------
>  drivers/ide/ide-taskfile.c |   16 +----
>  include/linux/ide.h        |   16 +++--
>  10 files changed, 127 insertions(+), 207 deletions(-)

ACK.

-- 
Regards/Gruss,
    Boris.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-02-05  6:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-01 19:27 [PATCH 0/8] ide: remove ->end_request method Bartlomiej Zolnierkiewicz
2009-02-01 19:27 ` [PATCH 1/8] ide: remove no longer needed PC_FLAG_TIMEDOUT packet command flag Bartlomiej Zolnierkiewicz
2009-02-01 19:27 ` [PATCH 2/8] ide-floppy: remove superfluous check from ide_floppy_end_request() Bartlomiej Zolnierkiewicz
2009-02-01 19:27 ` [PATCH 3/8] ide-tape: remove superfluous tape->lock Bartlomiej Zolnierkiewicz
2009-02-01 19:28 ` [PATCH 4/8] ide: move ->failed_pc to ide_drive_t Bartlomiej Zolnierkiewicz
2009-02-01 19:28 ` [PATCH 5/8] ide: use ->end_request only for private device driver requests Bartlomiej Zolnierkiewicz
2009-02-01 19:28 ` [PATCH 6/8] ide-{floppy,tape}: cleanup ide*_end_request() Bartlomiej Zolnierkiewicz
2009-02-01 19:28 ` [PATCH 7/8] ide: remove ->end_request method Bartlomiej Zolnierkiewicz
2009-02-01 19:28 ` [PATCH 8/8] ide: return request status from ->pc_callback method Bartlomiej Zolnierkiewicz
2009-02-05  6:50 ` [PATCH 0/8] ide: remove ->end_request method Borislav Petkov

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.