diff options
-rw-r--r-- | drivers/ide/ide-disk.c | 18 | ||||
-rw-r--r-- | drivers/ide/ide-io.c | 16 | ||||
-rw-r--r-- | include/linux/ide.h | 2 |
3 files changed, 23 insertions, 13 deletions
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 3c69822507e2..aed8b31ca561 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
@@ -590,20 +590,24 @@ static ide_proc_entry_t idedisk_proc[] = { | |||
590 | static void idedisk_prepare_flush(struct request_queue *q, struct request *rq) | 590 | static void idedisk_prepare_flush(struct request_queue *q, struct request *rq) |
591 | { | 591 | { |
592 | ide_drive_t *drive = q->queuedata; | 592 | ide_drive_t *drive = q->queuedata; |
593 | ide_task_t task; | 593 | ide_task_t *task = kmalloc(sizeof(*task), GFP_ATOMIC); |
594 | 594 | ||
595 | memset(&task, 0, sizeof(task)); | 595 | /* FIXME: map struct ide_taskfile on rq->cmd[] */ |
596 | BUG_ON(task == NULL); | ||
597 | |||
598 | memset(task, 0, sizeof(*task)); | ||
596 | if (ide_id_has_flush_cache_ext(drive->id) && | 599 | if (ide_id_has_flush_cache_ext(drive->id) && |
597 | (drive->capacity64 >= (1UL << 28))) | 600 | (drive->capacity64 >= (1UL << 28))) |
598 | task.tf.command = WIN_FLUSH_CACHE_EXT; | 601 | task->tf.command = WIN_FLUSH_CACHE_EXT; |
599 | else | 602 | else |
600 | task.tf.command = WIN_FLUSH_CACHE; | 603 | task->tf.command = WIN_FLUSH_CACHE; |
601 | task.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; | 604 | task->tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE | |
602 | task.data_phase = TASKFILE_NO_DATA; | 605 | IDE_TFLAG_DYN; |
606 | task->data_phase = TASKFILE_NO_DATA; | ||
603 | 607 | ||
604 | rq->cmd_type = REQ_TYPE_ATA_TASKFILE; | 608 | rq->cmd_type = REQ_TYPE_ATA_TASKFILE; |
605 | rq->cmd_flags |= REQ_SOFTBARRIER; | 609 | rq->cmd_flags |= REQ_SOFTBARRIER; |
606 | rq->special = &task; | 610 | rq->special = task; |
607 | } | 611 | } |
608 | 612 | ||
609 | /* | 613 | /* |
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index e41383fa3a51..715379605a7b 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -361,17 +361,21 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err) | |||
361 | spin_unlock_irqrestore(&ide_lock, flags); | 361 | spin_unlock_irqrestore(&ide_lock, flags); |
362 | 362 | ||
363 | if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { | 363 | if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { |
364 | ide_task_t *args = (ide_task_t *) rq->special; | 364 | ide_task_t *task = (ide_task_t *)rq->special; |
365 | |||
365 | if (rq->errors == 0) | 366 | if (rq->errors == 0) |
366 | rq->errors = !OK_STAT(stat,READY_STAT,BAD_STAT); | 367 | rq->errors = !OK_STAT(stat, READY_STAT, BAD_STAT); |
367 | 368 | ||
368 | if (args) { | 369 | if (task) { |
369 | struct ide_taskfile *tf = &args->tf; | 370 | struct ide_taskfile *tf = &task->tf; |
370 | 371 | ||
371 | tf->error = err; | 372 | tf->error = err; |
372 | tf->status = stat; | 373 | tf->status = stat; |
373 | 374 | ||
374 | ide_tf_read(drive, args); | 375 | ide_tf_read(drive, task); |
376 | |||
377 | if (task->tf_flags & IDE_TFLAG_DYN) | ||
378 | kfree(task); | ||
375 | } | 379 | } |
376 | } else if (blk_pm_request(rq)) { | 380 | } else if (blk_pm_request(rq)) { |
377 | struct request_pm_state *pm = rq->data; | 381 | struct request_pm_state *pm = rq->data; |
diff --git a/include/linux/ide.h b/include/linux/ide.h index 40a01c3592df..23fad89292df 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -906,6 +906,8 @@ enum { | |||
906 | IDE_TFLAG_IN_DEVICE, | 906 | IDE_TFLAG_IN_DEVICE, |
907 | /* force 16-bit I/O operations */ | 907 | /* force 16-bit I/O operations */ |
908 | IDE_TFLAG_IO_16BIT = (1 << 30), | 908 | IDE_TFLAG_IO_16BIT = (1 << 30), |
909 | /* ide_task_t was allocated using kmalloc() */ | ||
910 | IDE_TFLAG_DYN = (1 << 31), | ||
909 | }; | 911 | }; |
910 | 912 | ||
911 | struct ide_taskfile { | 913 | struct ide_taskfile { |