summaryrefslogtreecommitdiff
path: root/drivers/ide/ide-floppy_ioctl.c
diff options
context:
space:
mode:
authorBorislav Petkov <petkovbb@gmail.com>2009-05-02 12:26:12 +0400
committerBorislav Petkov <petkovbb@gmail.com>2009-05-15 08:44:09 +0400
commitb13345f39dadbabdabaf8819cf6df26913da9e8d (patch)
tree535a81fdf7d71c632fe759c689f4a7d4a5c70399 /drivers/ide/ide-floppy_ioctl.c
parent5a0e43b5e2ee9a295f864c38f0e853b1a4fc3892 (diff)
downloadlinux-b13345f39dadbabdabaf8819cf6df26913da9e8d.tar.xz
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_ioctl.c')
-rw-r--r--drivers/ide/ide-floppy_ioctl.c16
1 files changed, 8 insertions, 8 deletions
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,
return -EINVAL;
ide_floppy_create_read_capacity_cmd(pc);
- pc->buf = &pc_buf[0];
pc->buf_size = sizeof(pc_buf);
- if (ide_queue_pc_tail(drive, floppy->disk, pc, pc->req_xfer)) {
+ if (ide_queue_pc_tail(drive, floppy->disk, pc, pc_buf, pc->req_xfer)) {
printk(KERN_ERR "ide-floppy: Can't get floppy parameters\n");
return -EIO;
}
- header_len = pc->buf[3];
+ header_len = pc_buf[3];
desc_cnt = header_len / 8; /* capacity descriptor of 8 bytes */
u_index = 0;
@@ -72,8 +71,8 @@ static int ide_floppy_get_format_capacities(ide_drive_t *drive,
if (u_index >= u_array_size)
break; /* User-supplied buffer too small */
- blocks = be32_to_cpup((__be32 *)&pc->buf[desc_start]);
- length = be16_to_cpup((__be16 *)&pc->buf[desc_start + 6]);
+ blocks = be32_to_cpup((__be32 *)&pc_buf[desc_start]);
+ length = be16_to_cpup((__be16 *)&pc_buf[desc_start + 6]);
if (put_user(blocks, argp))
return -EFAULT;
@@ -124,7 +123,7 @@ static int ide_floppy_get_sfrp_bit(ide_drive_t *drive, struct ide_atapi_pc *pc)
ide_floppy_create_mode_sense_cmd(pc, IDEFLOPPY_CAPABILITIES_PAGE);
pc->flags |= PC_FLAG_SUPPRESS_ERROR;
- if (ide_queue_pc_tail(drive, floppy->disk, pc, pc->req_xfer))
+ if (ide_queue_pc_tail(drive, floppy->disk, pc, pc->buf, pc->req_xfer))
return 1;
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,
ide_floppy_get_sfrp_bit(drive, pc);
ide_floppy_create_format_unit_cmd(pc, blocks, length, flags);
- if (ide_queue_pc_tail(drive, floppy->disk, pc, pc->req_xfer))
+ if (ide_queue_pc_tail(drive, floppy->disk, pc, pc->buf, pc->req_xfer))
err = -EIO;
out:
@@ -200,7 +199,8 @@ static int ide_floppy_get_format_progress(ide_drive_t *drive,
if (drive->atapi_flags & IDE_AFLAG_SRFP) {
ide_create_request_sense_cmd(drive, pc);
- if (ide_queue_pc_tail(drive, floppy->disk, pc, pc->req_xfer))
+ if (ide_queue_pc_tail(drive, floppy->disk, pc, pc->buf,
+ pc->req_xfer))
return -EIO;
if (floppy->sense_key == 2 &&