mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] firewire: fw-ohci: fix DMA mapping for ar context
@ 2007-10-16 17:25 Stefan Richter
  2007-10-16 17:35 ` Stefan Richter
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Richter @ 2007-10-16 17:25 UTC (permalink / raw)
  To: linux1394-devel; +Cc: linux-kernel, Kristian Høgsberg

The CPU must not touch the buffer after it was DMA-mapped.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
 drivers/firewire/fw-ohci.c |   12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

Index: linux/drivers/firewire/fw-ohci.c
===================================================================
--- linux.orig/drivers/firewire/fw-ohci.c
+++ linux/drivers/firewire/fw-ohci.c
@@ -253,12 +253,6 @@ static int ar_context_add_page(struct ar
 	if (ab == NULL)
 		return -ENOMEM;
 
-	ab_bus = dma_map_single(dev, ab, PAGE_SIZE, DMA_BIDIRECTIONAL);
-	if (dma_mapping_error(ab_bus)) {
-		free_page((unsigned long) ab);
-		return -ENOMEM;
-	}
-
 	memset(&ab->descriptor, 0, sizeof(ab->descriptor));
 	ab->descriptor.control        = cpu_to_le16(DESCRIPTOR_INPUT_MORE |
 						    DESCRIPTOR_STATUS |
@@ -269,7 +263,11 @@ static int ar_context_add_page(struct ar
 	ab->descriptor.res_count      = cpu_to_le16(PAGE_SIZE - offset);
 	ab->descriptor.branch_address = 0;
 
-	dma_sync_single_for_device(dev, ab_bus, PAGE_SIZE, DMA_BIDIRECTIONAL);
+	ab_bus = dma_map_single(dev, ab, PAGE_SIZE, DMA_BIDIRECTIONAL);
+	if (dma_mapping_error(ab_bus)) {
+		free_page((unsigned long) ab);
+		return -ENOMEM;
+	}
 
 	ctx->last_buffer->descriptor.branch_address = cpu_to_le32(ab_bus | 1);
 	ctx->last_buffer->next = ab;

-- 
Stefan Richter
-=====-=-=== =-=- =----
http://arcgraph.de/sr/


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-10-16 19:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-16 17:25 [PATCH] firewire: fw-ohci: fix DMA mapping for ar context Stefan Richter
2007-10-16 17:35 ` Stefan Richter
2007-10-16 17:40   ` [PATCH corrected] " Stefan Richter
2007-10-16 17:58     ` [PATCH] firewire: fw-ohci: optimize initialization of " Stefan Richter
2007-10-16 18:30       ` [PATCH] firewire: fw-ohci: avoid an atomic allocation Stefan Richter
2007-10-16 19:49     ` [PATCH corrected] firewire: fw-ohci: fix DMA mapping for ar context Stefan Richter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®