Commit 63f5abb0 authored by FUJITA Tomonori's avatar FUJITA Tomonori Committed by Bartlomiej Zolnierkiewicz

ide: remove action argument in ide_do_drive_cmd

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: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent 7e12ca11
...@@ -213,7 +213,7 @@ static void cdrom_queue_request_sense(ide_drive_t *drive, void *sense, ...@@ -213,7 +213,7 @@ static void cdrom_queue_request_sense(ide_drive_t *drive, void *sense,
/* NOTE! Save the failed command in "rq->buffer" */ /* NOTE! Save the failed command in "rq->buffer" */
rq->buffer = (void *) failed_command; 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) static void cdrom_end_request(ide_drive_t *drive, int uptodate)
......
...@@ -291,7 +291,7 @@ static void idefloppy_queue_pc_head(ide_drive_t *drive, struct ide_atapi_pc *pc, ...@@ -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_type = REQ_TYPE_SPECIAL;
rq->cmd_flags |= REQ_PREEMPT; rq->cmd_flags |= REQ_PREEMPT;
rq->rq_disk = floppy->disk; 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) static struct ide_atapi_pc *idefloppy_next_pc_storage(ide_drive_t *drive)
......
...@@ -1520,49 +1520,27 @@ irqreturn_t ide_intr (int irq, void *dev_id) ...@@ -1520,49 +1520,27 @@ irqreturn_t ide_intr (int irq, void *dev_id)
* ide_do_drive_cmd - issue IDE special command * ide_do_drive_cmd - issue IDE special command
* @drive: device to issue command * @drive: device to issue command
* @rq: request to issue * @rq: request to issue
* @action: action for processing
* *
* This function issues a special IDE device request * This function issues a special IDE device request
* onto the request queue. * onto the request queue.
* *
* If action is ide_wait, then the rq is queued at the end of the * the rq is queued at the head of the request queue, displacing
* request queue, and the function sleeps until it has been processed. * the currently-being-processed request and this function
* This is for use when invoked from an ioctl handler. * returns immediately without waiting for the new rq to be
* * completed. This is VERY DANGEROUS, and is intended for
* If action is ide_preempt, then the rq is queued at the head of * careful use by the ATAPI tape/cdrom driver code.
* 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.
*/ */
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; unsigned long flags;
ide_hwgroup_t *hwgroup = HWGROUP(drive); 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); spin_lock_irqsave(&ide_lock, flags);
if (action == ide_preempt) hwgroup->rq = NULL;
hwgroup->rq = NULL; __elv_add_request(drive->queue, rq, ELEVATOR_INSERT_FRONT, 1);
__elv_add_request(drive->queue, rq, where, 1);
__generic_unplug_device(drive->queue); __generic_unplug_device(drive->queue);
/* the queue is stopped so it won't be plugged+unplugged */
if (blk_pm_resume_request(rq))
do_ide_request(drive->queue);
spin_unlock_irqrestore(&ide_lock, flags); spin_unlock_irqrestore(&ide_lock, flags);
return 0;
} }
EXPORT_SYMBOL(ide_do_drive_cmd); EXPORT_SYMBOL(ide_do_drive_cmd);
......
...@@ -691,7 +691,7 @@ static void idetape_queue_pc_head(ide_drive_t *drive, struct ide_atapi_pc *pc, ...@@ -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->cmd_flags |= REQ_PREEMPT;
rq->buffer = (char *) pc; rq->buffer = (char *) pc;
rq->rq_disk = tape->disk; rq->rq_disk = tape->disk;
(void) ide_do_drive_cmd(drive, rq, ide_preempt); ide_do_drive_cmd(drive, rq);
} }
/* /*
......
...@@ -245,7 +245,8 @@ static int idescsi_check_condition(ide_drive_t *drive, ...@@ -245,7 +245,8 @@ static int idescsi_check_condition(ide_drive_t *drive,
ide_scsi_hex_dump(pc->c, 6); ide_scsi_hex_dump(pc->c, 6);
} }
rq->rq_disk = scsi->disk; 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); static int idescsi_end_request(ide_drive_t *, int, int);
......
...@@ -851,17 +851,7 @@ int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long); ...@@ -851,17 +851,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 *); extern ide_startstop_t ide_do_reset (ide_drive_t *);
/* extern void ide_do_drive_cmd(ide_drive_t *, struct request *);
* "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_end_drive_cmd(ide_drive_t *, u8, u8); extern void ide_end_drive_cmd(ide_drive_t *, u8, u8);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment