aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-iops.c
diff options
context:
space:
mode:
authorSergei Shtylyov <sshtylyov@ru.mvista.com>2009-04-08 08:13:03 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-04-08 08:13:03 -0400
commitc9ff9e7b64138d87023b733e618f29a1d58543f7 (patch)
treee0697999409235309c578d3c8a7ecc031be2eda0 /drivers/ide/ide-iops.c
parent30881b9ac91e7c23e0ceb8414ab7de1961809bdd (diff)
ide: refactor tf_load() method
Simplify tf_load() method, making it deal only with 'struct ide_taskfile' and the validity flags that the upper layer passes, and moving the code that deals with the high order bytes into the only function interested, do_rw_taskfile(). This should stop the needless code duplication in this method and so make it about twice smaller than it was; along with simplifying the setup for the method call, this should save both time and space... Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-iops.c')
-rw-r--r--drivers/ide/ide-iops.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index 0fdf0dfb574..6f1ed427a48 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -312,10 +312,10 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
312{ 312{
313 ide_hwif_t *hwif = drive->hwif; 313 ide_hwif_t *hwif = drive->hwif;
314 const struct ide_tp_ops *tp_ops = hwif->tp_ops; 314 const struct ide_tp_ops *tp_ops = hwif->tp_ops;
315 struct ide_taskfile tf;
315 u16 *id = drive->id, i; 316 u16 *id = drive->id, i;
316 int error = 0; 317 int error = 0;
317 u8 stat; 318 u8 stat;
318 struct ide_cmd cmd;
319 319
320#ifdef CONFIG_BLK_DEV_IDEDMA 320#ifdef CONFIG_BLK_DEV_IDEDMA
321 if (hwif->dma_ops) /* check if host supports DMA */ 321 if (hwif->dma_ops) /* check if host supports DMA */
@@ -347,12 +347,11 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
347 udelay(1); 347 udelay(1);
348 tp_ops->write_devctl(hwif, ATA_NIEN | ATA_DEVCTL_OBS); 348 tp_ops->write_devctl(hwif, ATA_NIEN | ATA_DEVCTL_OBS);
349 349
350 memset(&cmd, 0, sizeof(cmd)); 350 memset(&tf, 0, sizeof(tf));
351 cmd.valid.out.tf = IDE_VALID_FEATURE | IDE_VALID_NSECT; 351 tf.feature = SETFEATURES_XFER;
352 cmd.tf.feature = SETFEATURES_XFER; 352 tf.nsect = speed;
353 cmd.tf.nsect = speed;
354 353
355 tp_ops->tf_load(drive, &cmd); 354 tp_ops->tf_load(drive, &tf, IDE_VALID_FEATURE | IDE_VALID_NSECT);
356 355
357 tp_ops->exec_command(hwif, ATA_CMD_SET_FEATURES); 356 tp_ops->exec_command(hwif, ATA_CMD_SET_FEATURES);
358 357