From cb2d2cdbc66d9143159ee0381ad83975de56a57d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= <krh@redhat.com>
Date: Fri, 16 Feb 2007 17:34:47 -0500
Subject: [PATCH] firewire: Don't touch DMA descriptors after appending.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

When a DMA descriptor is appended to the context we sync it for
DMA and the device might potentially read it immediately.  So,
we can't set the IRQ bits in the descriptor after appending.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
 drivers/firewire/fw-ohci.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c
index 9b9ea0f3c416..18769d906ca9 100644
--- a/drivers/firewire/fw-ohci.c
+++ b/drivers/firewire/fw-ohci.c
@@ -1621,15 +1621,15 @@ ohci_queue_iso_receive_dualbuffer(struct fw_iso_context *base,
 		page_bus = page_private(buffer->pages[page]);
 		db->second_buffer = cpu_to_le32(page_bus + offset);
 
+		if (p->interrupt && length == rest)
+			db->control |= cpu_to_le16(descriptor_irq_always);
+
 		context_append(&ctx->context, d, z, header_z);
 		offset = (offset + length) & ~PAGE_MASK;
 		rest -= length;
 		page++;
 	}
 
-	if (p->interrupt)
-		db->control |= cpu_to_le16(descriptor_irq_always);
-
 	return 0;
 }
  
@@ -1668,6 +1668,9 @@ ohci_queue_iso_receive_bufferfill(struct fw_iso_context *base,
 		d->req_count = cpu_to_le16(length);
 		d->res_count = cpu_to_le16(length);
 
+		if (packet->interrupt && length == rest)
+			d->control |= cpu_to_le16(descriptor_irq_always);
+
 		context_append(&ctx->context, d, 1, 0);
 
 		offset = (offset + length) & ~PAGE_MASK;
@@ -1675,9 +1678,6 @@ ohci_queue_iso_receive_bufferfill(struct fw_iso_context *base,
 		page++;
 	}
 
-	if (packet->interrupt)
-		d->control |= cpu_to_le16(descriptor_irq_always);
-
 	return 0;
 }
 
-- 
GitLab