diff options
author | Borislav Petkov <petkovbb@gmail.com> | 2009-05-02 04:26:12 -0400 |
---|---|---|
committer | Borislav Petkov <petkovbb@gmail.com> | 2009-05-15 00:44:09 -0400 |
commit | b13345f39dadbabdabaf8819cf6df26913da9e8d (patch) | |
tree | 535a81fdf7d71c632fe759c689f4a7d4a5c70399 /drivers/ide/ide-tape.c | |
parent | 5a0e43b5e2ee9a295f864c38f0e853b1a4fc3892 (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.c | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index f09a263b72f2..1f7f50473a4f 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) | |||
770 | int rc; | 770 | int rc; |
771 | 771 | ||
772 | idetape_create_write_filemark_cmd(drive, &pc, 0); | 772 | idetape_create_write_filemark_cmd(drive, &pc, 0); |
773 | rc = ide_queue_pc_tail(drive, tape->disk, &pc, pc.req_xfer); | 773 | rc = ide_queue_pc_tail(drive, tape->disk, &pc, NULL, 0); |
774 | if (rc) | 774 | if (rc) |
775 | return rc; | 775 | return rc; |
776 | idetape_wait_ready(drive, 60 * 5 * HZ); | 776 | idetape_wait_ready(drive, 60 * 5 * HZ); |
@@ -793,7 +793,7 @@ static int idetape_read_position(ide_drive_t *drive) | |||
793 | debug_log(DBG_PROCS, "Enter %s\n", __func__); | 793 | debug_log(DBG_PROCS, "Enter %s\n", __func__); |
794 | 794 | ||
795 | idetape_create_read_position_cmd(&pc); | 795 | idetape_create_read_position_cmd(&pc); |
796 | if (ide_queue_pc_tail(drive, tape->disk, &pc, pc.req_xfer)) | 796 | if (ide_queue_pc_tail(drive, tape->disk, &pc, pc.buf, pc.req_xfer)) |
797 | return -1; | 797 | return -1; |
798 | position = tape->first_frame; | 798 | position = tape->first_frame; |
799 | return position; | 799 | return position; |
@@ -846,12 +846,12 @@ static int idetape_position_tape(ide_drive_t *drive, unsigned int block, | |||
846 | __ide_tape_discard_merge_buffer(drive); | 846 | __ide_tape_discard_merge_buffer(drive); |
847 | idetape_wait_ready(drive, 60 * 5 * HZ); | 847 | idetape_wait_ready(drive, 60 * 5 * HZ); |
848 | idetape_create_locate_cmd(drive, &pc, block, partition, skip); | 848 | idetape_create_locate_cmd(drive, &pc, block, partition, skip); |
849 | retval = ide_queue_pc_tail(drive, disk, &pc, pc.req_xfer); | 849 | retval = ide_queue_pc_tail(drive, disk, &pc, NULL, 0); |
850 | if (retval) | 850 | if (retval) |
851 | return (retval); | 851 | return (retval); |
852 | 852 | ||
853 | idetape_create_read_position_cmd(&pc); | 853 | idetape_create_read_position_cmd(&pc); |
854 | return ide_queue_pc_tail(drive, disk, &pc, pc.req_xfer); | 854 | return ide_queue_pc_tail(drive, disk, &pc, pc.buf, pc.req_xfer); |
855 | } | 855 | } |
856 | 856 | ||
857 | static void ide_tape_discard_merge_buffer(ide_drive_t *drive, | 857 | static void ide_tape_discard_merge_buffer(ide_drive_t *drive, |
@@ -1047,12 +1047,12 @@ static int idetape_rewind_tape(ide_drive_t *drive) | |||
1047 | debug_log(DBG_SENSE, "Enter %s\n", __func__); | 1047 | debug_log(DBG_SENSE, "Enter %s\n", __func__); |
1048 | 1048 | ||
1049 | idetape_create_rewind_cmd(drive, &pc); | 1049 | idetape_create_rewind_cmd(drive, &pc); |
1050 | retval = ide_queue_pc_tail(drive, disk, &pc, pc.req_xfer); | 1050 | retval = ide_queue_pc_tail(drive, disk, &pc, NULL, 0); |
1051 | if (retval) | 1051 | if (retval) |
1052 | return retval; | 1052 | return retval; |
1053 | 1053 | ||
1054 | idetape_create_read_position_cmd(&pc); | 1054 | idetape_create_read_position_cmd(&pc); |
1055 | retval = ide_queue_pc_tail(drive, disk, &pc, pc.req_xfer); | 1055 | retval = ide_queue_pc_tail(drive, disk, &pc, pc.buf, pc.req_xfer); |
1056 | if (retval) | 1056 | if (retval) |
1057 | return retval; | 1057 | return retval; |
1058 | return 0; | 1058 | return 0; |
@@ -1120,7 +1120,7 @@ static int idetape_space_over_filemarks(ide_drive_t *drive, short mt_op, | |||
1120 | case MTBSF: | 1120 | case MTBSF: |
1121 | idetape_create_space_cmd(&pc, mt_count - count, | 1121 | idetape_create_space_cmd(&pc, mt_count - count, |
1122 | IDETAPE_SPACE_OVER_FILEMARK); | 1122 | IDETAPE_SPACE_OVER_FILEMARK); |
1123 | return ide_queue_pc_tail(drive, disk, &pc, pc.req_xfer); | 1123 | return ide_queue_pc_tail(drive, disk, &pc, NULL, 0); |
1124 | case MTFSFM: | 1124 | case MTFSFM: |
1125 | case MTBSFM: | 1125 | case MTBSFM: |
1126 | if (!sprev) | 1126 | if (!sprev) |
@@ -1259,7 +1259,7 @@ static int idetape_write_filemark(ide_drive_t *drive) | |||
1259 | 1259 | ||
1260 | /* Write a filemark */ | 1260 | /* Write a filemark */ |
1261 | idetape_create_write_filemark_cmd(drive, &pc, 1); | 1261 | idetape_create_write_filemark_cmd(drive, &pc, 1); |
1262 | if (ide_queue_pc_tail(drive, tape->disk, &pc, pc.req_xfer)) { | 1262 | if (ide_queue_pc_tail(drive, tape->disk, &pc, NULL, 0)) { |
1263 | printk(KERN_ERR "ide-tape: Couldn't write a filemark\n"); | 1263 | printk(KERN_ERR "ide-tape: Couldn't write a filemark\n"); |
1264 | return -EIO; | 1264 | return -EIO; |
1265 | } | 1265 | } |
@@ -1344,11 +1344,11 @@ static int idetape_mtioctop(ide_drive_t *drive, short mt_op, int mt_count) | |||
1344 | IDETAPE_LU_RETENSION_MASK | IDETAPE_LU_LOAD_MASK); | 1344 | IDETAPE_LU_RETENSION_MASK | IDETAPE_LU_LOAD_MASK); |
1345 | case MTEOM: | 1345 | case MTEOM: |
1346 | idetape_create_space_cmd(&pc, 0, IDETAPE_SPACE_TO_EOD); | 1346 | idetape_create_space_cmd(&pc, 0, IDETAPE_SPACE_TO_EOD); |
1347 | return ide_queue_pc_tail(drive, disk, &pc, pc.req_xfer); | 1347 | return ide_queue_pc_tail(drive, disk, &pc, NULL, 0); |
1348 | case MTERASE: | 1348 | case MTERASE: |
1349 | (void)idetape_rewind_tape(drive); | 1349 | (void)idetape_rewind_tape(drive); |
1350 | idetape_create_erase_cmd(&pc); | 1350 | idetape_create_erase_cmd(&pc); |
1351 | return ide_queue_pc_tail(drive, disk, &pc, pc.req_xfer); | 1351 | return ide_queue_pc_tail(drive, disk, &pc, NULL, 0); |
1352 | case MTSETBLK: | 1352 | case MTSETBLK: |
1353 | if (mt_count) { | 1353 | if (mt_count) { |
1354 | if (mt_count < tape->blk_size || | 1354 | if (mt_count < tape->blk_size || |
@@ -1457,7 +1457,7 @@ static void ide_tape_get_bsize_from_bdesc(ide_drive_t *drive) | |||
1457 | struct ide_atapi_pc pc; | 1457 | struct ide_atapi_pc pc; |
1458 | 1458 | ||
1459 | idetape_create_mode_sense_cmd(&pc, IDETAPE_BLOCK_DESCRIPTOR); | 1459 | idetape_create_mode_sense_cmd(&pc, IDETAPE_BLOCK_DESCRIPTOR); |
1460 | if (ide_queue_pc_tail(drive, tape->disk, &pc, pc.req_xfer)) { | 1460 | if (ide_queue_pc_tail(drive, tape->disk, &pc, pc.buf, pc.req_xfer)) { |
1461 | printk(KERN_ERR "ide-tape: Can't get block descriptor\n"); | 1461 | printk(KERN_ERR "ide-tape: Can't get block descriptor\n"); |
1462 | if (tape->blk_size == 0) { | 1462 | if (tape->blk_size == 0) { |
1463 | printk(KERN_WARNING "ide-tape: Cannot deal with zero " | 1463 | printk(KERN_WARNING "ide-tape: Cannot deal with zero " |
@@ -1610,17 +1610,16 @@ static void idetape_get_inquiry_results(ide_drive_t *drive) | |||
1610 | char fw_rev[4], vendor_id[8], product_id[16]; | 1610 | char fw_rev[4], vendor_id[8], product_id[16]; |
1611 | 1611 | ||
1612 | idetape_create_inquiry_cmd(&pc); | 1612 | idetape_create_inquiry_cmd(&pc); |
1613 | pc.buf = &pc_buf[0]; | ||
1614 | pc.buf_size = sizeof(pc_buf); | 1613 | pc.buf_size = sizeof(pc_buf); |
1615 | 1614 | ||
1616 | if (ide_queue_pc_tail(drive, tape->disk, &pc, pc.req_xfer)) { | 1615 | if (ide_queue_pc_tail(drive, tape->disk, &pc, pc_buf, pc.req_xfer)) { |
1617 | printk(KERN_ERR "ide-tape: %s: can't get INQUIRY results\n", | 1616 | printk(KERN_ERR "ide-tape: %s: can't get INQUIRY results\n", |
1618 | tape->name); | 1617 | tape->name); |
1619 | return; | 1618 | return; |
1620 | } | 1619 | } |
1621 | memcpy(vendor_id, &pc.buf[8], 8); | 1620 | memcpy(vendor_id, &pc_buf[8], 8); |
1622 | memcpy(product_id, &pc.buf[16], 16); | 1621 | memcpy(product_id, &pc_buf[16], 16); |
1623 | memcpy(fw_rev, &pc.buf[32], 4); | 1622 | memcpy(fw_rev, &pc_buf[32], 4); |
1624 | 1623 | ||
1625 | ide_fixstring(vendor_id, 8, 0); | 1624 | ide_fixstring(vendor_id, 8, 0); |
1626 | ide_fixstring(product_id, 16, 0); | 1625 | ide_fixstring(product_id, 16, 0); |
@@ -1638,11 +1637,11 @@ static void idetape_get_mode_sense_results(ide_drive_t *drive) | |||
1638 | { | 1637 | { |
1639 | idetape_tape_t *tape = drive->driver_data; | 1638 | idetape_tape_t *tape = drive->driver_data; |
1640 | struct ide_atapi_pc pc; | 1639 | struct ide_atapi_pc pc; |
1641 | u8 *caps; | 1640 | u8 buf[24], *caps; |
1642 | u8 speed, max_speed; | 1641 | u8 speed, max_speed; |
1643 | 1642 | ||
1644 | idetape_create_mode_sense_cmd(&pc, IDETAPE_CAPABILITIES_PAGE); | 1643 | idetape_create_mode_sense_cmd(&pc, IDETAPE_CAPABILITIES_PAGE); |
1645 | if (ide_queue_pc_tail(drive, tape->disk, &pc, pc.req_xfer)) { | 1644 | if (ide_queue_pc_tail(drive, tape->disk, &pc, buf, pc.req_xfer)) { |
1646 | printk(KERN_ERR "ide-tape: Can't get tape parameters - assuming" | 1645 | printk(KERN_ERR "ide-tape: Can't get tape parameters - assuming" |
1647 | " some default values\n"); | 1646 | " some default values\n"); |
1648 | tape->blk_size = 512; | 1647 | tape->blk_size = 512; |
@@ -1651,7 +1650,7 @@ static void idetape_get_mode_sense_results(ide_drive_t *drive) | |||
1651 | put_unaligned(6*52, (u16 *)&tape->caps[16]); | 1650 | put_unaligned(6*52, (u16 *)&tape->caps[16]); |
1652 | return; | 1651 | return; |
1653 | } | 1652 | } |
1654 | caps = pc.buf + 4 + pc.buf[3]; | 1653 | caps = buf + 4 + buf[3]; |
1655 | 1654 | ||
1656 | /* convert to host order and save for later use */ | 1655 | /* convert to host order and save for later use */ |
1657 | speed = be16_to_cpup((__be16 *)&caps[14]); | 1656 | speed = be16_to_cpup((__be16 *)&caps[14]); |