From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: linux-ide@vger.kernel.org
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 08/10] ide: move ide_map_sg() call out from ->dma_setup method
Date: Fri, 20 Feb 2009 18:12:36 +0100 [thread overview]
Message-ID: <20090220171236.25429.25264.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20090220171139.25429.26702.sendpatchset@localhost.localdomain>
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide: move ide_map_sg() call out from ->dma_setup method
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.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/au1xxx-ide.c | 8 ++------
drivers/ide/ide-dma-sff.c | 2 --
drivers/ide/ide-dma.c | 8 ++++++--
drivers/ide/pmac.c | 6 +-----
drivers/ide/scc_pata.c | 4 +---
drivers/ide/sgiioc4.c | 6 +-----
drivers/ide/trm290.c | 5 ++---
drivers/ide/tx4939ide.c | 6 +-----
8 files changed, 14 insertions(+), 31 deletions(-)
Index: b/drivers/ide/au1xxx-ide.c
===================================================================
--- a/drivers/ide/au1xxx-ide.c
+++ b/drivers/ide/au1xxx-ide.c
@@ -272,9 +272,7 @@ static int auide_build_dmatable(ide_driv
if (count)
return 1;
- use_pio_instead:
- ide_destroy_dmatable(drive);
-
+use_pio_instead:
return 0; /* revert to PIO for this request */
}
@@ -290,10 +288,8 @@ static void auide_dma_start(ide_drive_t
static int auide_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd)
{
- if (auide_build_dmatable(drive, cmd) == 0) {
- ide_map_sg(drive, cmd);
+ if (auide_build_dmatable(drive, cmd) == 0)
return 1;
- }
drive->waiting_for_dma = 1;
return 0;
Index: b/drivers/ide/ide-dma-sff.c
===================================================================
--- a/drivers/ide/ide-dma-sff.c
+++ b/drivers/ide/ide-dma-sff.c
@@ -166,8 +166,6 @@ use_pio_instead:
printk(KERN_ERR "%s: %s\n", drive->name,
count ? "DMA table too small" : "empty DMA table?");
- ide_destroy_dmatable(drive);
-
return 0; /* revert to PIO for this request */
}
EXPORT_SYMBOL_GPL(ide_build_dmatable);
Index: b/drivers/ide/ide-dma.c
===================================================================
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -566,8 +566,12 @@ int ide_dma_prepare(ide_drive_t *drive,
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;
}
Index: b/drivers/ide/pmac.c
===================================================================
--- a/drivers/ide/pmac.c
+++ b/drivers/ide/pmac.c
@@ -1493,8 +1493,6 @@ static int pmac_ide_build_dmatable(ide_d
printk(KERN_DEBUG "%s: empty DMA table?\n", drive->name);
use_pio_instead:
- ide_destroy_dmatable(drive);
-
return 0; /* revert to PIO for this request */
}
@@ -1510,10 +1508,8 @@ static int pmac_ide_dma_setup(ide_drive_
u8 unit = drive->dn & 1, ata4 = (pmif->kind == controller_kl_ata4);
u8 write = !!(cmd->tf_flags & IDE_TFLAG_WRITE);
- if (pmac_ide_build_dmatable(drive, cmd) == 0) {
- ide_map_sg(drive, cmd);
+ if (pmac_ide_build_dmatable(drive, cmd) == 0)
return 1;
- }
/* Apple adds 60ns to wrDataSetup on reads */
if (ata4 && (pmif->timings[unit] & TR_66_UDMA_EN)) {
Index: b/drivers/ide/scc_pata.c
===================================================================
--- a/drivers/ide/scc_pata.c
+++ b/drivers/ide/scc_pata.c
@@ -321,10 +321,8 @@ static int scc_dma_setup(ide_drive_t *dr
u8 dma_stat;
/* fall back to pio! */
- if (ide_build_dmatable(drive, cmd) == 0) {
- ide_map_sg(drive, cmd);
+ if (ide_build_dmatable(drive, cmd) == 0)
return 1;
- }
/* PRD table */
out_be32((void __iomem *)(hwif->dma_base + 8), hwif->dmatable_dma);
Index: b/drivers/ide/sgiioc4.c
===================================================================
--- a/drivers/ide/sgiioc4.c
+++ b/drivers/ide/sgiioc4.c
@@ -478,8 +478,6 @@ static int sgiioc4_build_dmatable(ide_dr
}
use_pio_instead:
- ide_destroy_dmatable(drive);
-
return 0; /* revert to PIO for this request */
}
@@ -488,11 +486,9 @@ static int sgiioc4_dma_setup(ide_drive_t
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 */
Index: b/drivers/ide/trm290.c
===================================================================
--- a/drivers/ide/trm290.c
+++ b/drivers/ide/trm290.c
@@ -193,11 +193,10 @@ static int trm290_dma_setup(ide_drive_t
unsigned int count, rw = (cmd->tf_flags & IDE_TFLAG_WRITE) ? 1 : 2;
count = ide_build_dmatable(drive, cmd);
- if (count == 0) {
- ide_map_sg(drive, cmd);
+ if (count == 0)
/* try PIO instead of DMA */
return 1;
- }
+
outl(hwif->dmatable_dma | rw, hwif->dma_base);
drive->waiting_for_dma = 1;
/* start DMA */
Index: b/drivers/ide/tx4939ide.c
===================================================================
--- a/drivers/ide/tx4939ide.c
+++ b/drivers/ide/tx4939ide.c
@@ -279,8 +279,6 @@ use_pio_instead:
printk(KERN_ERR "%s: %s\n", drive->name,
count ? "DMA table too small" : "empty DMA table?");
- ide_destroy_dmatable(drive);
-
return 0; /* revert to PIO for this request */
}
#else
@@ -294,10 +292,8 @@ static int tx4939ide_dma_setup(ide_drive
u8 rw = (cmd->tf_flags & IDE_TFLAG_WRITE) ? 0 : ATA_DMA_WR;
/* fall back to PIO! */
- if (tx4939ide_build_dmatable(drive, cmd) == 0) {
- ide_map_sg(drive, cmd);
+ if (tx4939ide_build_dmatable(drive, cmd) == 0)
return 1;
- }
/* PRD table */
tx4939ide_writel(hwif->dmatable_dma, base, TX4939IDE_PRD_Ptr);
next prev parent reply other threads:[~2009-02-20 17:10 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-20 17:11 [PATCH 00/10] ide: DMA methods cleanups/sanitizations Bartlomiej Zolnierkiewicz
2009-02-20 17:11 ` [PATCH 01/10] ide: add ->dma_clear method and remove ->dma_timeout one Bartlomiej Zolnierkiewicz
2009-03-08 22:17 ` Sergei Shtylyov
2009-02-20 17:11 ` [PATCH 02/10] ide: inline ide_dma_timeout() into ide_dma_timeout_retry() Bartlomiej Zolnierkiewicz
2009-03-08 22:18 ` Sergei Shtylyov
2009-02-20 17:12 ` [PATCH 03/10] ide: destroy DMA mappings after ending DMA Bartlomiej Zolnierkiewicz
2009-03-09 14:00 ` Sergei Shtylyov
2009-03-14 7:12 ` Grant Grundler
2009-03-14 19:51 ` Bartlomiej Zolnierkiewicz
2009-03-14 20:45 ` Grant Grundler
2009-03-14 20:50 ` James Bottomley
2009-02-20 17:12 ` [PATCH 04/10] ide: add ide_dma_prepare() helper Bartlomiej Zolnierkiewicz
2009-03-09 14:36 ` Sergei Shtylyov
2009-02-20 17:12 ` [PATCH 05/10] ns87415: use custom ->dma_{start,end} to handle ns87415_prepare_drive() Bartlomiej Zolnierkiewicz
2009-03-08 22:22 ` Sergei Shtylyov
2009-02-20 17:12 ` [PATCH 06/10] trm290: use custom ->dma_{start,end} to handle trm290_prepare_drive() Bartlomiej Zolnierkiewicz
2009-03-08 22:26 ` Sergei Shtylyov
2009-02-20 17:12 ` [PATCH 07/10] ide: add ->dma_check method Bartlomiej Zolnierkiewicz
2009-03-08 22:32 ` Sergei Shtylyov
2009-03-11 16:36 ` Bartlomiej Zolnierkiewicz
2009-02-20 17:12 ` Bartlomiej Zolnierkiewicz [this message]
2009-03-09 14:42 ` [PATCH 08/10] ide: move ide_map_sg() call out from ->dma_setup method Sergei Shtylyov
2009-03-11 16:36 ` Bartlomiej Zolnierkiewicz
2009-03-11 17:10 ` Sergei Shtylyov
2009-03-11 17:36 ` Bartlomiej Zolnierkiewicz
2009-02-20 17:12 ` [PATCH 09/10] ide: set/clear drive->waiting_for_dma flag in the core code Bartlomiej Zolnierkiewicz
2009-03-10 15:05 ` Sergei Shtylyov
2009-02-20 17:12 ` [PATCH 10/10] ide: sanitize ide_build_sglist() and ide_destroy_dmatable() Bartlomiej Zolnierkiewicz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090220171236.25429.25264.sendpatchset@localhost.localdomain \
--to=bzolnier@gmail.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).