aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorBorislav Petkov <petkovbb@gmail.com>2009-05-02 04:53:10 -0400
committerBorislav Petkov <petkovbb@gmail.com>2009-05-15 00:44:20 -0400
commit5122e5174f872c9f3120c8aff71c448f84b6f038 (patch)
treee8fd073a587ff015fa73850f9a352f8c126fdc9b /drivers/ide
parent802e663427b16c77368a4fb2f77c105fbfffd68c (diff)
ide-floppy/ide_floppy_format_unit: use local buffer
Pass the buffer into ide_floppy_create_format_unit_cmd instead of using pc->buf. 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-floppy_ioctl.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/ide/ide-floppy_ioctl.c b/drivers/ide/ide-floppy_ioctl.c
index 0d2c9f0368da..7a03d34bc240 100644
--- a/drivers/ide/ide-floppy_ioctl.c
+++ b/drivers/ide/ide-floppy_ioctl.c
@@ -93,24 +93,25 @@ static int ide_floppy_get_format_capacities(ide_drive_t *drive,
93 return 0; 93 return 0;
94} 94}
95 95
96static void ide_floppy_create_format_unit_cmd(struct ide_atapi_pc *pc, int b, 96static void ide_floppy_create_format_unit_cmd(struct ide_atapi_pc *pc,
97 int l, int flags) 97 u8 *buf, int b, int l,
98 int flags)
98{ 99{
99 ide_init_pc(pc); 100 ide_init_pc(pc);
100 pc->c[0] = GPCMD_FORMAT_UNIT; 101 pc->c[0] = GPCMD_FORMAT_UNIT;
101 pc->c[1] = 0x17; 102 pc->c[1] = 0x17;
102 103
103 memset(pc->buf, 0, 12); 104 memset(buf, 0, 12);
104 pc->buf[1] = 0xA2; 105 buf[1] = 0xA2;
105 /* Default format list header, u8 1: FOV/DCRT/IMM bits set */ 106 /* Default format list header, u8 1: FOV/DCRT/IMM bits set */
106 107
107 if (flags & 1) /* Verify bit on... */ 108 if (flags & 1) /* Verify bit on... */
108 pc->buf[1] ^= 0x20; /* ... turn off DCRT bit */ 109 buf[1] ^= 0x20; /* ... turn off DCRT bit */
109 pc->buf[3] = 8; 110 buf[3] = 8;
110 111
111 put_unaligned(cpu_to_be32(b), (unsigned int *)(&pc->buf[4])); 112 put_unaligned(cpu_to_be32(b), (unsigned int *)(&buf[4]));
112 put_unaligned(cpu_to_be32(l), (unsigned int *)(&pc->buf[8])); 113 put_unaligned(cpu_to_be32(l), (unsigned int *)(&buf[8]));
113 pc->buf_size = 12; 114 pc->req_xfer = 12;
114 pc->flags |= PC_FLAG_WRITING; 115 pc->flags |= PC_FLAG_WRITING;
115} 116}
116 117
@@ -137,6 +138,7 @@ static int ide_floppy_format_unit(ide_drive_t *drive, struct ide_atapi_pc *pc,
137 int __user *arg) 138 int __user *arg)
138{ 139{
139 struct ide_disk_obj *floppy = drive->driver_data; 140 struct ide_disk_obj *floppy = drive->driver_data;
141 u8 buf[12];
140 int blocks, length, flags, err = 0; 142 int blocks, length, flags, err = 0;
141 143
142 if (floppy->openers > 1) { 144 if (floppy->openers > 1) {
@@ -170,9 +172,9 @@ static int ide_floppy_format_unit(ide_drive_t *drive, struct ide_atapi_pc *pc,
170 } 172 }
171 173
172 ide_floppy_get_sfrp_bit(drive, pc); 174 ide_floppy_get_sfrp_bit(drive, pc);
173 ide_floppy_create_format_unit_cmd(pc, blocks, length, flags); 175 ide_floppy_create_format_unit_cmd(pc, buf, blocks, length, flags);
174 176
175 if (ide_queue_pc_tail(drive, floppy->disk, pc, pc->buf, pc->req_xfer)) 177 if (ide_queue_pc_tail(drive, floppy->disk, pc, buf, pc->req_xfer))
176 err = -EIO; 178 err = -EIO;
177 179
178out: 180out: