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 | |
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')
-rw-r--r-- | drivers/ide/ide-atapi.c | 12 | ||||
-rw-r--r-- | drivers/ide/ide-floppy.c | 17 | ||||
-rw-r--r-- | drivers/ide/ide-floppy_ioctl.c | 16 | ||||
-rw-r--r-- | drivers/ide/ide-tape.c | 37 |
4 files changed, 40 insertions, 42 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index 0d4da2c1adc1..b12be1f17f14 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c | |||
@@ -84,7 +84,7 @@ EXPORT_SYMBOL_GPL(ide_init_pc); | |||
84 | * and wait for it to be serviced. | 84 | * and wait for it to be serviced. |
85 | */ | 85 | */ |
86 | int ide_queue_pc_tail(ide_drive_t *drive, struct gendisk *disk, | 86 | int ide_queue_pc_tail(ide_drive_t *drive, struct gendisk *disk, |
87 | struct ide_atapi_pc *pc, unsigned int bufflen) | 87 | struct ide_atapi_pc *pc, void *buf, unsigned int bufflen) |
88 | { | 88 | { |
89 | struct request *rq; | 89 | struct request *rq; |
90 | int error; | 90 | int error; |
@@ -93,8 +93,8 @@ int ide_queue_pc_tail(ide_drive_t *drive, struct gendisk *disk, | |||
93 | rq->cmd_type = REQ_TYPE_SPECIAL; | 93 | rq->cmd_type = REQ_TYPE_SPECIAL; |
94 | rq->special = (char *)pc; | 94 | rq->special = (char *)pc; |
95 | 95 | ||
96 | if (bufflen) { | 96 | if (buf && bufflen) { |
97 | error = blk_rq_map_kern(drive->queue, rq, pc->buf, bufflen, | 97 | error = blk_rq_map_kern(drive->queue, rq, buf, bufflen, |
98 | GFP_NOIO); | 98 | GFP_NOIO); |
99 | if (error) | 99 | if (error) |
100 | goto put_req; | 100 | goto put_req; |
@@ -117,7 +117,7 @@ int ide_do_test_unit_ready(ide_drive_t *drive, struct gendisk *disk) | |||
117 | ide_init_pc(&pc); | 117 | ide_init_pc(&pc); |
118 | pc.c[0] = TEST_UNIT_READY; | 118 | pc.c[0] = TEST_UNIT_READY; |
119 | 119 | ||
120 | return ide_queue_pc_tail(drive, disk, &pc, 0); | 120 | return ide_queue_pc_tail(drive, disk, &pc, NULL, 0); |
121 | } | 121 | } |
122 | EXPORT_SYMBOL_GPL(ide_do_test_unit_ready); | 122 | EXPORT_SYMBOL_GPL(ide_do_test_unit_ready); |
123 | 123 | ||
@@ -132,7 +132,7 @@ int ide_do_start_stop(ide_drive_t *drive, struct gendisk *disk, int start) | |||
132 | if (drive->media == ide_tape) | 132 | if (drive->media == ide_tape) |
133 | pc.flags |= PC_FLAG_WAIT_FOR_DSC; | 133 | pc.flags |= PC_FLAG_WAIT_FOR_DSC; |
134 | 134 | ||
135 | return ide_queue_pc_tail(drive, disk, &pc, 0); | 135 | return ide_queue_pc_tail(drive, disk, &pc, NULL, 0); |
136 | } | 136 | } |
137 | EXPORT_SYMBOL_GPL(ide_do_start_stop); | 137 | EXPORT_SYMBOL_GPL(ide_do_start_stop); |
138 | 138 | ||
@@ -147,7 +147,7 @@ int ide_set_media_lock(ide_drive_t *drive, struct gendisk *disk, int on) | |||
147 | pc.c[0] = ALLOW_MEDIUM_REMOVAL; | 147 | pc.c[0] = ALLOW_MEDIUM_REMOVAL; |
148 | pc.c[4] = on; | 148 | pc.c[4] = on; |
149 | 149 | ||
150 | return ide_queue_pc_tail(drive, disk, &pc, 0); | 150 | return ide_queue_pc_tail(drive, disk, &pc, NULL, 0); |
151 | } | 151 | } |
152 | EXPORT_SYMBOL_GPL(ide_set_media_lock); | 152 | EXPORT_SYMBOL_GPL(ide_set_media_lock); |
153 | 153 | ||
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index 5df00d4ab8da..be21cf23f8cb 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c | |||
@@ -318,7 +318,7 @@ static int ide_floppy_get_flexible_disk_page(ide_drive_t *drive, | |||
318 | 318 | ||
319 | ide_floppy_create_mode_sense_cmd(pc, IDEFLOPPY_FLEXIBLE_DISK_PAGE); | 319 | ide_floppy_create_mode_sense_cmd(pc, IDEFLOPPY_FLEXIBLE_DISK_PAGE); |
320 | 320 | ||
321 | if (ide_queue_pc_tail(drive, disk, pc, pc->req_xfer)) { | 321 | if (ide_queue_pc_tail(drive, disk, pc, pc->buf, pc->req_xfer)) { |
322 | printk(KERN_ERR PFX "Can't get flexible disk page params\n"); | 322 | printk(KERN_ERR PFX "Can't get flexible disk page params\n"); |
323 | return 1; | 323 | return 1; |
324 | } | 324 | } |
@@ -387,22 +387,21 @@ static int ide_floppy_get_capacity(ide_drive_t *drive) | |||
387 | drive->capacity64 = 0; | 387 | drive->capacity64 = 0; |
388 | 388 | ||
389 | ide_floppy_create_read_capacity_cmd(&pc); | 389 | ide_floppy_create_read_capacity_cmd(&pc); |
390 | pc.buf = &pc_buf[0]; | ||
391 | pc.buf_size = sizeof(pc_buf); | 390 | pc.buf_size = sizeof(pc_buf); |
392 | 391 | ||
393 | if (ide_queue_pc_tail(drive, disk, &pc, pc.req_xfer)) { | 392 | if (ide_queue_pc_tail(drive, disk, &pc, pc_buf, pc.req_xfer)) { |
394 | printk(KERN_ERR PFX "Can't get floppy parameters\n"); | 393 | printk(KERN_ERR PFX "Can't get floppy parameters\n"); |
395 | return 1; | 394 | return 1; |
396 | } | 395 | } |
397 | header_len = pc.buf[3]; | 396 | header_len = pc_buf[3]; |
398 | cap_desc = &pc.buf[4]; | 397 | cap_desc = &pc_buf[4]; |
399 | desc_cnt = header_len / 8; /* capacity descriptor of 8 bytes */ | 398 | desc_cnt = header_len / 8; /* capacity descriptor of 8 bytes */ |
400 | 399 | ||
401 | for (i = 0; i < desc_cnt; i++) { | 400 | for (i = 0; i < desc_cnt; i++) { |
402 | unsigned int desc_start = 4 + i*8; | 401 | unsigned int desc_start = 4 + i*8; |
403 | 402 | ||
404 | blocks = be32_to_cpup((__be32 *)&pc.buf[desc_start]); | 403 | blocks = be32_to_cpup((__be32 *)&pc_buf[desc_start]); |
405 | length = be16_to_cpup((__be16 *)&pc.buf[desc_start + 6]); | 404 | length = be16_to_cpup((__be16 *)&pc_buf[desc_start + 6]); |
406 | 405 | ||
407 | ide_debug_log(IDE_DBG_PROBE, "Descriptor %d: %dkB, %d blocks, " | 406 | ide_debug_log(IDE_DBG_PROBE, "Descriptor %d: %dkB, %d blocks, " |
408 | "%d sector size", | 407 | "%d sector size", |
@@ -415,7 +414,7 @@ static int ide_floppy_get_capacity(ide_drive_t *drive) | |||
415 | * the code below is valid only for the 1st descriptor, ie i=0 | 414 | * the code below is valid only for the 1st descriptor, ie i=0 |
416 | */ | 415 | */ |
417 | 416 | ||
418 | switch (pc.buf[desc_start + 4] & 0x03) { | 417 | switch (pc_buf[desc_start + 4] & 0x03) { |
419 | /* Clik! drive returns this instead of CAPACITY_CURRENT */ | 418 | /* Clik! drive returns this instead of CAPACITY_CURRENT */ |
420 | case CAPACITY_UNFORMATTED: | 419 | case CAPACITY_UNFORMATTED: |
421 | if (!(drive->atapi_flags & IDE_AFLAG_CLIK_DRIVE)) | 420 | if (!(drive->atapi_flags & IDE_AFLAG_CLIK_DRIVE)) |
@@ -464,7 +463,7 @@ static int ide_floppy_get_capacity(ide_drive_t *drive) | |||
464 | break; | 463 | break; |
465 | } | 464 | } |
466 | ide_debug_log(IDE_DBG_PROBE, "Descriptor 0 Code: %d", | 465 | ide_debug_log(IDE_DBG_PROBE, "Descriptor 0 Code: %d", |
467 | pc.buf[desc_start + 4] & 0x03); | 466 | pc_buf[desc_start + 4] & 0x03); |
468 | } | 467 | } |
469 | 468 | ||
470 | /* Clik! disk does not support get_flexible_disk_page */ | 469 | /* Clik! disk does not support get_flexible_disk_page */ |
diff --git a/drivers/ide/ide-floppy_ioctl.c b/drivers/ide/ide-floppy_ioctl.c index 75f1d50276a4..9c2518d7514d 100644 --- a/drivers/ide/ide-floppy_ioctl.c +++ b/drivers/ide/ide-floppy_ioctl.c | |||
@@ -47,15 +47,14 @@ static int ide_floppy_get_format_capacities(ide_drive_t *drive, | |||
47 | return -EINVAL; | 47 | return -EINVAL; |
48 | 48 | ||
49 | ide_floppy_create_read_capacity_cmd(pc); | 49 | ide_floppy_create_read_capacity_cmd(pc); |
50 | pc->buf = &pc_buf[0]; | ||
51 | pc->buf_size = sizeof(pc_buf); | 50 | pc->buf_size = sizeof(pc_buf); |
52 | 51 | ||
53 | if (ide_queue_pc_tail(drive, floppy->disk, pc, pc->req_xfer)) { | 52 | if (ide_queue_pc_tail(drive, floppy->disk, pc, pc_buf, pc->req_xfer)) { |
54 | printk(KERN_ERR "ide-floppy: Can't get floppy parameters\n"); | 53 | printk(KERN_ERR "ide-floppy: Can't get floppy parameters\n"); |
55 | return -EIO; | 54 | return -EIO; |
56 | } | 55 | } |
57 | 56 | ||
58 | header_len = pc->buf[3]; | 57 | header_len = pc_buf[3]; |
59 | desc_cnt = header_len / 8; /* capacity descriptor of 8 bytes */ | 58 | desc_cnt = header_len / 8; /* capacity descriptor of 8 bytes */ |
60 | 59 | ||
61 | u_index = 0; | 60 | u_index = 0; |
@@ -72,8 +71,8 @@ static int ide_floppy_get_format_capacities(ide_drive_t *drive, | |||
72 | if (u_index >= u_array_size) | 71 | if (u_index >= u_array_size) |
73 | break; /* User-supplied buffer too small */ | 72 | break; /* User-supplied buffer too small */ |
74 | 73 | ||
75 | blocks = be32_to_cpup((__be32 *)&pc->buf[desc_start]); | 74 | blocks = be32_to_cpup((__be32 *)&pc_buf[desc_start]); |
76 | length = be16_to_cpup((__be16 *)&pc->buf[desc_start + 6]); | 75 | length = be16_to_cpup((__be16 *)&pc_buf[desc_start + 6]); |
77 | 76 | ||
78 | if (put_user(blocks, argp)) | 77 | if (put_user(blocks, argp)) |
79 | return -EFAULT; | 78 | return -EFAULT; |
@@ -124,7 +123,7 @@ static int ide_floppy_get_sfrp_bit(ide_drive_t *drive, struct ide_atapi_pc *pc) | |||
124 | ide_floppy_create_mode_sense_cmd(pc, IDEFLOPPY_CAPABILITIES_PAGE); | 123 | ide_floppy_create_mode_sense_cmd(pc, IDEFLOPPY_CAPABILITIES_PAGE); |
125 | pc->flags |= PC_FLAG_SUPPRESS_ERROR; | 124 | pc->flags |= PC_FLAG_SUPPRESS_ERROR; |
126 | 125 | ||
127 | if (ide_queue_pc_tail(drive, floppy->disk, pc, pc->req_xfer)) | 126 | if (ide_queue_pc_tail(drive, floppy->disk, pc, pc->buf, pc->req_xfer)) |
128 | return 1; | 127 | return 1; |
129 | 128 | ||
130 | if (pc->buf[8 + 2] & 0x40) | 129 | if (pc->buf[8 + 2] & 0x40) |
@@ -172,7 +171,7 @@ static int ide_floppy_format_unit(ide_drive_t *drive, struct ide_atapi_pc *pc, | |||
172 | ide_floppy_get_sfrp_bit(drive, pc); | 171 | ide_floppy_get_sfrp_bit(drive, pc); |
173 | ide_floppy_create_format_unit_cmd(pc, blocks, length, flags); | 172 | ide_floppy_create_format_unit_cmd(pc, blocks, length, flags); |
174 | 173 | ||
175 | if (ide_queue_pc_tail(drive, floppy->disk, pc, pc->req_xfer)) | 174 | if (ide_queue_pc_tail(drive, floppy->disk, pc, pc->buf, pc->req_xfer)) |
176 | err = -EIO; | 175 | err = -EIO; |
177 | 176 | ||
178 | out: | 177 | out: |
@@ -200,7 +199,8 @@ static int ide_floppy_get_format_progress(ide_drive_t *drive, | |||
200 | 199 | ||
201 | if (drive->atapi_flags & IDE_AFLAG_SRFP) { | 200 | if (drive->atapi_flags & IDE_AFLAG_SRFP) { |
202 | ide_create_request_sense_cmd(drive, pc); | 201 | ide_create_request_sense_cmd(drive, pc); |
203 | if (ide_queue_pc_tail(drive, floppy->disk, pc, pc->req_xfer)) | 202 | if (ide_queue_pc_tail(drive, floppy->disk, pc, pc->buf, |
203 | pc->req_xfer)) | ||
204 | return -EIO; | 204 | return -EIO; |
205 | 205 | ||
206 | if (floppy->sense_key == 2 && | 206 | if (floppy->sense_key == 2 && |
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]); |