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-floppy.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-floppy.c')
-rw-r--r-- | drivers/ide/ide-floppy.c | 17 |
1 files changed, 8 insertions, 9 deletions
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 */ |