summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/linux/linux-omap-2.6.29/musb/0019-musb_host-simplify-check-for-active-URB.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-kernel/linux/linux-omap-2.6.29/musb/0019-musb_host-simplify-check-for-active-URB.patch')
-rw-r--r--meta/recipes-kernel/linux/linux-omap-2.6.29/musb/0019-musb_host-simplify-check-for-active-URB.patch158
1 files changed, 158 insertions, 0 deletions
diff --git a/meta/recipes-kernel/linux/linux-omap-2.6.29/musb/0019-musb_host-simplify-check-for-active-URB.patch b/meta/recipes-kernel/linux/linux-omap-2.6.29/musb/0019-musb_host-simplify-check-for-active-URB.patch
new file mode 100644
index 0000000000..c0e57155c8
--- /dev/null
+++ b/meta/recipes-kernel/linux/linux-omap-2.6.29/musb/0019-musb_host-simplify-check-for-active-URB.patch
@@ -0,0 +1,158 @@
1From 69242ddd26151d45f46011cf7abc581b14699fb2 Mon Sep 17 00:00:00 2001
2From: Sergei Shtylyov <sshtylyov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
3Date: Fri, 27 Mar 2009 12:56:26 -0700
4Subject: [PATCH] musb_host: simplify check for active URB
5
6The existance of the scheduling list shouldn't matter in
7determining whether there's currectly an URB executing on a
8hardware endpoint. What should actually matter is the 'in_qh'
9or 'out_qh' fields of the 'struct musb_hw_ep' -- those are
10set in musb_start_urb() and cleared in musb_giveback() when
11the endpoint's URB list drains. Hence we should be able to
12replace the big *switch* statements in musb_urb_dequeue()
13and musb_h_disable() with mere musb_ep_get_qh() calls...
14
15While at it, do some more changes:
16
17 - add 'is_in' variable to musb_urb_dequeue();
18
19 - remove the unnecessary 'epnum' variable from musb_h_disable();
20
21 - fix the comment style in the vicinity.
22
23This is a minor shrink of source and object code.
24
25Signed-off-by: Sergei Shtylyov <sshtylyov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
26Signed-off-by: David Brownell <dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
27---
28 drivers/usb/musb/musb_host.c | 72 ++++++++---------------------------------
29 1 files changed, 14 insertions(+), 58 deletions(-)
30
31diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
32index e833959..e121e0e 100644
33--- a/drivers/usb/musb/musb_host.c
34+++ b/drivers/usb/musb/musb_host.c
35@@ -2008,14 +2008,14 @@ static int musb_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
36 {
37 struct musb *musb = hcd_to_musb(hcd);
38 struct musb_qh *qh;
39- struct list_head *sched;
40 unsigned long flags;
41+ int is_in = usb_pipein(urb->pipe);
42 int ret;
43
44 DBG(4, "urb=%p, dev%d ep%d%s\n", urb,
45 usb_pipedevice(urb->pipe),
46 usb_pipeendpoint(urb->pipe),
47- usb_pipein(urb->pipe) ? "in" : "out");
48+ is_in ? "in" : "out");
49
50 spin_lock_irqsave(&musb->lock, flags);
51 ret = usb_hcd_check_unlink_urb(hcd, urb, status);
52@@ -2026,45 +2026,23 @@ static int musb_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
53 if (!qh)
54 goto done;
55
56- /* Any URB not actively programmed into endpoint hardware can be
57+ /*
58+ * Any URB not actively programmed into endpoint hardware can be
59 * immediately given back; that's any URB not at the head of an
60 * endpoint queue, unless someday we get real DMA queues. And even
61 * if it's at the head, it might not be known to the hardware...
62 *
63- * Otherwise abort current transfer, pending dma, etc.; urb->status
64+ * Otherwise abort current transfer, pending DMA, etc.; urb->status
65 * has already been updated. This is a synchronous abort; it'd be
66 * OK to hold off until after some IRQ, though.
67+ *
68+ * NOTE: qh is invalid unless !list_empty(&hep->urb_list)
69 */
70- if (!qh->is_ready || urb->urb_list.prev != &qh->hep->urb_list)
71- ret = -EINPROGRESS;
72- else {
73- switch (qh->type) {
74- case USB_ENDPOINT_XFER_CONTROL:
75- sched = &musb->control;
76- break;
77- case USB_ENDPOINT_XFER_BULK:
78- if (qh->mux == 1) {
79- if (usb_pipein(urb->pipe))
80- sched = &musb->in_bulk;
81- else
82- sched = &musb->out_bulk;
83- break;
84- }
85- default:
86- /* REVISIT when we get a schedule tree, periodic
87- * transfers won't always be at the head of a
88- * singleton queue...
89- */
90- sched = NULL;
91- break;
92- }
93- }
94-
95- /* NOTE: qh is invalid unless !list_empty(&hep->urb_list) */
96- if (ret < 0 || (sched && qh != first_qh(sched))) {
97+ if (!qh->is_ready
98+ || urb->urb_list.prev != &qh->hep->urb_list
99+ || musb_ep_get_qh(qh->hw_ep, is_in) != qh) {
100 int ready = qh->is_ready;
101
102- ret = 0;
103 qh->is_ready = 0;
104 musb_giveback(musb, urb, 0);
105 qh->is_ready = ready;
106@@ -2088,13 +2066,11 @@ done:
107 static void
108 musb_h_disable(struct usb_hcd *hcd, struct usb_host_endpoint *hep)
109 {
110- u8 epnum = hep->desc.bEndpointAddress;
111+ u8 is_in = hep->desc.bEndpointAddress & USB_DIR_IN;
112 unsigned long flags;
113 struct musb *musb = hcd_to_musb(hcd);
114- u8 is_in = epnum & USB_DIR_IN;
115 struct musb_qh *qh;
116 struct urb *urb;
117- struct list_head *sched;
118
119 spin_lock_irqsave(&musb->lock, flags);
120
121@@ -2102,31 +2078,11 @@ musb_h_disable(struct usb_hcd *hcd, struct usb_host_endpoint *hep)
122 if (qh == NULL)
123 goto exit;
124
125- switch (qh->type) {
126- case USB_ENDPOINT_XFER_CONTROL:
127- sched = &musb->control;
128- break;
129- case USB_ENDPOINT_XFER_BULK:
130- if (qh->mux == 1) {
131- if (is_in)
132- sched = &musb->in_bulk;
133- else
134- sched = &musb->out_bulk;
135- break;
136- }
137- default:
138- /* REVISIT when we get a schedule tree, periodic transfers
139- * won't always be at the head of a singleton queue...
140- */
141- sched = NULL;
142- break;
143- }
144-
145- /* NOTE: qh is invalid unless !list_empty(&hep->urb_list) */
146+ /* NOTE: qh is invalid unless !list_empty(&hep->urb_list) */
147
148- /* kick first urb off the hardware, if needed */
149+ /* Kick the first URB off the hardware, if needed */
150 qh->is_ready = 0;
151- if (!sched || qh == first_qh(sched)) {
152+ if (musb_ep_get_qh(qh->hw_ep, is_in) == qh) {
153 urb = next_urb(qh);
154
155 /* make software (then hardware) stop ASAP */
156--
1571.6.0.4
158