aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/pxa25x_udc.c
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2011-08-23 06:12:03 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-08-23 12:47:40 -0400
commit29cc88979a8818cd8c5019426e945aed118b400e (patch)
tree849401ad869d09ce45dd7a3fadd7eb71b1e9fcbd /drivers/usb/gadget/pxa25x_udc.c
parent46a57283e86c68351377ac3349f1465aee938fbd (diff)
USB: use usb_endpoint_maxp() instead of le16_to_cpu()
Now ${LINUX}/drivers/usb/* can use usb_endpoint_maxp(desc) to get maximum packet size instead of le16_to_cpu(desc->wMaxPacketSize). This patch fix it up Cc: Armin Fuerst <fuerst@in.tum.de> Cc: Pavel Machek <pavel@ucw.cz> Cc: Johannes Erdfelt <johannes@erdfelt.com> Cc: Vojtech Pavlik <vojtech@suse.cz> Cc: Oliver Neukum <oliver@neukum.name> Cc: David Kubicek <dave@awk.cz> Cc: Johan Hovold <jhovold@gmail.com> Cc: Brad Hards <bhards@bigpond.net.au> Acked-by: Felipe Balbi <balbi@ti.com> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Cc: Thomas Dahlmann <dahlmann.thomas@arcor.de> Cc: David Brownell <david-b@pacbell.net> Cc: David Lopo <dlopo@chipidea.mips.com> Cc: Alan Stern <stern@rowland.harvard.edu> Cc: Michal Nazarewicz <m.nazarewicz@samsung.com> Cc: Xie Xiaobo <X.Xie@freescale.com> Cc: Li Yang <leoli@freescale.com> Cc: Jiang Bo <tanya.jiang@freescale.com> Cc: Yuan-hsin Chen <yhchen@faraday-tech.com> Cc: Darius Augulis <augulis.darius@gmail.com> Cc: Xiaochen Shen <xiaochen.shen@intel.com> Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Cc: OKI SEMICONDUCTOR, <toshiharu-linux@dsn.okisemi.com> Cc: Robert Jarzmik <robert.jarzmik@free.fr> Cc: Ben Dooks <ben@simtec.co.uk> Cc: Thomas Abraham <thomas.ab@samsung.com> Cc: Herbert Pƶtzl <herbert@13thfloor.at> Cc: Arnaud Patard <arnaud.patard@rtp-net.org> Cc: Roman Weissgaerber <weissg@vienna.at> Acked-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Cc: Tony Olech <tony.olech@elandigitalsystems.com> Cc: Florian Floe Echtler <echtler@fs.tum.de> Cc: Christian Lucht <lucht@codemercs.com> Cc: Juergen Stuber <starblue@sourceforge.net> Cc: Georges Toth <g.toth@e-biz.lu> Cc: Bill Ryder <bryder@sgi.com> Cc: Kuba Ober <kuba@mareimbrium.org> Cc: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget/pxa25x_udc.c')
-rw-r--r--drivers/usb/gadget/pxa25x_udc.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c
index e4e59b4de25d..7862465291d1 100644
--- a/drivers/usb/gadget/pxa25x_udc.c
+++ b/drivers/usb/gadget/pxa25x_udc.c
@@ -232,8 +232,7 @@ static int pxa25x_ep_enable (struct usb_ep *_ep,
232 if (!_ep || !desc || ep->desc || _ep->name == ep0name 232 if (!_ep || !desc || ep->desc || _ep->name == ep0name
233 || desc->bDescriptorType != USB_DT_ENDPOINT 233 || desc->bDescriptorType != USB_DT_ENDPOINT
234 || ep->bEndpointAddress != desc->bEndpointAddress 234 || ep->bEndpointAddress != desc->bEndpointAddress
235 || ep->fifo_size < le16_to_cpu 235 || ep->fifo_size < usb_endpoint_maxp (desc)) {
236 (desc->wMaxPacketSize)) {
237 DMSG("%s, bad ep or descriptor\n", __func__); 236 DMSG("%s, bad ep or descriptor\n", __func__);
238 return -EINVAL; 237 return -EINVAL;
239 } 238 }
@@ -248,7 +247,7 @@ static int pxa25x_ep_enable (struct usb_ep *_ep,
248 247
249 /* hardware _could_ do smaller, but driver doesn't */ 248 /* hardware _could_ do smaller, but driver doesn't */
250 if ((desc->bmAttributes == USB_ENDPOINT_XFER_BULK 249 if ((desc->bmAttributes == USB_ENDPOINT_XFER_BULK
251 && le16_to_cpu (desc->wMaxPacketSize) 250 && usb_endpoint_maxp (desc)
252 != BULK_FIFO_SIZE) 251 != BULK_FIFO_SIZE)
253 || !desc->wMaxPacketSize) { 252 || !desc->wMaxPacketSize) {
254 DMSG("%s, bad %s maxpacket\n", __func__, _ep->name); 253 DMSG("%s, bad %s maxpacket\n", __func__, _ep->name);
@@ -264,7 +263,7 @@ static int pxa25x_ep_enable (struct usb_ep *_ep,
264 ep->desc = desc; 263 ep->desc = desc;
265 ep->stopped = 0; 264 ep->stopped = 0;
266 ep->pio_irqs = 0; 265 ep->pio_irqs = 0;
267 ep->ep.maxpacket = le16_to_cpu (desc->wMaxPacketSize); 266 ep->ep.maxpacket = usb_endpoint_maxp (desc);
268 267
269 /* flush fifo (mostly for OUT buffers) */ 268 /* flush fifo (mostly for OUT buffers) */
270 pxa25x_ep_fifo_flush (_ep); 269 pxa25x_ep_fifo_flush (_ep);
@@ -401,7 +400,7 @@ write_fifo (struct pxa25x_ep *ep, struct pxa25x_request *req)
401{ 400{
402 unsigned max; 401 unsigned max;
403 402
404 max = le16_to_cpu(ep->desc->wMaxPacketSize); 403 max = usb_endpoint_maxp(ep->desc);
405 do { 404 do {
406 unsigned count; 405 unsigned count;
407 int is_last, is_short; 406 int is_last, is_short;
@@ -671,8 +670,7 @@ pxa25x_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
671 * we can report per-packet status. that also helps with dma. 670 * we can report per-packet status. that also helps with dma.
672 */ 671 */
673 if (unlikely (ep->bmAttributes == USB_ENDPOINT_XFER_ISOC 672 if (unlikely (ep->bmAttributes == USB_ENDPOINT_XFER_ISOC
674 && req->req.length > le16_to_cpu 673 && req->req.length > usb_endpoint_maxp (ep->desc)))
675 (ep->desc->wMaxPacketSize)))
676 return -EMSGSIZE; 674 return -EMSGSIZE;
677 675
678 DBG(DBG_NOISY, "%s queue req %p, len %d buf %p\n", 676 DBG(DBG_NOISY, "%s queue req %p, len %d buf %p\n",
@@ -1105,7 +1103,7 @@ udc_seq_show(struct seq_file *m, void *_d)
1105 tmp = *dev->ep [i].reg_udccs; 1103 tmp = *dev->ep [i].reg_udccs;
1106 seq_printf(m, 1104 seq_printf(m,
1107 "%s max %d %s udccs %02x irqs %lu\n", 1105 "%s max %d %s udccs %02x irqs %lu\n",
1108 ep->ep.name, le16_to_cpu(desc->wMaxPacketSize), 1106 ep->ep.name, usb_endpoint_maxp(desc),
1109 "pio", tmp, ep->pio_irqs); 1107 "pio", tmp, ep->pio_irqs);
1110 /* TODO translate all five groups of udccs bits! */ 1108 /* TODO translate all five groups of udccs bits! */
1111 1109