ide-disk: add ide_do_setfeature() helper

Previous thread: ide-disk: set_addressing() fixes by Linux Kernel Mailing List on Monday, October 13, 2008 - 3:26 pm. (1 message)

Next thread: ide: DMA_PIO_RETRY -> IDE_DFLAG_DMA_PIO_RETRY by Linux Kernel Mailing List on Monday, October 13, 2008 - 3:27 pm. (1 message)
From: Linux Kernel Mailing List
Date: Monday, October 13, 2008 - 3:26 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=be3c09...
Commit:     be3c096ebdbe3c828aacb5473751a22840753eff
Parent:     35c137531245118962eb40a550661afe317bec03
Author:     Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
AuthorDate: Mon Oct 13 21:39:36 2008 +0200
Committer:  Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
CommitDate: Mon Oct 13 21:39:36 2008 +0200

    ide-disk: add ide_do_setfeature() helper
    
    Add ide_do_setfeature() helper and convert set_{wcache,acoustic}()
    to use it.
    
    There should be no functional changes caused by this patch.
    
    Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
    Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ide-disk.c |   34 +++++++++++++++++++---------------
 1 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 65c499a..7ea0752 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -580,6 +580,19 @@ static int set_nowerr(ide_drive_t *drive, int arg)
 	return 0;
 }
 
+static int ide_do_setfeature(ide_drive_t *drive, u8 feature, u8 nsect)
+{
+	ide_task_t task;
+
+	memset(&task, 0, sizeof(task));
+	task.tf.feature = feature;
+	task.tf.nsect   = nsect;
+	task.tf.command = ATA_CMD_SET_FEATURES;
+	task.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE;
+
+	return ide_no_data_taskfile(drive, &task);
+}
+
 static void update_ordered(ide_drive_t *drive)
 {
 	u16 *id = drive->id;
@@ -619,19 +632,14 @@ ide_devset_get(wcache, wcache);
 
 static int set_wcache(ide_drive_t *drive, int arg)
 {
-	ide_task_t args;
 	int err = 1;
 
 	if (arg < 0 || arg > 1)
 		return -EINVAL;
 
 	if (ata_id_flush_enabled(drive->id)) {
-		memset(&args, 0, sizeof(ide_task_t));
-		args.tf.feature = arg ?
-			SETFEATURES_WC_ON : SETFEATURES_WC_OFF;
-		args.tf.command = ATA_CMD_SET_FEATURES;
-		args.tf_flags = IDE_TFLAG_TF | ...
Previous thread: ide-disk: set_addressing() fixes by Linux Kernel Mailing List on Monday, October 13, 2008 - 3:26 pm. (1 message)

Next thread: ide: DMA_PIO_RETRY -> IDE_DFLAG_DMA_PIO_RETRY by Linux Kernel Mailing List on Monday, October 13, 2008 - 3:27 pm. (1 message)