diff options
author | Tatyana Brokhman <tlinder@codeaurora.org> | 2011-06-28 09:33:48 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-06-28 14:14:36 -0400 |
commit | 72c973dd2b01b212a159faa330a2bc641a3ed809 (patch) | |
tree | 2fbc36b4103678cd9b7599deaab06f89e4871de2 /include/linux/usb | |
parent | 0f91349b89f37dfad7b77f7829a105b6a0f526ec (diff) |
usb: gadget: add usb_endpoint_descriptor to struct usb_ep
Change usb_ep_enable() prototype to use endpoint
descriptor from usb_ep.
This optimization spares the FDs from saving the
endpoint chosen descriptor. This optimization is
not full though. To fully exploit this change, one
needs to update all the UDCs as well since in the
current implementation each of them saves the
endpoint descriptor in it's internal (and extended)
endpoint structure.
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux/usb')
-rw-r--r-- | include/linux/usb/gadget.h | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 18979cfb6d66..fe50912585f8 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h | |||
@@ -132,8 +132,9 @@ struct usb_ep_ops { | |||
132 | * @maxpacket:The maximum packet size used on this endpoint. The initial | 132 | * @maxpacket:The maximum packet size used on this endpoint. The initial |
133 | * value can sometimes be reduced (hardware allowing), according to | 133 | * value can sometimes be reduced (hardware allowing), according to |
134 | * the endpoint descriptor used to configure the endpoint. | 134 | * the endpoint descriptor used to configure the endpoint. |
135 | * @driver_data:for use by the gadget driver. all other fields are | 135 | * @driver_data:for use by the gadget driver. |
136 | * read-only to gadget drivers. | 136 | * @desc: endpoint descriptor. This pointer is set before the endpoint is |
137 | * enabled and remains valid until the endpoint is disabled. | ||
137 | * | 138 | * |
138 | * the bus controller driver lists all the general purpose endpoints in | 139 | * the bus controller driver lists all the general purpose endpoints in |
139 | * gadget->ep_list. the control endpoint (gadget->ep0) is not in that list, | 140 | * gadget->ep_list. the control endpoint (gadget->ep0) is not in that list, |
@@ -146,6 +147,7 @@ struct usb_ep { | |||
146 | const struct usb_ep_ops *ops; | 147 | const struct usb_ep_ops *ops; |
147 | struct list_head ep_list; | 148 | struct list_head ep_list; |
148 | unsigned maxpacket:16; | 149 | unsigned maxpacket:16; |
150 | const struct usb_endpoint_descriptor *desc; | ||
149 | }; | 151 | }; |
150 | 152 | ||
151 | /*-------------------------------------------------------------------------*/ | 153 | /*-------------------------------------------------------------------------*/ |
@@ -154,11 +156,8 @@ struct usb_ep { | |||
154 | * usb_ep_enable - configure endpoint, making it usable | 156 | * usb_ep_enable - configure endpoint, making it usable |
155 | * @ep:the endpoint being configured. may not be the endpoint named "ep0". | 157 | * @ep:the endpoint being configured. may not be the endpoint named "ep0". |
156 | * drivers discover endpoints through the ep_list of a usb_gadget. | 158 | * drivers discover endpoints through the ep_list of a usb_gadget. |
157 | * @desc:descriptor for desired behavior. caller guarantees this pointer | ||
158 | * remains valid until the endpoint is disabled; the data byte order | ||
159 | * is little-endian (usb-standard). | ||
160 | * | 159 | * |
161 | * when configurations are set, or when interface settings change, the driver | 160 | * When configurations are set, or when interface settings change, the driver |
162 | * will enable or disable the relevant endpoints. while it is enabled, an | 161 | * will enable or disable the relevant endpoints. while it is enabled, an |
163 | * endpoint may be used for i/o until the driver receives a disconnect() from | 162 | * endpoint may be used for i/o until the driver receives a disconnect() from |
164 | * the host or until the endpoint is disabled. | 163 | * the host or until the endpoint is disabled. |
@@ -173,10 +172,9 @@ struct usb_ep { | |||
173 | * | 172 | * |
174 | * returns zero, or a negative error code. | 173 | * returns zero, or a negative error code. |
175 | */ | 174 | */ |
176 | static inline int usb_ep_enable(struct usb_ep *ep, | 175 | static inline int usb_ep_enable(struct usb_ep *ep) |
177 | const struct usb_endpoint_descriptor *desc) | ||
178 | { | 176 | { |
179 | return ep->ops->enable(ep, desc); | 177 | return ep->ops->enable(ep, ep->desc); |
180 | } | 178 | } |
181 | 179 | ||
182 | /** | 180 | /** |