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>
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index c0505e2..d61f9a8 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -570,8 +570,12 @@
 
 	if ((drive->dev_flags & IDE_DFLAG_USING_DMA) == 0 ||
 	    (dma_ops->dma_check && dma_ops->dma_check(drive, cmd)) ||
-	    ide_build_sglist(drive, cmd) == 0 ||
-	    dma_ops->dma_setup(drive, cmd))
+	    ide_build_sglist(drive, cmd) == 0)
 		return 1;
+	if (dma_ops->dma_setup(drive, cmd)) {
+		ide_destroy_dmatable(drive);
+		ide_map_sg(drive, cmd);
+		return 1;
+	}
 	return 0;
 }