ide: move ide_map_sg() call out of ->dma_setup method (take 2)

Move ide_map_sg() call from ->dma_setup implementations and
ide_destroy_dmatable() one from *_build_dmatable() to ide_dma_prepare().

There should be no functional changes caused by this patch.

Sergei:
Removed 'use_pio_instead' labels and replaced 'goto' with 'return 0' --
that required no changes to the follow-up patches...

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
This commit is contained in:
Bartlomiej Zolnierkiewicz
2009-03-31 20:15:21 +02:00
parent 8a4a5738ba
commit 11998b3161
8 changed files with 17 additions and 37 deletions

View File

@@ -442,7 +442,7 @@ static int sgiioc4_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd)
printk(KERN_WARNING
"%s: DMA table too small\n",
drive->name);
goto use_pio_instead;
return 0;
} else {
u32 bcount =
0x10000 - (cur_addr & 0xffff);
@@ -477,9 +477,6 @@ static int sgiioc4_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd)
return count;
}
use_pio_instead:
ide_destroy_dmatable(drive);
return 0; /* revert to PIO for this request */
}
@@ -488,11 +485,9 @@ static int sgiioc4_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd)
int ddir;
u8 write = !!(cmd->tf_flags & IDE_TFLAG_WRITE);
if (sgiioc4_build_dmatable(drive, cmd) == 0) {
if (sgiioc4_build_dmatable(drive, cmd) == 0)
/* try PIO instead of DMA */
ide_map_sg(drive, cmd);
return 1;
}
if (write)
/* Writes TO the IOC4 FROM Main Memory */