ide: drop 'timeout' and 'expiry' arguments from ide_pc_intr()
* Move idescsi_expiry() to ide-atapi.c. * Move get_timeout() to <linux/ide.h>. * Drop 'timeout' and 'expiry' arguments from ide_pc_intr(). While at it: * idescsi_expiry() -> ide_scsi_expiry() * get_timeout() -> ide_scsi_get_timeout() There should be no functional changes caused by this patch. Cc: Borislav Petkov <petkovbb@gmail.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
This commit is contained in:
Родитель
2b9efba482
Коммит
844b946852
|
@ -203,9 +203,21 @@ int ide_set_media_lock(ide_drive_t *drive, struct gendisk *disk, int on)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(ide_set_media_lock);
|
EXPORT_SYMBOL_GPL(ide_set_media_lock);
|
||||||
|
|
||||||
|
int ide_scsi_expiry(ide_drive_t *drive)
|
||||||
|
{
|
||||||
|
struct ide_atapi_pc *pc = drive->pc;
|
||||||
|
|
||||||
|
debug_log("%s called for %lu at %lu\n", __func__,
|
||||||
|
pc->scsi_cmd->serial_number, jiffies);
|
||||||
|
|
||||||
|
pc->flags |= PC_FLAG_TIMEDOUT;
|
||||||
|
|
||||||
|
return 0; /* we do not want the IDE subsystem to retry */
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(ide_scsi_expiry);
|
||||||
|
|
||||||
/* TODO: unify the code thus making some arguments go away */
|
/* TODO: unify the code thus making some arguments go away */
|
||||||
ide_startstop_t ide_pc_intr(ide_drive_t *drive,
|
ide_startstop_t ide_pc_intr(ide_drive_t *drive, ide_handler_t *handler,
|
||||||
ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry,
|
|
||||||
void (*update_buffers)(ide_drive_t *, struct ide_atapi_pc *),
|
void (*update_buffers)(ide_drive_t *, struct ide_atapi_pc *),
|
||||||
void (*retry_pc)(ide_drive_t *),
|
void (*retry_pc)(ide_drive_t *),
|
||||||
int (*io_buffers)(ide_drive_t *, struct ide_atapi_pc *, unsigned, int))
|
int (*io_buffers)(ide_drive_t *, struct ide_atapi_pc *, unsigned, int))
|
||||||
|
@ -215,12 +227,22 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive,
|
||||||
struct request *rq = hwif->hwgroup->rq;
|
struct request *rq = hwif->hwgroup->rq;
|
||||||
const struct ide_tp_ops *tp_ops = hwif->tp_ops;
|
const struct ide_tp_ops *tp_ops = hwif->tp_ops;
|
||||||
xfer_func_t *xferfunc;
|
xfer_func_t *xferfunc;
|
||||||
unsigned int temp;
|
ide_expiry_t *expiry;
|
||||||
|
unsigned int timeout, temp;
|
||||||
u16 bcount;
|
u16 bcount;
|
||||||
u8 stat, ireason, scsi = drive->scsi, dsc = 0;
|
u8 stat, ireason, scsi = drive->scsi, dsc = 0;
|
||||||
|
|
||||||
debug_log("Enter %s - interrupt handler\n", __func__);
|
debug_log("Enter %s - interrupt handler\n", __func__);
|
||||||
|
|
||||||
|
if (scsi) {
|
||||||
|
timeout = ide_scsi_get_timeout(pc);
|
||||||
|
expiry = ide_scsi_expiry;
|
||||||
|
} else {
|
||||||
|
timeout = (drive->media == ide_floppy) ? WAIT_FLOPPY_CMD
|
||||||
|
: WAIT_TAPE_CMD;
|
||||||
|
expiry = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (pc->flags & PC_FLAG_TIMEDOUT) {
|
if (pc->flags & PC_FLAG_TIMEDOUT) {
|
||||||
drive->pc_callback(drive, 0);
|
drive->pc_callback(drive, 0);
|
||||||
return ide_stopped;
|
return ide_stopped;
|
||||||
|
@ -347,9 +369,7 @@ cmd_finished:
|
||||||
pc->xferred += temp;
|
pc->xferred += temp;
|
||||||
pc->cur_pos += temp;
|
pc->cur_pos += temp;
|
||||||
ide_pad_transfer(drive, 0, bcount - temp);
|
ide_pad_transfer(drive, 0, bcount - temp);
|
||||||
ide_set_handler(drive, handler, timeout,
|
goto next_irq;
|
||||||
expiry);
|
|
||||||
return ide_started;
|
|
||||||
}
|
}
|
||||||
debug_log("The device wants to send us more data than "
|
debug_log("The device wants to send us more data than "
|
||||||
"expected - allowing transfer\n");
|
"expected - allowing transfer\n");
|
||||||
|
@ -376,7 +396,7 @@ cmd_finished:
|
||||||
|
|
||||||
debug_log("[cmd %x] transferred %d bytes on that intr.\n",
|
debug_log("[cmd %x] transferred %d bytes on that intr.\n",
|
||||||
rq->cmd[0], bcount);
|
rq->cmd[0], bcount);
|
||||||
|
next_irq:
|
||||||
/* And set the interrupt handler again */
|
/* And set the interrupt handler again */
|
||||||
ide_set_handler(drive, handler, timeout, expiry);
|
ide_set_handler(drive, handler, timeout, expiry);
|
||||||
return ide_started;
|
return ide_started;
|
||||||
|
|
|
@ -219,8 +219,7 @@ static void idefloppy_retry_pc(ide_drive_t *drive)
|
||||||
/* The usual interrupt handler called during a packet command. */
|
/* The usual interrupt handler called during a packet command. */
|
||||||
static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive)
|
static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive)
|
||||||
{
|
{
|
||||||
return ide_pc_intr(drive, idefloppy_pc_intr,
|
return ide_pc_intr(drive, idefloppy_pc_intr, idefloppy_update_buffers,
|
||||||
WAIT_FLOPPY_CMD, NULL, idefloppy_update_buffers,
|
|
||||||
idefloppy_retry_pc, ide_io_buffers);
|
idefloppy_retry_pc, ide_io_buffers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -655,9 +655,8 @@ static int ide_tape_io_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc,
|
||||||
*/
|
*/
|
||||||
static ide_startstop_t idetape_pc_intr(ide_drive_t *drive)
|
static ide_startstop_t idetape_pc_intr(ide_drive_t *drive)
|
||||||
{
|
{
|
||||||
return ide_pc_intr(drive, idetape_pc_intr, WAIT_TAPE_CMD,
|
return ide_pc_intr(drive, idetape_pc_intr, idetape_update_buffers,
|
||||||
NULL, idetape_update_buffers, idetape_retry_pc,
|
idetape_retry_pc, ide_tape_io_buffers);
|
||||||
ide_tape_io_buffers);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -270,36 +270,19 @@ static int idescsi_end_request (ide_drive_t *drive, int uptodate, int nrsecs)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned long get_timeout(struct ide_atapi_pc *pc)
|
|
||||||
{
|
|
||||||
return max_t(unsigned long, WAIT_CMD, pc->timeout - jiffies);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int idescsi_expiry(ide_drive_t *drive)
|
|
||||||
{
|
|
||||||
struct ide_atapi_pc *pc = drive->pc;
|
|
||||||
|
|
||||||
debug_log("%s called for %lu at %lu\n", __func__,
|
|
||||||
pc->scsi_cmd->serial_number, jiffies);
|
|
||||||
|
|
||||||
pc->flags |= PC_FLAG_TIMEDOUT;
|
|
||||||
|
|
||||||
return 0; /* we do not want the ide subsystem to retry */
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Our interrupt handler.
|
* Our interrupt handler.
|
||||||
*/
|
*/
|
||||||
static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
|
static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
|
||||||
{
|
{
|
||||||
return ide_pc_intr(drive, idescsi_pc_intr, get_timeout(drive->pc),
|
return ide_pc_intr(drive, idescsi_pc_intr, NULL, NULL, ide_io_buffers);
|
||||||
idescsi_expiry, NULL, NULL, ide_io_buffers);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static ide_startstop_t idescsi_transfer_pc(ide_drive_t *drive)
|
static ide_startstop_t idescsi_transfer_pc(ide_drive_t *drive)
|
||||||
{
|
{
|
||||||
return ide_transfer_pc(drive, idescsi_pc_intr,
|
return ide_transfer_pc(drive, idescsi_pc_intr,
|
||||||
get_timeout(drive->pc), idescsi_expiry);
|
ide_scsi_get_timeout(drive->pc),
|
||||||
|
ide_scsi_expiry);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int idescsi_set_direction(struct ide_atapi_pc *pc)
|
static inline int idescsi_set_direction(struct ide_atapi_pc *pc)
|
||||||
|
@ -348,7 +331,7 @@ static ide_startstop_t idescsi_issue_pc(ide_drive_t *drive,
|
||||||
drive->pc = pc;
|
drive->pc = pc;
|
||||||
|
|
||||||
return ide_issue_pc(drive, idescsi_transfer_pc,
|
return ide_issue_pc(drive, idescsi_transfer_pc,
|
||||||
get_timeout(pc), idescsi_expiry);
|
ide_scsi_get_timeout(pc), ide_scsi_expiry);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1175,8 +1175,14 @@ int ide_do_test_unit_ready(ide_drive_t *, struct gendisk *);
|
||||||
int ide_do_start_stop(ide_drive_t *, struct gendisk *, int);
|
int ide_do_start_stop(ide_drive_t *, struct gendisk *, int);
|
||||||
int ide_set_media_lock(ide_drive_t *, struct gendisk *, int);
|
int ide_set_media_lock(ide_drive_t *, struct gendisk *, int);
|
||||||
|
|
||||||
ide_startstop_t ide_pc_intr(ide_drive_t *drive,
|
static inline unsigned long ide_scsi_get_timeout(struct ide_atapi_pc *pc)
|
||||||
ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry,
|
{
|
||||||
|
return max_t(unsigned long, WAIT_CMD, pc->timeout - jiffies);
|
||||||
|
}
|
||||||
|
|
||||||
|
int ide_scsi_expiry(ide_drive_t *);
|
||||||
|
|
||||||
|
ide_startstop_t ide_pc_intr(ide_drive_t *drive, ide_handler_t *handler,
|
||||||
void (*update_buffers)(ide_drive_t *, struct ide_atapi_pc *),
|
void (*update_buffers)(ide_drive_t *, struct ide_atapi_pc *),
|
||||||
void (*retry_pc)(ide_drive_t *),
|
void (*retry_pc)(ide_drive_t *),
|
||||||
int (*io_buffers)(ide_drive_t *, struct ide_atapi_pc *, unsigned int,
|
int (*io_buffers)(ide_drive_t *, struct ide_atapi_pc *, unsigned int,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче