[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-ti33x-psp-3.2 / 3.2.14 / 0082-firewire-ohci-fix-too-early-completion-of-IR-multich.patch
1 From d98908a17ece4ec33e477158112adc527c365b83 Mon Sep 17 00:00:00 2001
2 From: Clemens Ladisch <clemens@ladisch.de>
3 Date: Mon, 12 Mar 2012 21:45:47 +0100
4 Subject: [PATCH 082/147] firewire: ohci: fix too-early completion of IR
5 multichannel buffers
7 commit 0c0efbacab8d70700d13301e0ae7975783c0cb0a upstream.
9 handle_ir_buffer_fill() assumed that a completed descriptor would be
10 indicated by a non-zero transfer_status (as in most other descriptors).
11 However, this field is written by the controller as soon as (the end of)
12 the first packet has been written into the buffer. As a consequence, if
13 we happen to run into such a descriptor when the interrupt handler is
14 executed after such a packet has completed, the descriptor would be
15 taken out of the list of active descriptors as soon as the buffer had
16 been partially filled, so the event for the buffer being completely
17 filled would never be sent.
19 To fix this, handle descriptors only when they have been completely
20 filled, i.e., when res_count == 0. (This also matches the condition
21 that is reported by the controller with an interrupt.)
23 Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
24 Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
25 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
26 ---
27 drivers/firewire/ohci.c | 5 ++---
28 1 file changed, 2 insertions(+), 3 deletions(-)
30 diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
31 index 7f5f0da..0a0225a 100644
32 --- a/drivers/firewire/ohci.c
33 +++ b/drivers/firewire/ohci.c
34 @@ -2748,7 +2748,7 @@ static int handle_ir_buffer_fill(struct context *context,
35 container_of(context, struct iso_context, context);
36 u32 buffer_dma;
38 - if (!last->transfer_status)
39 + if (last->res_count != 0)
40 /* Descriptor(s) not done yet, stop iteration */
41 return 0;
43 @@ -2762,8 +2762,7 @@ static int handle_ir_buffer_fill(struct context *context,
44 if (le16_to_cpu(last->control) & DESCRIPTOR_IRQ_ALWAYS)
45 ctx->base.callback.mc(&ctx->base,
46 le32_to_cpu(last->data_address) +
47 - le16_to_cpu(last->req_count) -
48 - le16_to_cpu(last->res_count),
49 + le16_to_cpu(last->req_count),
50 ctx->base.callback_data);
52 return 1;
53 --
54 1.7.9.4