aboutsummaryrefslogtreecommitdiff
path: root/drivers/ide/ide-tape.c
diff options
context:
space:
mode:
authorBorislav Petkov <petkovbb@gmail.com>2009-05-02 10:26:12 +0200
committerBorislav Petkov <petkovbb@gmail.com>2009-05-15 06:44:09 +0200
commitb13345f39dadbabdabaf8819cf6df26913da9e8d (patch)
tree535a81fdf7d71c632fe759c689f4a7d4a5c70399 /drivers/ide/ide-tape.c
parent5a0e43b5e2ee9a295f864c38f0e853b1a4fc3892 (diff)
ide-atapi: add a buffer-arg to ide_queue_pc_tail
This is in preparation of removing ide_atapi_pc. Expose the buffer as an argument to ide_queue_pc_tail with later replacing it with local buffer or even kmalloc'ed one if needed due to stack usage constraints. Also, add the possibility of passing a NULL-ptr buffer for cmds which don't transfer data besides the cdb. While at it, switch to local buffer in idetape_get_mode_sense_results(). There should be no functional change resulting from this patch. Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Diffstat (limited to 'drivers/ide/ide-tape.c')
-rw-r--r--drivers/ide/ide-tape.c37
1 files changed, 18 insertions, 19 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index f09a263b72f..1f7f50473a4 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -770,7 +770,7 @@ static int idetape_flush_tape_buffers(ide_drive_t *drive)
int rc;
idetape_create_write_filemark_cmd(drive, &pc, 0);
- rc = ide_queue_pc_tail(drive, tape->disk, &pc, pc.req_xfer);
+ rc = ide_queue_pc_tail(drive, tape->disk, &pc, NULL, 0);
if (rc)
return rc;
idetape_wait_ready(drive, 60 * 5 * HZ);
@@ -793,7 +793,7 @@ static int idetape_read_position(ide_drive_t *drive)
debug_log(DBG_PROCS, "Enter %s\n", __func__);
idetape_create_read_position_cmd(&pc);
- if (ide_queue_pc_tail(drive, tape->disk, &pc, pc.req_xfer))
+ if (ide_queue_pc_tail(drive, tape->disk, &pc, pc.buf, pc.req_xfer))
return -1;
position = tape->first_frame;
return position;
@@ -846,12 +846,12 @@ static int idetape_position_tape(ide_drive_t *drive, unsigned int block,
__ide_tape_discard_merge_buffer(drive);
idetape_wait_ready(drive, 60 * 5 * HZ);
idetape_create_locate_cmd(drive, &pc, block, partition, skip);
- retval = ide_queue_pc_tail(drive, disk, &pc, pc.req_xfer);
+ retval = ide_queue_pc_tail(drive, disk, &pc, NULL, 0);
if (retval)
return (retval);
idetape_create_read_position_cmd(&pc);
- return ide_queue_pc_tail(drive, disk, &pc, pc.req_xfer);
+ return ide_queue_pc_tail(drive, disk, &pc, pc.buf, pc.req_xfer);
}
static void ide_tape_discard_merge_buffer(ide_drive_t *drive,
@@ -1047,12 +1047,12 @@ static int idetape_rewind_tape(ide_drive_t *drive)
debug_log(DBG_SENSE, "Enter %s\n", __func__);
idetape_create_rewind_cmd(drive, &pc);
- retval = ide_queue_pc_tail(drive, disk, &pc, pc.req_xfer);
+ retval = ide_queue_pc_tail(drive, disk, &pc, NULL, 0);
if (retval)
return retval;
idetape_create_read_position_cmd(&pc);
- retval = ide_queue_pc_tail(drive, disk, &pc, pc.req_xfer);
+ retval = ide_queue_pc_tail(drive, disk, &pc, pc.buf, pc.req_xfer);
if (retval)
return retval;
return 0;
@@ -1120,7 +1120,7 @@ static int idetape_space_over_filemarks(ide_drive_t *drive, short mt_op,
case MTBSF:
idetape_create_space_cmd(&pc, mt_count - count,
IDETAPE_SPACE_OVER_FILEMARK);
- return ide_queue_pc_tail(drive, disk, &pc, pc.req_xfer);
+ return ide_queue_pc_tail(drive, disk, &pc, NULL, 0);
case MTFSFM:
case MTBSFM:
if (!sprev)
@@ -1259,7 +1259,7 @@ static int idetape_write_filemark(ide_drive_t *drive)
/* Write a filemark */
idetape_create_write_filemark_cmd(drive, &pc, 1);
- if (ide_queue_pc_tail(drive, tape->disk, &pc, pc.req_xfer)) {
+ if (ide_queue_pc_tail(drive, tape->disk, &pc, NULL, 0)) {
printk(KERN_ERR "ide-tape: Couldn't write a filemark\n");
return -EIO;
}
@@ -1344,11 +1344,11 @@ static int idetape_mtioctop(ide_drive_t *drive, short mt_op, int mt_count)
IDETAPE_LU_RETENSION_MASK | IDETAPE_LU_LOAD_MASK);
case MTEOM:
idetape_create_space_cmd(&pc, 0, IDETAPE_SPACE_TO_EOD);
- return ide_queue_pc_tail(drive, disk, &pc, pc.req_xfer);
+ return ide_queue_pc_tail(drive, disk, &pc, NULL, 0);
case MTERASE:
(void)idetape_rewind_tape(drive);
idetape_create_erase_cmd(&pc);
- return ide_queue_pc_tail(drive, disk, &pc, pc.req_xfer);
+ return ide_queue_pc_tail(drive, disk, &pc, NULL, 0);
case MTSETBLK:
if (mt_count) {
if (mt_count < tape->blk_size ||
@@ -1457,7 +1457,7 @@ static void ide_tape_get_bsize_from_bdesc(ide_drive_t *drive)
struct ide_atapi_pc pc;
idetape_create_mode_sense_cmd(&pc, IDETAPE_BLOCK_DESCRIPTOR);
- if (ide_queue_pc_tail(drive, tape->disk, &pc, pc.req_xfer)) {
+ if (ide_queue_pc_tail(drive, tape->disk, &pc, pc.buf, pc.req_xfer)) {
printk(KERN_ERR "ide-tape: Can't get block descriptor\n");
if (tape->blk_size == 0) {
printk(KERN_WARNING "ide-tape: Cannot deal with zero "
@@ -1610,17 +1610,16 @@ static void idetape_get_inquiry_results(ide_drive_t *drive)
char fw_rev[4], vendor_id[8], product_id[16];
idetape_create_inquiry_cmd(&pc);
- pc.buf = &pc_buf[0];
pc.buf_size = sizeof(pc_buf);
- if (ide_queue_pc_tail(drive, tape->disk, &pc, pc.req_xfer)) {
+ if (ide_queue_pc_tail(drive, tape->disk, &pc, pc_buf, pc.req_xfer)) {
printk(KERN_ERR "ide-tape: %s: can't get INQUIRY results\n",
tape->name);
return;
}
- memcpy(vendor_id, &pc.buf[8], 8);
- memcpy(product_id, &pc.buf[16], 16);
- memcpy(fw_rev, &pc.buf[32], 4);
+ memcpy(vendor_id, &pc_buf[8], 8);
+ memcpy(product_id, &pc_buf[16], 16);
+ memcpy(fw_rev, &pc_buf[32], 4);
ide_fixstring(vendor_id, 8, 0);
ide_fixstring(product_id, 16, 0);
@@ -1638,11 +1637,11 @@ static void idetape_get_mode_sense_results(ide_drive_t *drive)
{
idetape_tape_t *tape = drive->driver_data;
struct ide_atapi_pc pc;
- u8 *caps;
+ u8 buf[24], *caps;
u8 speed, max_speed;
idetape_create_mode_sense_cmd(&pc, IDETAPE_CAPABILITIES_PAGE);
- if (ide_queue_pc_tail(drive, tape->disk, &pc, pc.req_xfer)) {
+ if (ide_queue_pc_tail(drive, tape->disk, &pc, buf, pc.req_xfer)) {
printk(KERN_ERR "ide-tape: Can't get tape parameters - assuming"
" some default values\n");
tape->blk_size = 512;
@@ -1651,7 +1650,7 @@ static void idetape_get_mode_sense_results(ide_drive_t *drive)
put_unaligned(6*52, (u16 *)&tape->caps[16]);
return;
}
- caps = pc.buf + 4 + pc.buf[3];
+ caps = buf + 4 + buf[3];
/* convert to host order and save for later use */
speed = be16_to_cpup((__be16 *)&caps[14]);