aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pmac.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-31 14:15:21 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-31 14:15:21 -0400
commit11998b316173f814698f9037ce9179d634d1f423 (patch)
tree468bc633384c3bb4cd32754fd853c07fcd54afbc /drivers/ide/pmac.c
parent8a4a5738ba499083cf4c5668895efe220b1946d3 (diff)
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>
Diffstat (limited to 'drivers/ide/pmac.c')
-rw-r--r--drivers/ide/pmac.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/ide/pmac.c b/drivers/ide/pmac.c
index 5643a8b957bf..1df7b7636453 100644
--- a/drivers/ide/pmac.c
+++ b/drivers/ide/pmac.c
@@ -1455,7 +1455,7 @@ static int pmac_ide_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd)
1455 "switching to PIO on Ohare chipset\n", drive->name); 1455 "switching to PIO on Ohare chipset\n", drive->name);
1456 pmif->broken_dma_warn = 1; 1456 pmif->broken_dma_warn = 1;
1457 } 1457 }
1458 goto use_pio_instead; 1458 return 0;
1459 } 1459 }
1460 while (cur_len) { 1460 while (cur_len) {
1461 unsigned int tc = (cur_len < 0xfe00)? cur_len: 0xfe00; 1461 unsigned int tc = (cur_len < 0xfe00)? cur_len: 0xfe00;
@@ -1463,7 +1463,7 @@ static int pmac_ide_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd)
1463 if (count++ >= MAX_DCMDS) { 1463 if (count++ >= MAX_DCMDS) {
1464 printk(KERN_WARNING "%s: DMA table too small\n", 1464 printk(KERN_WARNING "%s: DMA table too small\n",
1465 drive->name); 1465 drive->name);
1466 goto use_pio_instead; 1466 return 0;
1467 } 1467 }
1468 st_le16(&table->command, wr? OUTPUT_MORE: INPUT_MORE); 1468 st_le16(&table->command, wr? OUTPUT_MORE: INPUT_MORE);
1469 st_le16(&table->req_count, tc); 1469 st_le16(&table->req_count, tc);
@@ -1492,9 +1492,6 @@ static int pmac_ide_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd)
1492 1492
1493 printk(KERN_DEBUG "%s: empty DMA table?\n", drive->name); 1493 printk(KERN_DEBUG "%s: empty DMA table?\n", drive->name);
1494 1494
1495use_pio_instead:
1496 ide_destroy_dmatable(drive);
1497
1498 return 0; /* revert to PIO for this request */ 1495 return 0; /* revert to PIO for this request */
1499} 1496}
1500 1497
@@ -1510,10 +1507,8 @@ static int pmac_ide_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd)
1510 u8 unit = drive->dn & 1, ata4 = (pmif->kind == controller_kl_ata4); 1507 u8 unit = drive->dn & 1, ata4 = (pmif->kind == controller_kl_ata4);
1511 u8 write = !!(cmd->tf_flags & IDE_TFLAG_WRITE); 1508 u8 write = !!(cmd->tf_flags & IDE_TFLAG_WRITE);
1512 1509
1513 if (pmac_ide_build_dmatable(drive, cmd) == 0) { 1510 if (pmac_ide_build_dmatable(drive, cmd) == 0)
1514 ide_map_sg(drive, cmd);
1515 return 1; 1511 return 1;
1516 }
1517 1512
1518 /* Apple adds 60ns to wrDataSetup on reads */ 1513 /* Apple adds 60ns to wrDataSetup on reads */
1519 if (ata4 && (pmif->timings[unit] & TR_66_UDMA_EN)) { 1514 if (ata4 && (pmif->timings[unit] & TR_66_UDMA_EN)) {