All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] ide: ide_do_drive_cmd cleanups
@ 2008-05-15  0:05 FUJITA Tomonori
  2008-05-15  0:05 ` [PATCH 1/2] ide-scsi: replace ide_do_drive_cmd with blk_execute_rq_nowait FUJITA Tomonori
  2008-05-16 19:44 ` [PATCH 0/2] ide: ide_do_drive_cmd cleanups Bartlomiej Zolnierkiewicz
  0 siblings, 2 replies; 4+ messages in thread
From: FUJITA Tomonori @ 2008-05-15  0:05 UTC (permalink / raw)
  To: linux-ide; +Cc: FUJITA Tomonori, Borislav Petkov, Bartlomiej Zolnierkiewicz

This is a sequel to the patchset "removing the on-stack struct request":

http://marc.info/?l=linux-ide&m=120964501711519&w=2

The patchset makes some stuff unnecessary anymore but I forgot to
remove them. This patchset removes them.

This is against Bart's latest quilt tree.




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

* [PATCH 1/2] ide-scsi: replace ide_do_drive_cmd with blk_execute_rq_nowait
  2008-05-15  0:05 [PATCH 0/2] ide: ide_do_drive_cmd cleanups FUJITA Tomonori
@ 2008-05-15  0:05 ` FUJITA Tomonori
  2008-05-15  0:05   ` [PATCH 2/2] ide: remove action argument in ide_do_drive_cmd FUJITA Tomonori
  2008-05-16 19:44 ` [PATCH 0/2] ide: ide_do_drive_cmd cleanups Bartlomiej Zolnierkiewicz
  1 sibling, 1 reply; 4+ messages in thread
From: FUJITA Tomonori @ 2008-05-15  0:05 UTC (permalink / raw)
  To: linux-ide; +Cc: FUJITA Tomonori, Borislav Petkov, Bartlomiej Zolnierkiewicz

All the callers of ide_do_drive_cmd() except for ide-scsi use
ide_preempt action argument. This converts ide-scsi to use
blk_execute_rq_nowait instead of ide_do_drive_cmd so that we can
remove the action argument in ide_do_drive_cmd and ide_action_t
typedef.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Borislav Petkov <petkovbb@gmail.com>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/scsi/ide-scsi.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
index d7fd5e5..58e30ef 100644
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -790,8 +790,7 @@ static int idescsi_queue (struct scsi_cmnd *cmd,
 	rq->special = (char *) pc;
 	rq->cmd_type = REQ_TYPE_SPECIAL;
 	spin_unlock_irq(host->host_lock);
-	rq->rq_disk = scsi->disk;
-	(void) ide_do_drive_cmd (drive, rq, ide_end);
+	blk_execute_rq_nowait(drive->queue, scsi->disk, rq, 0, NULL);
 	spin_lock_irq(host->host_lock);
 	return 0;
 abort:
-- 
1.5.4.2


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

* [PATCH 2/2] ide: remove action argument in ide_do_drive_cmd
  2008-05-15  0:05 ` [PATCH 1/2] ide-scsi: replace ide_do_drive_cmd with blk_execute_rq_nowait FUJITA Tomonori
@ 2008-05-15  0:05   ` FUJITA Tomonori
  0 siblings, 0 replies; 4+ messages in thread
From: FUJITA Tomonori @ 2008-05-15  0:05 UTC (permalink / raw)
  To: linux-ide; +Cc: FUJITA Tomonori, Borislav Petkov, Bartlomiej Zolnierkiewicz

ide_do_drive_cmd is called only with ide_preempt action argument. So
we can remove the action argument in ide_do_drive_cmd and ide_action_t
typedef.

This patch also includes two minor cleanups: 1) ide_do_drive_cmd
always succeeds so we don't need the return value; 2) the callers use
blk_rq_init before ide_do_drive_cmd so there is no need to initialize
rq->errors.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Borislav Petkov <petkovbb@gmail.com>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ide-cd.c     |    2 +-
 drivers/ide/ide-floppy.c |    2 +-
 drivers/ide/ide-io.c     |   37 +++++++++----------------------------
 drivers/ide/ide-tape.c   |    2 +-
 drivers/scsi/ide-scsi.c  |    3 ++-
 include/linux/ide.h      |   12 +-----------
 6 files changed, 15 insertions(+), 43 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 0fbc2d8..043129c 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -213,7 +213,7 @@ static void cdrom_queue_request_sense(ide_drive_t *drive, void *sense,
 	/* NOTE! Save the failed command in "rq->buffer" */
 	rq->buffer = (void *) failed_command;
 
-	(void) ide_do_drive_cmd(drive, rq, ide_preempt);
+	ide_do_drive_cmd(drive, rq);
 }
 
 static void cdrom_end_request(ide_drive_t *drive, int uptodate)
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 1852008..53209a4 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -291,7 +291,7 @@ static void idefloppy_queue_pc_head(ide_drive_t *drive, struct ide_atapi_pc *pc,
 	rq->cmd_type = REQ_TYPE_SPECIAL;
 	rq->cmd_flags |= REQ_PREEMPT;
 	rq->rq_disk = floppy->disk;
-	(void) ide_do_drive_cmd(drive, rq, ide_preempt);
+	ide_do_drive_cmd(drive, rq);
 }
 
 static struct ide_atapi_pc *idefloppy_next_pc_storage(ide_drive_t *drive)
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 7627c46..2805774 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -1520,46 +1520,27 @@ irqreturn_t ide_intr (int irq, void *dev_id)
  *	ide_do_drive_cmd	-	issue IDE special command
  *	@drive: device to issue command
  *	@rq: request to issue
- *	@action: action for processing
  *
  *	This function issues a special IDE device request
  *	onto the request queue.
  *
- *	If action is ide_wait, then the rq is queued at the end of the
- *	request queue, and the function sleeps until it has been processed.
- *	This is for use when invoked from an ioctl handler.
- *
- *	If action is ide_preempt, then the rq is queued at the head of
- *	the request queue, displacing the currently-being-processed
- *	request and this function returns immediately without waiting
- *	for the new rq to be completed.  This is VERY DANGEROUS, and is
- *	intended for careful use by the ATAPI tape/cdrom driver code.
- *
- *	If action is ide_end, then the rq is queued at the end of the
- *	request queue, and the function returns immediately without waiting
- *	for the new rq to be completed. This is again intended for careful
- *	use by the ATAPI tape/cdrom driver code.
+ *	the rq is queued at the head of the request queue, displacing
+ *	the currently-being-processed request and this function
+ *	returns immediately without waiting for the new rq to be
+ *	completed.  This is VERY DANGEROUS, and is intended for
+ *	careful use by the ATAPI tape/cdrom driver code.
  */
- 
-int ide_do_drive_cmd (ide_drive_t *drive, struct request *rq, ide_action_t action)
+
+void ide_do_drive_cmd(ide_drive_t *drive, struct request *rq)
 {
 	unsigned long flags;
 	ide_hwgroup_t *hwgroup = HWGROUP(drive);
-	int where = ELEVATOR_INSERT_BACK;
-
-	rq->errors = 0;
-
-	if (action == ide_preempt)
-		where = ELEVATOR_INSERT_FRONT;
 
 	spin_lock_irqsave(&ide_lock, flags);
-	if (action == ide_preempt)
-		hwgroup->rq = NULL;
-	__elv_add_request(drive->queue, rq, where, 1);
+	hwgroup->rq = NULL;
+	__elv_add_request(drive->queue, rq, ELEVATOR_INSERT_FRONT, 1);
 	__generic_unplug_device(drive->queue);
 	spin_unlock_irqrestore(&ide_lock, flags);
-
-	return 0;
 }
 
 EXPORT_SYMBOL(ide_do_drive_cmd);
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index cc7991c..a562df8 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -691,7 +691,7 @@ static void idetape_queue_pc_head(ide_drive_t *drive, struct ide_atapi_pc *pc,
 	rq->cmd_flags |= REQ_PREEMPT;
 	rq->buffer = (char *) pc;
 	rq->rq_disk = tape->disk;
-	(void) ide_do_drive_cmd(drive, rq, ide_preempt);
+	ide_do_drive_cmd(drive, rq);
 }
 
 /*
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
index 58e30ef..569ffde 100644
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -245,7 +245,8 @@ static int idescsi_check_condition(ide_drive_t *drive,
 		ide_scsi_hex_dump(pc->c, 6);
 	}
 	rq->rq_disk = scsi->disk;
-	return ide_do_drive_cmd(drive, rq, ide_preempt);
+	ide_do_drive_cmd(drive, rq);
+	return 0;
 }
 
 static int idescsi_end_request(ide_drive_t *, int, int);
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 27babdf..5f08902 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -836,17 +836,7 @@ int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long);
 
 extern ide_startstop_t ide_do_reset (ide_drive_t *);
 
-/*
- * "action" parameter type for ide_do_drive_cmd() below.
- */
-typedef enum {
-	ide_wait,	/* insert rq at end of list, and wait for it */
-	ide_preempt,	/* insert rq in front of current request */
-	ide_head_wait,	/* insert rq in front of current request and wait for it */
-	ide_end		/* insert rq at end of list, but don't wait for it */
-} ide_action_t;
-
-extern int ide_do_drive_cmd(ide_drive_t *, struct request *, ide_action_t);
+extern void ide_do_drive_cmd(ide_drive_t *, struct request *);
 
 extern void ide_end_drive_cmd(ide_drive_t *, u8, u8);
 
-- 
1.5.4.2


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

* Re: [PATCH 0/2] ide: ide_do_drive_cmd cleanups
  2008-05-15  0:05 [PATCH 0/2] ide: ide_do_drive_cmd cleanups FUJITA Tomonori
  2008-05-15  0:05 ` [PATCH 1/2] ide-scsi: replace ide_do_drive_cmd with blk_execute_rq_nowait FUJITA Tomonori
@ 2008-05-16 19:44 ` Bartlomiej Zolnierkiewicz
  1 sibling, 0 replies; 4+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-16 19:44 UTC (permalink / raw)
  To: FUJITA Tomonori; +Cc: linux-ide, Borislav Petkov

On Thursday 15 May 2008, FUJITA Tomonori wrote:
> This is a sequel to the patchset "removing the on-stack struct request":
> 
> http://marc.info/?l=linux-ide&m=120964501711519&w=2
> 
> The patchset makes some stuff unnecessary anymore but I forgot to
> remove them. This patchset removes them.
> 
> This is against Bart's latest quilt tree.

Applied both patches.  Thanks!

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

end of thread, other threads:[~2008-05-16 19:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-15  0:05 [PATCH 0/2] ide: ide_do_drive_cmd cleanups FUJITA Tomonori
2008-05-15  0:05 ` [PATCH 1/2] ide-scsi: replace ide_do_drive_cmd with blk_execute_rq_nowait FUJITA Tomonori
2008-05-15  0:05   ` [PATCH 2/2] ide: remove action argument in ide_do_drive_cmd FUJITA Tomonori
2008-05-16 19:44 ` [PATCH 0/2] ide: ide_do_drive_cmd cleanups Bartlomiej Zolnierkiewicz

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.