task-pandora-*: Commit latest Xfce and Core tasks to build PAM correctly and package...
[openpandora.oe.git] / recipes / linux / omap3-pandora-kernel / musb-fix-ISO-in-unlink.diff
1 From: Ajay Kumar Gupta <ajay.gupta@ti.com>
2 To: linux-omap@vger.kernel.org
3 Cc: linux-usb@vger.kernel.org, felipe.balbi@nokia.com,
4         stern@rowland.harvard.edu, Ajay Kumar Gupta <ajay.gupta@ti.com>
5 Subject: [PATCH v3] OMAP:MUSB: Corrects urb unlink function path
6 Date:   Mon, 25 Aug 2008 10:52:16 +0530
7
8 Fixes kernel panic while ISO IN transfer is aborted.Replaced
9 usb_hcd_unlink_urb_from_ep() from musb_giveback() to __musb_giveback()
10 to make sure urb is unlinked before giveback when __musb_giveback() is
11 called from musb_urb_dequeue().
12
13 Acquired musb->lock() before usb_hcd_unlink_urb_from_ep() within in 
14 enqueue path.
15
16 Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
17 ---
18  drivers/usb/musb/musb_host.c |    7 +++++--
19  1 files changed, 5 insertions(+), 2 deletions(-)
20
21 diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
22 index 08e421f..4279311 100644
23 --- a/drivers/usb/musb/musb_host.c
24 +++ b/drivers/usb/musb/musb_host.c
25 @@ -291,6 +291,7 @@ __acquires(musb->lock)
26                         urb->actual_length, urb->transfer_buffer_length
27                         );
28  
29 +       usb_hcd_unlink_urb_from_ep(musb_to_hcd(musb), urb);
30         spin_unlock(&musb->lock);
31         usb_hcd_giveback_urb(musb_to_hcd(musb), urb, status);
32         spin_lock(&musb->lock);
33 @@ -353,8 +354,6 @@ musb_giveback(struct musb_qh *qh, struct urb *urb, int status)
34                 break;
35         }
36  
37 -       usb_hcd_unlink_urb_from_ep(musb_to_hcd(musb), urb);
38 -
39         qh->is_ready = 0;
40         __musb_giveback(musb, urb, status);
41         qh->is_ready = ready;
42 @@ -1787,7 +1786,9 @@ static int musb_urb_enqueue(
43          */
44         qh = kzalloc(sizeof *qh, mem_flags);
45         if (!qh) {
46 +               spin_lock_irqsave(&musb->lock, flags);
47                 usb_hcd_unlink_urb_from_ep(hcd, urb);
48 +               spin_unlock_irqrestore(&musb->lock, flags);
49                 return -ENOMEM;
50         }
51  
52 @@ -1899,7 +1900,9 @@ static int musb_urb_enqueue(
53  
54  done:
55         if (ret != 0) {
56 +               spin_lock_irqsave(&musb->lock, flags);
57                 usb_hcd_unlink_urb_from_ep(hcd, urb);
58 +               spin_unlock_irqrestore(&musb->lock, flags);
59                 kfree(qh);
60         }
61         return ret;
62 -- 
63 1.5.6
64
65 --
66 To unsubscribe from this list: send the line "unsubscribe linux-omap" in
67 the body of a message to majordomo@vger.kernel.org
68 More majordomo info at  http://vger.kernel.org/majordomo-info.html
69