aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-ioctls.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-27 07:46:37 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-27 07:46:37 -0400
commit22aa4b32a19b1f231d4ce7e9af6354b577a22a35 (patch)
tree3e773e7102e4ea6bb6b4c00edce442c4e8f37edb /drivers/ide/ide-ioctls.c
parente6830a86c260d73c6f370aa7ed17ee6c71e5ee05 (diff)
ide: remove ide_task_t typedef
While at it: - rename struct ide_task_s to struct ide_cmd - remove stale comments from idedisk_{read_native,set}_max_address() - drop unused 'cmd' argument from ide_{cmd,task}_ioctl() - drop unused 'task' argument from tx4939ide_tf_load_fixup() - rename ide_complete_task() to ide_complete_cmd() - use consistent naming for struct ide_cmd variables There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-ioctls.c')
-rw-r--r--drivers/ide/ide-ioctls.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/drivers/ide/ide-ioctls.c b/drivers/ide/ide-ioctls.c
index 1be263eb9c07..4953028a13d4 100644
--- a/drivers/ide/ide-ioctls.c
+++ b/drivers/ide/ide-ioctls.c
@@ -111,13 +111,13 @@ static int ide_set_nice_ioctl(ide_drive_t *drive, unsigned long arg)
111 return 0; 111 return 0;
112} 112}
113 113
114static int ide_cmd_ioctl(ide_drive_t *drive, unsigned cmd, unsigned long arg) 114static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg)
115{ 115{
116 u8 *buf = NULL; 116 u8 *buf = NULL;
117 int bufsize = 0, err = 0; 117 int bufsize = 0, err = 0;
118 u8 args[4], xfer_rate = 0; 118 u8 args[4], xfer_rate = 0;
119 ide_task_t tfargs; 119 struct ide_cmd cmd;
120 struct ide_taskfile *tf = &tfargs.tf; 120 struct ide_taskfile *tf = &cmd.tf;
121 u16 *id = drive->id; 121 u16 *id = drive->id;
122 122
123 if (NULL == (void *) arg) { 123 if (NULL == (void *) arg) {
@@ -134,24 +134,24 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned cmd, unsigned long arg)
134 if (copy_from_user(args, (void __user *)arg, 4)) 134 if (copy_from_user(args, (void __user *)arg, 4))
135 return -EFAULT; 135 return -EFAULT;
136 136
137 memset(&tfargs, 0, sizeof(ide_task_t)); 137 memset(&cmd, 0, sizeof(cmd));
138 tf->feature = args[2]; 138 tf->feature = args[2];
139 if (args[0] == ATA_CMD_SMART) { 139 if (args[0] == ATA_CMD_SMART) {
140 tf->nsect = args[3]; 140 tf->nsect = args[3];
141 tf->lbal = args[1]; 141 tf->lbal = args[1];
142 tf->lbam = 0x4f; 142 tf->lbam = 0x4f;
143 tf->lbah = 0xc2; 143 tf->lbah = 0xc2;
144 tfargs.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_IN_NSECT; 144 cmd.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_IN_NSECT;
145 } else { 145 } else {
146 tf->nsect = args[1]; 146 tf->nsect = args[1];
147 tfargs.tf_flags = IDE_TFLAG_OUT_FEATURE | 147 cmd.tf_flags = IDE_TFLAG_OUT_FEATURE | IDE_TFLAG_OUT_NSECT |
148 IDE_TFLAG_OUT_NSECT | IDE_TFLAG_IN_NSECT; 148 IDE_TFLAG_IN_NSECT;
149 } 149 }
150 tf->command = args[0]; 150 tf->command = args[0];
151 tfargs.data_phase = args[3] ? TASKFILE_IN : TASKFILE_NO_DATA; 151 cmd.data_phase = args[3] ? TASKFILE_IN : TASKFILE_NO_DATA;
152 152
153 if (args[3]) { 153 if (args[3]) {
154 tfargs.tf_flags |= IDE_TFLAG_IO_16BIT; 154 cmd.tf_flags |= IDE_TFLAG_IO_16BIT;
155 bufsize = SECTOR_SIZE * args[3]; 155 bufsize = SECTOR_SIZE * args[3];
156 buf = kzalloc(bufsize, GFP_KERNEL); 156 buf = kzalloc(bufsize, GFP_KERNEL);
157 if (buf == NULL) 157 if (buf == NULL)
@@ -172,7 +172,7 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned cmd, unsigned long arg)
172 } 172 }
173 } 173 }
174 174
175 err = ide_raw_taskfile(drive, &tfargs, buf, args[3]); 175 err = ide_raw_taskfile(drive, &cmd, buf, args[3]);
176 176
177 args[0] = tf->status; 177 args[0] = tf->status;
178 args[1] = tf->error; 178 args[1] = tf->error;
@@ -194,25 +194,25 @@ abort:
194 return err; 194 return err;
195} 195}
196 196
197static int ide_task_ioctl(ide_drive_t *drive, unsigned cmd, unsigned long arg) 197static int ide_task_ioctl(ide_drive_t *drive, unsigned long arg)
198{ 198{
199 void __user *p = (void __user *)arg; 199 void __user *p = (void __user *)arg;
200 int err = 0; 200 int err = 0;
201 u8 args[7]; 201 u8 args[7];
202 ide_task_t task; 202 struct ide_cmd cmd;
203 203
204 if (copy_from_user(args, p, 7)) 204 if (copy_from_user(args, p, 7))
205 return -EFAULT; 205 return -EFAULT;
206 206
207 memset(&task, 0, sizeof(task)); 207 memset(&cmd, 0, sizeof(cmd));
208 memcpy(&task.tf_array[7], &args[1], 6); 208 memcpy(&cmd.tf_array[7], &args[1], 6);
209 task.tf.command = args[0]; 209 cmd.tf.command = args[0];
210 task.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; 210 cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE;
211 211
212 err = ide_no_data_taskfile(drive, &task); 212 err = ide_no_data_taskfile(drive, &cmd);
213 213
214 args[0] = task.tf.command; 214 args[0] = cmd.tf.command;
215 memcpy(&args[1], &task.tf_array[7], 6); 215 memcpy(&args[1], &cmd.tf_array[7], 6);
216 216
217 if (copy_to_user(p, args, 7)) 217 if (copy_to_user(p, args, 7))
218 err = -EFAULT; 218 err = -EFAULT;
@@ -262,17 +262,17 @@ int generic_ide_ioctl(ide_drive_t *drive, struct block_device *bdev,
262 if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO)) 262 if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO))
263 return -EACCES; 263 return -EACCES;
264 if (drive->media == ide_disk) 264 if (drive->media == ide_disk)
265 return ide_taskfile_ioctl(drive, cmd, arg); 265 return ide_taskfile_ioctl(drive, arg);
266 return -ENOMSG; 266 return -ENOMSG;
267#endif 267#endif
268 case HDIO_DRIVE_CMD: 268 case HDIO_DRIVE_CMD:
269 if (!capable(CAP_SYS_RAWIO)) 269 if (!capable(CAP_SYS_RAWIO))
270 return -EACCES; 270 return -EACCES;
271 return ide_cmd_ioctl(drive, cmd, arg); 271 return ide_cmd_ioctl(drive, arg);
272 case HDIO_DRIVE_TASK: 272 case HDIO_DRIVE_TASK:
273 if (!capable(CAP_SYS_RAWIO)) 273 if (!capable(CAP_SYS_RAWIO))
274 return -EACCES; 274 return -EACCES;
275 return ide_task_ioctl(drive, cmd, arg); 275 return ide_task_ioctl(drive, arg);
276 case HDIO_DRIVE_RESET: 276 case HDIO_DRIVE_RESET:
277 if (!capable(CAP_SYS_ADMIN)) 277 if (!capable(CAP_SYS_ADMIN))
278 return -EACCES; 278 return -EACCES;