aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-floppy_ioctl.c
diff options
context:
space:
mode:
authorBorislav Petkov <petkovbb@gmail.com>2009-05-02 04:26:12 -0400
committerBorislav Petkov <petkovbb@gmail.com>2009-05-15 00:44:09 -0400
commitb13345f39dadbabdabaf8819cf6df26913da9e8d (patch)
tree535a81fdf7d71c632fe759c689f4a7d4a5c70399 /drivers/ide/ide-floppy_ioctl.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-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,
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
178out: 177out:
@@ -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 &&