aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-disk.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-disk.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-disk.c')
-rw-r--r--drivers/ide/ide-disk.c121
1 files changed, 62 insertions, 59 deletions
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 912be155a8c1..6647cb8bd910 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -62,24 +62,24 @@ static const u8 ide_data_phases[] = {
62 TASKFILE_OUT_DMA, 62 TASKFILE_OUT_DMA,
63}; 63};
64 64
65static void ide_tf_set_cmd(ide_drive_t *drive, ide_task_t *task, u8 dma) 65static void ide_tf_set_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 dma)
66{ 66{
67 u8 index, lba48, write; 67 u8 index, lba48, write;
68 68
69 lba48 = (task->tf_flags & IDE_TFLAG_LBA48) ? 2 : 0; 69 lba48 = (cmd->tf_flags & IDE_TFLAG_LBA48) ? 2 : 0;
70 write = (task->tf_flags & IDE_TFLAG_WRITE) ? 1 : 0; 70 write = (cmd->tf_flags & IDE_TFLAG_WRITE) ? 1 : 0;
71 71
72 if (dma) 72 if (dma)
73 index = 8; 73 index = 8;
74 else 74 else
75 index = drive->mult_count ? 0 : 4; 75 index = drive->mult_count ? 0 : 4;
76 76
77 task->tf.command = ide_rw_cmds[index + lba48 + write]; 77 cmd->tf.command = ide_rw_cmds[index + lba48 + write];
78 78
79 if (dma) 79 if (dma)
80 index = 8; /* fixup index */ 80 index = 8; /* fixup index */
81 81
82 task->data_phase = ide_data_phases[index / 2 + write]; 82 cmd->data_phase = ide_data_phases[index / 2 + write];
83} 83}
84 84
85/* 85/*
@@ -93,8 +93,8 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
93 u16 nsectors = (u16)rq->nr_sectors; 93 u16 nsectors = (u16)rq->nr_sectors;
94 u8 lba48 = !!(drive->dev_flags & IDE_DFLAG_LBA48); 94 u8 lba48 = !!(drive->dev_flags & IDE_DFLAG_LBA48);
95 u8 dma = !!(drive->dev_flags & IDE_DFLAG_USING_DMA); 95 u8 dma = !!(drive->dev_flags & IDE_DFLAG_USING_DMA);
96 ide_task_t task; 96 struct ide_cmd cmd;
97 struct ide_taskfile *tf = &task.tf; 97 struct ide_taskfile *tf = &cmd.tf;
98 ide_startstop_t rc; 98 ide_startstop_t rc;
99 99
100 if ((hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA) && lba48 && dma) { 100 if ((hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA) && lba48 && dma) {
@@ -109,8 +109,8 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
109 ide_map_sg(drive, rq); 109 ide_map_sg(drive, rq);
110 } 110 }
111 111
112 memset(&task, 0, sizeof(task)); 112 memset(&cmd, 0, sizeof(cmd));
113 task.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; 113 cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE;
114 114
115 if (drive->dev_flags & IDE_DFLAG_LBA) { 115 if (drive->dev_flags & IDE_DFLAG_LBA) {
116 if (lba48) { 116 if (lba48) {
@@ -129,7 +129,7 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
129 tf->lbam = (u8)(block >> 8); 129 tf->lbam = (u8)(block >> 8);
130 tf->lbah = (u8)(block >> 16); 130 tf->lbah = (u8)(block >> 16);
131 131
132 task.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_HOB); 132 cmd.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_HOB);
133 } else { 133 } else {
134 tf->nsect = nsectors & 0xff; 134 tf->nsect = nsectors & 0xff;
135 tf->lbal = block; 135 tf->lbal = block;
@@ -157,19 +157,19 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
157 } 157 }
158 158
159 if (rq_data_dir(rq)) 159 if (rq_data_dir(rq))
160 task.tf_flags |= IDE_TFLAG_WRITE; 160 cmd.tf_flags |= IDE_TFLAG_WRITE;
161 161
162 ide_tf_set_cmd(drive, &task, dma); 162 ide_tf_set_cmd(drive, &cmd, dma);
163 task.rq = rq; 163 cmd.rq = rq;
164 164
165 rc = do_rw_taskfile(drive, &task); 165 rc = do_rw_taskfile(drive, &cmd);
166 166
167 if (rc == ide_stopped && dma) { 167 if (rc == ide_stopped && dma) {
168 /* fallback to PIO */ 168 /* fallback to PIO */
169 task.tf_flags |= IDE_TFLAG_DMA_PIO_FALLBACK; 169 cmd.tf_flags |= IDE_TFLAG_DMA_PIO_FALLBACK;
170 ide_tf_set_cmd(drive, &task, 0); 170 ide_tf_set_cmd(drive, &cmd, 0);
171 ide_init_sg_cmd(drive, rq); 171 ide_init_sg_cmd(drive, rq);
172 rc = do_rw_taskfile(drive, &task); 172 rc = do_rw_taskfile(drive, &cmd);
173 } 173 }
174 174
175 return rc; 175 return rc;
@@ -213,22 +213,22 @@ static ide_startstop_t ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
213 */ 213 */
214static u64 idedisk_read_native_max_address(ide_drive_t *drive, int lba48) 214static u64 idedisk_read_native_max_address(ide_drive_t *drive, int lba48)
215{ 215{
216 ide_task_t args; 216 struct ide_cmd cmd;
217 struct ide_taskfile *tf = &args.tf; 217 struct ide_taskfile *tf = &cmd.tf;
218 u64 addr = 0; 218 u64 addr = 0;
219 219
220 /* Create IDE/ATA command request structure */ 220 memset(&cmd, 0, sizeof(cmd));
221 memset(&args, 0, sizeof(ide_task_t));
222 if (lba48) 221 if (lba48)
223 tf->command = ATA_CMD_READ_NATIVE_MAX_EXT; 222 tf->command = ATA_CMD_READ_NATIVE_MAX_EXT;
224 else 223 else
225 tf->command = ATA_CMD_READ_NATIVE_MAX; 224 tf->command = ATA_CMD_READ_NATIVE_MAX;
226 tf->device = ATA_LBA; 225 tf->device = ATA_LBA;
227 args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; 226
227 cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE;
228 if (lba48) 228 if (lba48)
229 args.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_HOB); 229 cmd.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_HOB);
230 /* submit command request */ 230
231 ide_no_data_taskfile(drive, &args); 231 ide_no_data_taskfile(drive, &cmd);
232 232
233 /* if OK, compute maximum address value */ 233 /* if OK, compute maximum address value */
234 if ((tf->status & 0x01) == 0) 234 if ((tf->status & 0x01) == 0)
@@ -243,13 +243,13 @@ static u64 idedisk_read_native_max_address(ide_drive_t *drive, int lba48)
243 */ 243 */
244static u64 idedisk_set_max_address(ide_drive_t *drive, u64 addr_req, int lba48) 244static u64 idedisk_set_max_address(ide_drive_t *drive, u64 addr_req, int lba48)
245{ 245{
246 ide_task_t args; 246 struct ide_cmd cmd;
247 struct ide_taskfile *tf = &args.tf; 247 struct ide_taskfile *tf = &cmd.tf;
248 u64 addr_set = 0; 248 u64 addr_set = 0;
249 249
250 addr_req--; 250 addr_req--;
251 /* Create IDE/ATA command request structure */ 251
252 memset(&args, 0, sizeof(ide_task_t)); 252 memset(&cmd, 0, sizeof(cmd));
253 tf->lbal = (addr_req >> 0) & 0xff; 253 tf->lbal = (addr_req >> 0) & 0xff;
254 tf->lbam = (addr_req >>= 8) & 0xff; 254 tf->lbam = (addr_req >>= 8) & 0xff;
255 tf->lbah = (addr_req >>= 8) & 0xff; 255 tf->lbah = (addr_req >>= 8) & 0xff;
@@ -263,11 +263,13 @@ static u64 idedisk_set_max_address(ide_drive_t *drive, u64 addr_req, int lba48)
263 tf->command = ATA_CMD_SET_MAX; 263 tf->command = ATA_CMD_SET_MAX;
264 } 264 }
265 tf->device |= ATA_LBA; 265 tf->device |= ATA_LBA;
266 args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; 266
267 cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE;
267 if (lba48) 268 if (lba48)
268 args.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_HOB); 269 cmd.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_HOB);
269 /* submit command request */ 270
270 ide_no_data_taskfile(drive, &args); 271 ide_no_data_taskfile(drive, &cmd);
272
271 /* if OK, compute maximum address value */ 273 /* if OK, compute maximum address value */
272 if ((tf->status & 0x01) == 0) 274 if ((tf->status & 0x01) == 0)
273 addr_set = ide_get_lba_addr(tf, lba48) + 1; 275 addr_set = ide_get_lba_addr(tf, lba48) + 1;
@@ -386,24 +388,24 @@ static int ide_disk_get_capacity(ide_drive_t *drive)
386static void idedisk_prepare_flush(struct request_queue *q, struct request *rq) 388static void idedisk_prepare_flush(struct request_queue *q, struct request *rq)
387{ 389{
388 ide_drive_t *drive = q->queuedata; 390 ide_drive_t *drive = q->queuedata;
389 ide_task_t *task = kmalloc(sizeof(*task), GFP_ATOMIC); 391 struct ide_cmd *cmd = kmalloc(sizeof(*cmd), GFP_ATOMIC);
390 392
391 /* FIXME: map struct ide_taskfile on rq->cmd[] */ 393 /* FIXME: map struct ide_taskfile on rq->cmd[] */
392 BUG_ON(task == NULL); 394 BUG_ON(cmd == NULL);
393 395
394 memset(task, 0, sizeof(*task)); 396 memset(cmd, 0, sizeof(*cmd));
395 if (ata_id_flush_ext_enabled(drive->id) && 397 if (ata_id_flush_ext_enabled(drive->id) &&
396 (drive->capacity64 >= (1UL << 28))) 398 (drive->capacity64 >= (1UL << 28)))
397 task->tf.command = ATA_CMD_FLUSH_EXT; 399 cmd->tf.command = ATA_CMD_FLUSH_EXT;
398 else 400 else
399 task->tf.command = ATA_CMD_FLUSH; 401 cmd->tf.command = ATA_CMD_FLUSH;
400 task->tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE | 402 cmd->tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE |
401 IDE_TFLAG_DYN; 403 IDE_TFLAG_DYN;
402 task->data_phase = TASKFILE_NO_DATA; 404 cmd->data_phase = TASKFILE_NO_DATA;
403 405
404 rq->cmd_type = REQ_TYPE_ATA_TASKFILE; 406 rq->cmd_type = REQ_TYPE_ATA_TASKFILE;
405 rq->cmd_flags |= REQ_SOFTBARRIER; 407 rq->cmd_flags |= REQ_SOFTBARRIER;
406 rq->special = task; 408 rq->special = cmd;
407} 409}
408 410
409ide_devset_get(multcount, mult_count); 411ide_devset_get(multcount, mult_count);
@@ -453,15 +455,15 @@ static int set_nowerr(ide_drive_t *drive, int arg)
453 455
454static int ide_do_setfeature(ide_drive_t *drive, u8 feature, u8 nsect) 456static int ide_do_setfeature(ide_drive_t *drive, u8 feature, u8 nsect)
455{ 457{
456 ide_task_t task; 458 struct ide_cmd cmd;
457 459
458 memset(&task, 0, sizeof(task)); 460 memset(&cmd, 0, sizeof(cmd));
459 task.tf.feature = feature; 461 cmd.tf.feature = feature;
460 task.tf.nsect = nsect; 462 cmd.tf.nsect = nsect;
461 task.tf.command = ATA_CMD_SET_FEATURES; 463 cmd.tf.command = ATA_CMD_SET_FEATURES;
462 task.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; 464 cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE;
463 465
464 return ide_no_data_taskfile(drive, &task); 466 return ide_no_data_taskfile(drive, &cmd);
465} 467}
466 468
467static void update_ordered(ide_drive_t *drive) 469static void update_ordered(ide_drive_t *drive)
@@ -528,15 +530,16 @@ static int set_wcache(ide_drive_t *drive, int arg)
528 530
529static int do_idedisk_flushcache(ide_drive_t *drive) 531static int do_idedisk_flushcache(ide_drive_t *drive)
530{ 532{
531 ide_task_t args; 533 struct ide_cmd cmd;
532 534
533 memset(&args, 0, sizeof(ide_task_t)); 535 memset(&cmd, 0, sizeof(cmd));
534 if (ata_id_flush_ext_enabled(drive->id)) 536 if (ata_id_flush_ext_enabled(drive->id))
535 args.tf.command = ATA_CMD_FLUSH_EXT; 537 cmd.tf.command = ATA_CMD_FLUSH_EXT;
536 else 538 else
537 args.tf.command = ATA_CMD_FLUSH; 539 cmd.tf.command = ATA_CMD_FLUSH;
538 args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; 540 cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE;
539 return ide_no_data_taskfile(drive, &args); 541
542 return ide_no_data_taskfile(drive, &cmd);
540} 543}
541 544
542ide_devset_get(acoustic, acoustic); 545ide_devset_get(acoustic, acoustic);
@@ -708,17 +711,17 @@ static int ide_disk_init_media(ide_drive_t *drive, struct gendisk *disk)
708static int ide_disk_set_doorlock(ide_drive_t *drive, struct gendisk *disk, 711static int ide_disk_set_doorlock(ide_drive_t *drive, struct gendisk *disk,
709 int on) 712 int on)
710{ 713{
711 ide_task_t task; 714 struct ide_cmd cmd;
712 int ret; 715 int ret;
713 716
714 if ((drive->dev_flags & IDE_DFLAG_DOORLOCKING) == 0) 717 if ((drive->dev_flags & IDE_DFLAG_DOORLOCKING) == 0)
715 return 0; 718 return 0;
716 719
717 memset(&task, 0, sizeof(task)); 720 memset(&cmd, 0, sizeof(cmd));
718 task.tf.command = on ? ATA_CMD_MEDIA_LOCK : ATA_CMD_MEDIA_UNLOCK; 721 cmd.tf.command = on ? ATA_CMD_MEDIA_LOCK : ATA_CMD_MEDIA_UNLOCK;
719 task.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; 722 cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE;
720 723
721 ret = ide_no_data_taskfile(drive, &task); 724 ret = ide_no_data_taskfile(drive, &cmd);
722 725
723 if (ret) 726 if (ret)
724 drive->dev_flags &= ~IDE_DFLAG_DOORLOCKING; 727 drive->dev_flags &= ~IDE_DFLAG_DOORLOCKING;