From: Stefan Richter Date: Tue, 27 Jul 2010 11:20:33 +0000 (+0200) Subject: firewire: ohci: use memory barriers to order descriptor updates X-Git-Tag: v2.6.36-rc3~1^2~6^3~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=071595ebdc66d70219e2d1ce746016f64b2b19e7;p=platform%2Fkernel%2Flinux-3.10.git firewire: ohci: use memory barriers to order descriptor updates When we append to a DMA program, we need to ensure that the order in which initialization of the new descriptors and update of the branch_address of the old tail descriptor, as seen by the PCI device, happen as intended. Signed-off-by: Stefan Richter --- diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index 5f6bb2c..3f59d1d 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c @@ -595,6 +595,7 @@ static int ar_context_add_page(struct ar_context *ctx) ab->descriptor.res_count = cpu_to_le16(PAGE_SIZE - offset); ab->descriptor.branch_address = 0; + wmb(); /* finish init of new descriptors before branch_address update */ ctx->last_buffer->descriptor.branch_address = cpu_to_le32(ab_bus | 1); ctx->last_buffer->next = ab; ctx->last_buffer = ab; @@ -982,6 +983,8 @@ static void context_append(struct context *ctx, d_bus = desc->buffer_bus + (d - desc->buffer) * sizeof(*d); desc->used += (z + extra) * sizeof(*d); + + wmb(); /* finish init of new descriptors before branch_address update */ ctx->prev->branch_address = cpu_to_le32(d_bus | z); ctx->prev = find_branch_descriptor(d, z);