Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 83353
b: refs/heads/master
c: a1efc85
h: refs/heads/master
i:
  83351: 1d3ce24
v: v3
  • Loading branch information
Borislav Petkov authored and Bartlomiej Zolnierkiewicz committed Feb 6, 2008
1 parent 6e6e862 commit 1cf255e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 27 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 37016bab601c2fecfe833d2feda42e6c6f9b08c8
refs/heads/master: a1efc85f0b4d48627ef0b2aeb766a39fb4a00561
54 changes: 28 additions & 26 deletions trunk/drivers/ide/ide-tape.c
Original file line number Diff line number Diff line change
Expand Up @@ -1104,19 +1104,22 @@ static void idetape_postpone_request (ide_drive_t *drive)
ide_stall_queue(drive, tape->dsc_polling_frequency);
}

typedef void idetape_io_buf(ide_drive_t *, idetape_pc_t *, unsigned int);

/*
* idetape_pc_intr is the usual interrupt handler which will be called
* during a packet command. We will transfer some of the data (as
* requested by the drive) and will re-point interrupt handler to us.
* When data transfer is finished, we will act according to the
* algorithm described before idetape_issue_packet_command.
*
* This is the usual interrupt handler which will be called during a packet
* command. We will transfer some of the data (as requested by the drive) and
* will re-point interrupt handler to us. When data transfer is finished, we
* will act according to the algorithm described before
* idetape_issue_packet_command.
*/
static ide_startstop_t idetape_pc_intr (ide_drive_t *drive)
static ide_startstop_t idetape_pc_intr(ide_drive_t *drive)
{
ide_hwif_t *hwif = drive->hwif;
idetape_tape_t *tape = drive->driver_data;
idetape_pc_t *pc = tape->pc;
xfer_func_t *xferfunc;
idetape_io_buf *iobuf;
unsigned int temp;
#if SIMULATE_ERRORS
static int error_sim_count = 0;
Expand Down Expand Up @@ -1184,7 +1187,8 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive)
debug_log(DBG_ERR, "%s: I/O error\n", tape->name);

if (pc->c[0] == REQUEST_SENSE) {
printk(KERN_ERR "ide-tape: I/O error in request sense command\n");
printk(KERN_ERR "ide-tape: I/O error in request"
" sense command\n");
return ide_do_reset(drive);
}
debug_log(DBG_ERR, "[cmd %x]: check condition\n",
Expand Down Expand Up @@ -1223,7 +1227,7 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive)
ireason = hwif->INB(IDE_IREASON_REG);

if (ireason & CD) {
printk(KERN_ERR "ide-tape: CoD != 0 in idetape_pc_intr\n");
printk(KERN_ERR "ide-tape: CoD != 0 in %s\n", __func__);
return ide_do_reset(drive);
}
if (((ireason & IO) == IO) == test_bit(PC_WRITING, &pc->flags)) {
Expand All @@ -1239,31 +1243,29 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive)
temp = pc->actually_transferred + bcount;
if (temp > pc->request_transfer) {
if (temp > pc->buffer_size) {
printk(KERN_ERR "ide-tape: The tape wants to send us more data than expected - discarding data\n");
printk(KERN_ERR "ide-tape: The tape wants to "
"send us more data than expected "
"- discarding data\n");
idetape_discard_data(drive, bcount);
ide_set_handler(drive, &idetape_pc_intr, IDETAPE_WAIT_CMD, NULL);
ide_set_handler(drive, &idetape_pc_intr,
IDETAPE_WAIT_CMD, NULL);
return ide_started;
}
debug_log(DBG_SENSE, "The tape wants to send us more "
"data than expected - allowing transfer\n");

}
}
if (test_bit(PC_WRITING, &pc->flags)) {
if (pc->bh != NULL)
idetape_output_buffers(drive, pc, bcount);
else
/* Write the current buffer */
hwif->atapi_output_bytes(drive, pc->current_position,
bcount);
iobuf = &idetape_input_buffers;
xferfunc = hwif->atapi_input_bytes;
} else {
if (pc->bh != NULL)
idetape_input_buffers(drive, pc, bcount);
else
/* Read the current buffer */
hwif->atapi_input_bytes(drive, pc->current_position,
bcount);
iobuf = &idetape_output_buffers;
xferfunc = hwif->atapi_output_bytes;
}

if (pc->bh)
iobuf(drive, pc, bcount);
else
xferfunc(drive, pc->current_position, bcount);

/* Update the current position */
pc->actually_transferred += bcount;
pc->current_position += bcount;
Expand Down

0 comments on commit 1cf255e

Please sign in to comment.