diff options
Diffstat (limited to 'meta/recipes-kernel/linux/linux-omap-2.6.29/musb/0017-musb_host-refactor-URB-giveback.patch')
-rw-r--r-- | meta/recipes-kernel/linux/linux-omap-2.6.29/musb/0017-musb_host-refactor-URB-giveback.patch | 132 |
1 files changed, 132 insertions, 0 deletions
diff --git a/meta/recipes-kernel/linux/linux-omap-2.6.29/musb/0017-musb_host-refactor-URB-giveback.patch b/meta/recipes-kernel/linux/linux-omap-2.6.29/musb/0017-musb_host-refactor-URB-giveback.patch new file mode 100644 index 0000000000..4a520dff87 --- /dev/null +++ b/meta/recipes-kernel/linux/linux-omap-2.6.29/musb/0017-musb_host-refactor-URB-giveback.patch | |||
@@ -0,0 +1,132 @@ | |||
1 | From 013056a09afd324e729d64b9a0e66a004604e1d6 Mon Sep 17 00:00:00 2001 | ||
2 | From: Sergei Shtylyov <sshtylyov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org> | ||
3 | Date: Fri, 27 Mar 2009 12:58:31 -0700 | ||
4 | Subject: [PATCH] musb_host: refactor URB giveback | ||
5 | |||
6 | As musb_advance_schedule() is now the only remaning | ||
7 | caller of musb_giveback() (and the only valid context | ||
8 | of such call), just fold the latter into the former | ||
9 | and then rename __musb_giveback() into musb_giveback(). | ||
10 | |||
11 | This is a net minor shrink. | ||
12 | |||
13 | Signed-off-by: Sergei Shtylyov <sshtylyov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org> | ||
14 | Signed-off-by: David Brownell <dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org> | ||
15 | --- | ||
16 | drivers/usb/musb/musb_host.c | 54 +++++++++++++++-------------------------- | ||
17 | 1 files changed, 20 insertions(+), 34 deletions(-) | ||
18 | |||
19 | diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c | ||
20 | index bc89079..e833959 100644 | ||
21 | --- a/drivers/usb/musb/musb_host.c | ||
22 | +++ b/drivers/usb/musb/musb_host.c | ||
23 | @@ -292,9 +292,8 @@ start: | ||
24 | } | ||
25 | } | ||
26 | |||
27 | -/* caller owns controller lock, irqs are blocked */ | ||
28 | -static void | ||
29 | -__musb_giveback(struct musb *musb, struct urb *urb, int status) | ||
30 | +/* Context: caller owns controller lock, IRQs are blocked */ | ||
31 | +static void musb_giveback(struct musb *musb, struct urb *urb, int status) | ||
32 | __releases(musb->lock) | ||
33 | __acquires(musb->lock) | ||
34 | { | ||
35 | @@ -347,14 +346,22 @@ static inline void musb_save_toggle(struct musb_qh *qh, int is_in, | ||
36 | usb_settoggle(urb->dev, qh->epnum, !is_in, csr ? 1 : 0); | ||
37 | } | ||
38 | |||
39 | -/* caller owns controller lock, irqs are blocked */ | ||
40 | -static struct musb_qh * | ||
41 | -musb_giveback(struct musb_qh *qh, struct urb *urb, int status) | ||
42 | +/* | ||
43 | + * Advance this hardware endpoint's queue, completing the specified URB and | ||
44 | + * advancing to either the next URB queued to that qh, or else invalidating | ||
45 | + * that qh and advancing to the next qh scheduled after the current one. | ||
46 | + * | ||
47 | + * Context: caller owns controller lock, IRQs are blocked | ||
48 | + */ | ||
49 | +static void musb_advance_schedule(struct musb *musb, struct urb *urb, | ||
50 | + struct musb_hw_ep *hw_ep, int is_in) | ||
51 | { | ||
52 | + struct musb_qh *qh = musb_ep_get_qh(hw_ep, is_in); | ||
53 | struct musb_hw_ep *ep = qh->hw_ep; | ||
54 | - struct musb *musb = ep->musb; | ||
55 | - int is_in = usb_pipein(urb->pipe); | ||
56 | int ready = qh->is_ready; | ||
57 | + int status; | ||
58 | + | ||
59 | + status = (urb->status == -EINPROGRESS) ? 0 : urb->status; | ||
60 | |||
61 | /* save toggle eagerly, for paranoia */ | ||
62 | switch (qh->type) { | ||
63 | @@ -363,13 +370,13 @@ musb_giveback(struct musb_qh *qh, struct urb *urb, int status) | ||
64 | musb_save_toggle(qh, is_in, urb); | ||
65 | break; | ||
66 | case USB_ENDPOINT_XFER_ISOC: | ||
67 | - if (status == 0 && urb->error_count) | ||
68 | + if (urb->error_count) | ||
69 | status = -EXDEV; | ||
70 | break; | ||
71 | } | ||
72 | |||
73 | qh->is_ready = 0; | ||
74 | - __musb_giveback(musb, urb, status); | ||
75 | + musb_giveback(musb, urb, status); | ||
76 | qh->is_ready = ready; | ||
77 | |||
78 | /* reclaim resources (and bandwidth) ASAP; deschedule it, and | ||
79 | @@ -413,31 +420,10 @@ musb_giveback(struct musb_qh *qh, struct urb *urb, int status) | ||
80 | break; | ||
81 | } | ||
82 | } | ||
83 | - return qh; | ||
84 | -} | ||
85 | - | ||
86 | -/* | ||
87 | - * Advance this hardware endpoint's queue, completing the specified urb and | ||
88 | - * advancing to either the next urb queued to that qh, or else invalidating | ||
89 | - * that qh and advancing to the next qh scheduled after the current one. | ||
90 | - * | ||
91 | - * Context: caller owns controller lock, irqs are blocked | ||
92 | - */ | ||
93 | -static void | ||
94 | -musb_advance_schedule(struct musb *musb, struct urb *urb, | ||
95 | - struct musb_hw_ep *hw_ep, int is_in) | ||
96 | -{ | ||
97 | - struct musb_qh *qh = musb_ep_get_qh(hw_ep, is_in); | ||
98 | - | ||
99 | - if (urb->status == -EINPROGRESS) | ||
100 | - qh = musb_giveback(qh, urb, 0); | ||
101 | - else | ||
102 | - qh = musb_giveback(qh, urb, urb->status); | ||
103 | |||
104 | if (qh != NULL && qh->is_ready) { | ||
105 | DBG(4, "... next ep%d %cX urb %p\n", | ||
106 | - hw_ep->epnum, is_in ? 'R' : 'T', | ||
107 | - next_urb(qh)); | ||
108 | + hw_ep->epnum, is_in ? 'R' : 'T', next_urb(qh)); | ||
109 | musb_start_urb(musb, is_in, qh); | ||
110 | } | ||
111 | } | ||
112 | @@ -2080,7 +2066,7 @@ static int musb_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) | ||
113 | |||
114 | ret = 0; | ||
115 | qh->is_ready = 0; | ||
116 | - __musb_giveback(musb, urb, 0); | ||
117 | + musb_giveback(musb, urb, 0); | ||
118 | qh->is_ready = ready; | ||
119 | |||
120 | /* If nothing else (usually musb_giveback) is using it | ||
121 | @@ -2164,7 +2150,7 @@ musb_h_disable(struct usb_hcd *hcd, struct usb_host_endpoint *hep) | ||
122 | * will activate any of these as it advances. | ||
123 | */ | ||
124 | while (!list_empty(&hep->urb_list)) | ||
125 | - __musb_giveback(musb, next_urb(qh), -ESHUTDOWN); | ||
126 | + musb_giveback(musb, next_urb(qh), -ESHUTDOWN); | ||
127 | |||
128 | hep->hcpriv = NULL; | ||
129 | list_del(&qh->ring); | ||
130 | -- | ||
131 | 1.6.0.4 | ||
132 | |||