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. Acked-by: Borislav Petkov <petkovbb@gmail.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
This commit is contained in:
parent
bfdb0b3beb
commit
5e2040fd0a
@ -70,7 +70,6 @@
|
|||||||
*/
|
*/
|
||||||
static int ide_floppy_end_request(ide_drive_t *drive, int uptodate, int nsecs)
|
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;
|
struct request *rq = drive->hwif->rq;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
@ -90,7 +89,7 @@ static int ide_floppy_end_request(ide_drive_t *drive, int uptodate, int nsecs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
floppy->failed_pc = NULL;
|
drive->failed_pc = NULL;
|
||||||
|
|
||||||
if (!blk_special_request(rq)) {
|
if (!blk_special_request(rq)) {
|
||||||
/* our real local end request function */
|
/* our real local end request function */
|
||||||
@ -121,8 +120,8 @@ static void ide_floppy_callback(ide_drive_t *drive, int dsc)
|
|||||||
|
|
||||||
ide_debug_log(IDE_DBG_FUNC, "enter");
|
ide_debug_log(IDE_DBG_FUNC, "enter");
|
||||||
|
|
||||||
if (floppy->failed_pc == pc)
|
if (drive->failed_pc == pc)
|
||||||
floppy->failed_pc = NULL;
|
drive->failed_pc = NULL;
|
||||||
|
|
||||||
if (pc->c[0] == GPCMD_READ_10 || pc->c[0] == GPCMD_WRITE_10 ||
|
if (pc->c[0] == GPCMD_READ_10 || pc->c[0] == GPCMD_WRITE_10 ||
|
||||||
(pc->rq && blk_pc_request(pc->rq)))
|
(pc->rq && blk_pc_request(pc->rq)))
|
||||||
@ -137,9 +136,9 @@ static void ide_floppy_callback(ide_drive_t *drive, int dsc)
|
|||||||
floppy->progress_indication = buf[15] & 0x80 ?
|
floppy->progress_indication = buf[15] & 0x80 ?
|
||||||
(u16)get_unaligned((u16 *)&buf[16]) : 0x10000;
|
(u16)get_unaligned((u16 *)&buf[16]) : 0x10000;
|
||||||
|
|
||||||
if (floppy->failed_pc)
|
if (drive->failed_pc)
|
||||||
ide_debug_log(IDE_DBG_PC, "pc = %x",
|
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,"
|
ide_debug_log(IDE_DBG_SENSE, "sense key = %x, asc = %x,"
|
||||||
"ascq = %x", floppy->sense_key,
|
"ascq = %x", floppy->sense_key,
|
||||||
@ -173,9 +172,9 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive,
|
|||||||
{
|
{
|
||||||
struct ide_disk_obj *floppy = drive->driver_data;
|
struct ide_disk_obj *floppy = drive->driver_data;
|
||||||
|
|
||||||
if (floppy->failed_pc == NULL &&
|
if (drive->failed_pc == NULL &&
|
||||||
pc->c[0] != GPCMD_REQUEST_SENSE)
|
pc->c[0] != GPCMD_REQUEST_SENSE)
|
||||||
floppy->failed_pc = pc;
|
drive->failed_pc = pc;
|
||||||
|
|
||||||
/* Set the current packet command */
|
/* Set the current packet command */
|
||||||
drive->pc = pc;
|
drive->pc = pc;
|
||||||
@ -186,7 +185,7 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive,
|
|||||||
/* Giving up */
|
/* Giving up */
|
||||||
pc->error = IDEFLOPPY_ERROR_GENERAL;
|
pc->error = IDEFLOPPY_ERROR_GENERAL;
|
||||||
|
|
||||||
floppy->failed_pc = NULL;
|
drive->failed_pc = NULL;
|
||||||
drive->pc_callback(drive, 0);
|
drive->pc_callback(drive, 0);
|
||||||
return ide_stopped;
|
return ide_stopped;
|
||||||
}
|
}
|
||||||
@ -290,8 +289,8 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
|
|||||||
: "dev?"));
|
: "dev?"));
|
||||||
|
|
||||||
if (rq->errors >= ERROR_MAX) {
|
if (rq->errors >= ERROR_MAX) {
|
||||||
if (floppy->failed_pc)
|
if (drive->failed_pc)
|
||||||
ide_floppy_report_error(floppy, floppy->failed_pc);
|
ide_floppy_report_error(floppy, drive->failed_pc);
|
||||||
else
|
else
|
||||||
printk(KERN_ERR PFX "%s: I/O error\n", drive->name);
|
printk(KERN_ERR PFX "%s: I/O error\n", drive->name);
|
||||||
|
|
||||||
|
@ -20,8 +20,6 @@ struct ide_disk_obj {
|
|||||||
struct device dev;
|
struct device dev;
|
||||||
unsigned int openers; /* protected by BKL for now */
|
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 */
|
/* used for blk_{fs,pc}_request() requests */
|
||||||
struct ide_atapi_pc queued_pc;
|
struct ide_atapi_pc queued_pc;
|
||||||
|
|
||||||
|
@ -171,14 +171,6 @@ typedef struct ide_tape_obj {
|
|||||||
struct gendisk *disk;
|
struct gendisk *disk;
|
||||||
struct device dev;
|
struct device dev;
|
||||||
|
|
||||||
/*
|
|
||||||
* 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 */
|
/* used by REQ_IDETAPE_{READ,WRITE} requests */
|
||||||
struct ide_atapi_pc queued_pc;
|
struct ide_atapi_pc queued_pc;
|
||||||
|
|
||||||
@ -397,7 +389,7 @@ static void idetape_update_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc)
|
|||||||
static void idetape_analyze_error(ide_drive_t *drive, u8 *sense)
|
static void idetape_analyze_error(ide_drive_t *drive, u8 *sense)
|
||||||
{
|
{
|
||||||
idetape_tape_t *tape = drive->driver_data;
|
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->sense_key = sense[2] & 0xF;
|
||||||
tape->asc = sense[12];
|
tape->asc = sense[12];
|
||||||
@ -477,7 +469,6 @@ static void ide_tape_kfree_buffer(idetape_tape_t *tape)
|
|||||||
static int idetape_end_request(ide_drive_t *drive, int uptodate, int nr_sects)
|
static int idetape_end_request(ide_drive_t *drive, int uptodate, int nr_sects)
|
||||||
{
|
{
|
||||||
struct request *rq = drive->hwif->rq;
|
struct request *rq = drive->hwif->rq;
|
||||||
idetape_tape_t *tape = drive->driver_data;
|
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
debug_log(DBG_PROCS, "Enter %s\n", __func__);
|
debug_log(DBG_PROCS, "Enter %s\n", __func__);
|
||||||
@ -489,7 +480,7 @@ static int idetape_end_request(ide_drive_t *drive, int uptodate, int nr_sects)
|
|||||||
}
|
}
|
||||||
rq->errors = error;
|
rq->errors = error;
|
||||||
if (error)
|
if (error)
|
||||||
tape->failed_pc = NULL;
|
drive->failed_pc = NULL;
|
||||||
|
|
||||||
if (!blk_special_request(rq)) {
|
if (!blk_special_request(rq)) {
|
||||||
ide_end_request(drive, uptodate, nr_sects);
|
ide_end_request(drive, uptodate, nr_sects);
|
||||||
@ -514,8 +505,8 @@ static void ide_tape_callback(ide_drive_t *drive, int dsc)
|
|||||||
if (dsc)
|
if (dsc)
|
||||||
ide_tape_handle_dsc(drive);
|
ide_tape_handle_dsc(drive);
|
||||||
|
|
||||||
if (tape->failed_pc == pc)
|
if (drive->failed_pc == pc)
|
||||||
tape->failed_pc = NULL;
|
drive->failed_pc = NULL;
|
||||||
|
|
||||||
if (pc->c[0] == REQUEST_SENSE) {
|
if (pc->c[0] == REQUEST_SENSE) {
|
||||||
if (uptodate)
|
if (uptodate)
|
||||||
@ -653,8 +644,8 @@ static ide_startstop_t idetape_issue_pc(ide_drive_t *drive,
|
|||||||
"Two request sense in serial were issued\n");
|
"Two request sense in serial were issued\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tape->failed_pc == NULL && pc->c[0] != REQUEST_SENSE)
|
if (drive->failed_pc == NULL && pc->c[0] != REQUEST_SENSE)
|
||||||
tape->failed_pc = pc;
|
drive->failed_pc = pc;
|
||||||
|
|
||||||
/* Set the current packet command */
|
/* Set the current packet command */
|
||||||
drive->pc = pc;
|
drive->pc = pc;
|
||||||
@ -680,7 +671,7 @@ static ide_startstop_t idetape_issue_pc(ide_drive_t *drive,
|
|||||||
/* Giving up */
|
/* Giving up */
|
||||||
pc->error = IDETAPE_ERROR_GENERAL;
|
pc->error = IDETAPE_ERROR_GENERAL;
|
||||||
}
|
}
|
||||||
tape->failed_pc = NULL;
|
drive->failed_pc = NULL;
|
||||||
drive->pc_callback(drive, 0);
|
drive->pc_callback(drive, 0);
|
||||||
return ide_stopped;
|
return ide_stopped;
|
||||||
}
|
}
|
||||||
@ -740,7 +731,7 @@ static ide_startstop_t idetape_media_access_finished(ide_drive_t *drive)
|
|||||||
pc->error = 0;
|
pc->error = 0;
|
||||||
} else {
|
} else {
|
||||||
pc->error = IDETAPE_ERROR_GENERAL;
|
pc->error = IDETAPE_ERROR_GENERAL;
|
||||||
tape->failed_pc = NULL;
|
drive->failed_pc = NULL;
|
||||||
}
|
}
|
||||||
drive->pc_callback(drive, 0);
|
drive->pc_callback(drive, 0);
|
||||||
return ide_stopped;
|
return ide_stopped;
|
||||||
@ -799,8 +790,8 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Retry a failed packet command */
|
/* Retry a failed packet command */
|
||||||
if (tape->failed_pc && drive->pc->c[0] == REQUEST_SENSE) {
|
if (drive->failed_pc && drive->pc->c[0] == REQUEST_SENSE) {
|
||||||
pc = tape->failed_pc;
|
pc = drive->failed_pc;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -609,6 +609,9 @@ struct ide_drive_s {
|
|||||||
/* current packet command */
|
/* current packet command */
|
||||||
struct ide_atapi_pc *pc;
|
struct ide_atapi_pc *pc;
|
||||||
|
|
||||||
|
/* last failed packet command */
|
||||||
|
struct ide_atapi_pc *failed_pc;
|
||||||
|
|
||||||
/* callback for packet commands */
|
/* callback for packet commands */
|
||||||
void (*pc_callback)(struct ide_drive_s *, int);
|
void (*pc_callback)(struct ide_drive_s *, int);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user