diff options
| author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-01-25 16:17:07 -0500 |
|---|---|---|
| committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-01-25 16:17:07 -0500 |
| commit | 9a3c49be5c5f7388eefb712be9a383904140532e (patch) | |
| tree | 5dc16604e155dcc6c14e65dc3cfce8605f2c8f82 /drivers | |
| parent | 9e42237f26cf517a3f682505f03a3a8d89b3b35d (diff) | |
ide: add ide_no_data_taskfile() helper
* Add ide_no_data_taskfile() helper and convert ide_raw_taskfile() w/ NO DATA
protocol users to use it instead.
* Set ->data_phase explicitly in ide_no_data_taskfile()
(TASKFILE_NO_DATA is defined as 0x0000).
* Unexport task_no_data_intr().
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/ide/ide-acpi.c | 7 | ||||
| -rw-r--r-- | drivers/ide/ide-disk.c | 32 | ||||
| -rw-r--r-- | drivers/ide/ide-taskfile.c | 12 |
3 files changed, 20 insertions, 31 deletions
diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c index 747c51889f7d..f0a6a3d6d2d3 100644 --- a/drivers/ide/ide-acpi.c +++ b/drivers/ide/ide-acpi.c | |||
| @@ -383,9 +383,6 @@ static int taskfile_load_raw(ide_drive_t *drive, | |||
| 383 | gtf->tfa[3], gtf->tfa[4], gtf->tfa[5], gtf->tfa[6]); | 383 | gtf->tfa[3], gtf->tfa[4], gtf->tfa[5], gtf->tfa[6]); |
| 384 | 384 | ||
| 385 | memset(&args, 0, sizeof(ide_task_t)); | 385 | memset(&args, 0, sizeof(ide_task_t)); |
| 386 | args.command_type = IDE_DRIVE_TASK_NO_DATA; | ||
| 387 | args.data_phase = TASKFILE_NO_DATA; | ||
| 388 | args.handler = &task_no_data_intr; | ||
| 389 | 386 | ||
| 390 | /* convert gtf to IDE Taskfile */ | 387 | /* convert gtf to IDE Taskfile */ |
| 391 | memcpy(&args.tf_array[7], >f->tfa, 7); | 388 | memcpy(&args.tf_array[7], >f->tfa, 7); |
| @@ -395,9 +392,9 @@ static int taskfile_load_raw(ide_drive_t *drive, | |||
| 395 | return err; | 392 | return err; |
| 396 | } | 393 | } |
| 397 | 394 | ||
| 398 | err = ide_raw_taskfile(drive, &args, NULL); | 395 | err = ide_no_data_taskfile(drive, &args); |
| 399 | if (err) | 396 | if (err) |
| 400 | printk(KERN_ERR "%s: ide_raw_taskfile failed: %u\n", | 397 | printk(KERN_ERR "%s: ide_no_data_taskfile failed: %u\n", |
| 401 | __FUNCTION__, err); | 398 | __FUNCTION__, err); |
| 402 | 399 | ||
| 403 | return err; | 400 | return err; |
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 6387222dd200..b534fe97d476 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
| @@ -303,10 +303,8 @@ static u64 idedisk_read_native_max_address(ide_drive_t *drive, int lba48) | |||
| 303 | else | 303 | else |
| 304 | tf->command = WIN_READ_NATIVE_MAX; | 304 | tf->command = WIN_READ_NATIVE_MAX; |
| 305 | tf->device = ATA_LBA; | 305 | tf->device = ATA_LBA; |
| 306 | args.command_type = IDE_DRIVE_TASK_NO_DATA; | ||
| 307 | args.handler = &task_no_data_intr; | ||
| 308 | /* submit command request */ | 306 | /* submit command request */ |
| 309 | ide_raw_taskfile(drive, &args, NULL); | 307 | ide_no_data_taskfile(drive, &args); |
| 310 | 308 | ||
| 311 | /* if OK, compute maximum address value */ | 309 | /* if OK, compute maximum address value */ |
| 312 | if ((tf->status & 0x01) == 0) { | 310 | if ((tf->status & 0x01) == 0) { |
| @@ -350,10 +348,8 @@ static u64 idedisk_set_max_address(ide_drive_t *drive, u64 addr_req, int lba48) | |||
| 350 | tf->command = WIN_SET_MAX; | 348 | tf->command = WIN_SET_MAX; |
| 351 | } | 349 | } |
| 352 | tf->device |= ATA_LBA; | 350 | tf->device |= ATA_LBA; |
| 353 | args.command_type = IDE_DRIVE_TASK_NO_DATA; | ||
| 354 | args.handler = &task_no_data_intr; | ||
| 355 | /* submit command request */ | 351 | /* submit command request */ |
| 356 | ide_raw_taskfile(drive, &args, NULL); | 352 | ide_no_data_taskfile(drive, &args); |
| 357 | /* if OK, compute maximum address value */ | 353 | /* if OK, compute maximum address value */ |
| 358 | if ((tf->status & 0x01) == 0) { | 354 | if ((tf->status & 0x01) == 0) { |
| 359 | u32 high, low; | 355 | u32 high, low; |
| @@ -500,9 +496,7 @@ static int smart_enable(ide_drive_t *drive) | |||
| 500 | tf->lbam = SMART_LCYL_PASS; | 496 | tf->lbam = SMART_LCYL_PASS; |
| 501 | tf->lbah = SMART_HCYL_PASS; | 497 | tf->lbah = SMART_HCYL_PASS; |
| 502 | tf->command = WIN_SMART; | 498 | tf->command = WIN_SMART; |
| 503 | args.command_type = IDE_DRIVE_TASK_NO_DATA; | 499 | return ide_no_data_taskfile(drive, &args); |
| 504 | args.handler = &task_no_data_intr; | ||
| 505 | return ide_raw_taskfile(drive, &args, NULL); | ||
| 506 | } | 500 | } |
| 507 | 501 | ||
| 508 | static int get_smart_data(ide_drive_t *drive, u8 *buf, u8 sub_cmd) | 502 | static int get_smart_data(ide_drive_t *drive, u8 *buf, u8 sub_cmd) |
| @@ -695,9 +689,7 @@ static int write_cache(ide_drive_t *drive, int arg) | |||
| 695 | args.tf.feature = arg ? | 689 | args.tf.feature = arg ? |
| 696 | SETFEATURES_EN_WCACHE : SETFEATURES_DIS_WCACHE; | 690 | SETFEATURES_EN_WCACHE : SETFEATURES_DIS_WCACHE; |
| 697 | args.tf.command = WIN_SETFEATURES; | 691 | args.tf.command = WIN_SETFEATURES; |
| 698 | args.command_type = IDE_DRIVE_TASK_NO_DATA; | 692 | err = ide_no_data_taskfile(drive, &args); |
| 699 | args.handler = &task_no_data_intr; | ||
| 700 | err = ide_raw_taskfile(drive, &args, NULL); | ||
| 701 | if (err == 0) | 693 | if (err == 0) |
| 702 | drive->wcache = arg; | 694 | drive->wcache = arg; |
| 703 | } | 695 | } |
| @@ -716,9 +708,7 @@ static int do_idedisk_flushcache (ide_drive_t *drive) | |||
| 716 | args.tf.command = WIN_FLUSH_CACHE_EXT; | 708 | args.tf.command = WIN_FLUSH_CACHE_EXT; |
| 717 | else | 709 | else |
| 718 | args.tf.command = WIN_FLUSH_CACHE; | 710 | args.tf.command = WIN_FLUSH_CACHE; |
| 719 | args.command_type = IDE_DRIVE_TASK_NO_DATA; | 711 | return ide_no_data_taskfile(drive, &args); |
| 720 | args.handler = &task_no_data_intr; | ||
| 721 | return ide_raw_taskfile(drive, &args, NULL); | ||
| 722 | } | 712 | } |
| 723 | 713 | ||
| 724 | static int set_acoustic (ide_drive_t *drive, int arg) | 714 | static int set_acoustic (ide_drive_t *drive, int arg) |
| @@ -732,9 +722,7 @@ static int set_acoustic (ide_drive_t *drive, int arg) | |||
| 732 | args.tf.feature = arg ? SETFEATURES_EN_AAM : SETFEATURES_DIS_AAM; | 722 | args.tf.feature = arg ? SETFEATURES_EN_AAM : SETFEATURES_DIS_AAM; |
| 733 | args.tf.nsect = arg; | 723 | args.tf.nsect = arg; |
| 734 | args.tf.command = WIN_SETFEATURES; | 724 | args.tf.command = WIN_SETFEATURES; |
| 735 | args.command_type = IDE_DRIVE_TASK_NO_DATA; | 725 | ide_no_data_taskfile(drive, &args); |
| 736 | args.handler = &task_no_data_intr; | ||
| 737 | ide_raw_taskfile(drive, &args, NULL); | ||
| 738 | drive->acoustic = arg; | 726 | drive->acoustic = arg; |
| 739 | return 0; | 727 | return 0; |
| 740 | } | 728 | } |
| @@ -996,15 +984,13 @@ static int idedisk_open(struct inode *inode, struct file *filp) | |||
| 996 | ide_task_t args; | 984 | ide_task_t args; |
| 997 | memset(&args, 0, sizeof(ide_task_t)); | 985 | memset(&args, 0, sizeof(ide_task_t)); |
| 998 | args.tf.command = WIN_DOORLOCK; | 986 | args.tf.command = WIN_DOORLOCK; |
| 999 | args.command_type = IDE_DRIVE_TASK_NO_DATA; | ||
| 1000 | args.handler = &task_no_data_intr; | ||
| 1001 | check_disk_change(inode->i_bdev); | 987 | check_disk_change(inode->i_bdev); |
| 1002 | /* | 988 | /* |
| 1003 | * Ignore the return code from door_lock, | 989 | * Ignore the return code from door_lock, |
| 1004 | * since the open() has already succeeded, | 990 | * since the open() has already succeeded, |
| 1005 | * and the door_lock is irrelevant at this point. | 991 | * and the door_lock is irrelevant at this point. |
| 1006 | */ | 992 | */ |
| 1007 | if (drive->doorlocking && ide_raw_taskfile(drive, &args, NULL)) | 993 | if (drive->doorlocking && ide_no_data_taskfile(drive, &args)) |
| 1008 | drive->doorlocking = 0; | 994 | drive->doorlocking = 0; |
| 1009 | } | 995 | } |
| 1010 | return 0; | 996 | return 0; |
| @@ -1023,9 +1009,7 @@ static int idedisk_release(struct inode *inode, struct file *filp) | |||
| 1023 | ide_task_t args; | 1009 | ide_task_t args; |
| 1024 | memset(&args, 0, sizeof(ide_task_t)); | 1010 | memset(&args, 0, sizeof(ide_task_t)); |
| 1025 | args.tf.command = WIN_DOORUNLOCK; | 1011 | args.tf.command = WIN_DOORUNLOCK; |
| 1026 | args.command_type = IDE_DRIVE_TASK_NO_DATA; | 1012 | if (drive->doorlocking && ide_no_data_taskfile(drive, &args)) |
| 1027 | args.handler = &task_no_data_intr; | ||
| 1028 | if (drive->doorlocking && ide_raw_taskfile(drive, &args, NULL)) | ||
| 1029 | drive->doorlocking = 0; | 1013 | drive->doorlocking = 0; |
| 1030 | } | 1014 | } |
| 1031 | 1015 | ||
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index a79150e6be07..7cb674f81315 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c | |||
| @@ -229,8 +229,6 @@ ide_startstop_t task_no_data_intr (ide_drive_t *drive) | |||
| 229 | return ide_stopped; | 229 | return ide_stopped; |
| 230 | } | 230 | } |
| 231 | 231 | ||
| 232 | EXPORT_SYMBOL(task_no_data_intr); | ||
| 233 | |||
| 234 | static u8 wait_drive_not_busy(ide_drive_t *drive) | 232 | static u8 wait_drive_not_busy(ide_drive_t *drive) |
| 235 | { | 233 | { |
| 236 | ide_hwif_t *hwif = HWIF(drive); | 234 | ide_hwif_t *hwif = HWIF(drive); |
| @@ -524,6 +522,16 @@ int ide_raw_taskfile (ide_drive_t *drive, ide_task_t *args, u8 *buf) | |||
| 524 | 522 | ||
| 525 | EXPORT_SYMBOL(ide_raw_taskfile); | 523 | EXPORT_SYMBOL(ide_raw_taskfile); |
| 526 | 524 | ||
| 525 | int ide_no_data_taskfile(ide_drive_t *drive, ide_task_t *task) | ||
| 526 | { | ||
| 527 | task->command_type = IDE_DRIVE_TASK_NO_DATA; | ||
| 528 | task->data_phase = TASKFILE_NO_DATA; | ||
| 529 | task->handler = task_no_data_intr; | ||
| 530 | |||
| 531 | return ide_raw_taskfile(drive, task, NULL); | ||
| 532 | } | ||
| 533 | EXPORT_SYMBOL_GPL(ide_no_data_taskfile); | ||
| 534 | |||
| 527 | #ifdef CONFIG_IDE_TASK_IOCTL | 535 | #ifdef CONFIG_IDE_TASK_IOCTL |
| 528 | int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) | 536 | int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) |
| 529 | { | 537 | { |
