Skip to content

Commit 03a2faa

Browse files
committed
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. Acked-by: Borislav Petkov <petkovbb@gmail.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
1 parent 3ee3830 commit 03a2faa

4 files changed

Lines changed: 18 additions & 18 deletions

File tree

‎drivers/ide/ide-atapi.c‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,8 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive)
357357

358358
/* No more interrupts */
359359
if ((stat & ATA_DRQ) == 0) {
360+
int uptodate;
361+
360362
debug_log("Packet command completed, %d bytes transferred\n",
361363
pc->xferred);
362364

@@ -395,7 +397,15 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive)
395397
dsc = 1;
396398

397399
/* Command finished - Call the callback function */
398-
drive->pc_callback(drive, dsc);
400+
uptodate = drive->pc_callback(drive, dsc);
401+
402+
if (uptodate == 0)
403+
drive->failed_pc = NULL;
404+
405+
if (blk_special_request(rq))
406+
ide_complete_rq(drive, 0);
407+
else
408+
ide_end_request(drive, uptodate, 0);
399409

400410
return ide_stopped;
401411
}

‎drivers/ide/ide-floppy.c‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static void idefloppy_update_buffers(ide_drive_t *drive,
7171
ide_end_request(drive, 1, 0);
7272
}
7373

74-
static void ide_floppy_callback(ide_drive_t *drive, int dsc)
74+
static int ide_floppy_callback(ide_drive_t *drive, int dsc)
7575
{
7676
struct ide_disk_obj *floppy = drive->driver_data;
7777
struct ide_atapi_pc *pc = drive->pc;
@@ -108,14 +108,10 @@ static void ide_floppy_callback(ide_drive_t *drive, int dsc)
108108
"Aborting request!\n");
109109
}
110110

111-
if (uptodate == 0)
112-
drive->failed_pc = NULL;
113-
114-
if (blk_special_request(rq)) {
111+
if (blk_special_request(rq))
115112
rq->errors = uptodate ? 0 : IDE_DRV_ERROR_GENERAL;
116-
ide_complete_rq(drive, 0);
117-
} else
118-
ide_end_request(drive, uptodate, 0);
113+
114+
return uptodate;
119115
}
120116

121117
static void ide_floppy_report_error(struct ide_disk_obj *floppy,

‎drivers/ide/ide-tape.c‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ static void ide_tape_kfree_buffer(idetape_tape_t *tape)
463463

464464
static void ide_tape_handle_dsc(ide_drive_t *);
465465

466-
static void ide_tape_callback(ide_drive_t *drive, int dsc)
466+
static int ide_tape_callback(ide_drive_t *drive, int dsc)
467467
{
468468
idetape_tape_t *tape = drive->driver_data;
469469
struct ide_atapi_pc *pc = drive->pc;
@@ -530,13 +530,7 @@ static void ide_tape_callback(ide_drive_t *drive, int dsc)
530530

531531
rq->errors = err;
532532

533-
if (uptodate == 0)
534-
drive->failed_pc = NULL;
535-
536-
if (blk_special_request(rq))
537-
ide_complete_rq(drive, 0);
538-
else
539-
ide_end_request(drive, uptodate, 0);
533+
return uptodate;
540534
}
541535

542536
/*

‎include/linux/ide.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ struct ide_drive_s {
619619
struct ide_atapi_pc *failed_pc;
620620

621621
/* callback for packet commands */
622-
void (*pc_callback)(struct ide_drive_s *, int);
622+
int (*pc_callback)(struct ide_drive_s *, int);
623623

624624
void (*pc_update_buffers)(struct ide_drive_s *, struct ide_atapi_pc *);
625625
int (*pc_io_buffers)(struct ide_drive_s *, struct ide_atapi_pc *,

0 commit comments

Comments
 (0)