aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/misc/adutux.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/misc/adutux.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/misc/adutux.c')
-rw-r--r--drivers/usb/misc/adutux.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c
index a6afd15f6a46..fe858711651c 100644
--- a/drivers/usb/misc/adutux.c
+++ b/drivers/usb/misc/adutux.c
@@ -213,7 +213,7 @@ static void adu_interrupt_in_callback(struct urb *urb)
213 213
214 if (urb->actual_length > 0 && dev->interrupt_in_buffer[0] != 0x00) { 214 if (urb->actual_length > 0 && dev->interrupt_in_buffer[0] != 0x00) {
215 if (dev->read_buffer_length < 215 if (dev->read_buffer_length <
216 (4 * le16_to_cpu(dev->interrupt_in_endpoint->wMaxPacketSize)) - 216 (4 * usb_endpoint_maxp(dev->interrupt_in_endpoint)) -
217 (urb->actual_length)) { 217 (urb->actual_length)) {
218 memcpy (dev->read_buffer_primary + 218 memcpy (dev->read_buffer_primary +
219 dev->read_buffer_length, 219 dev->read_buffer_length,
@@ -315,7 +315,7 @@ static int adu_open(struct inode *inode, struct file *file)
315 usb_rcvintpipe(dev->udev, 315 usb_rcvintpipe(dev->udev,
316 dev->interrupt_in_endpoint->bEndpointAddress), 316 dev->interrupt_in_endpoint->bEndpointAddress),
317 dev->interrupt_in_buffer, 317 dev->interrupt_in_buffer,
318 le16_to_cpu(dev->interrupt_in_endpoint->wMaxPacketSize), 318 usb_endpoint_maxp(dev->interrupt_in_endpoint),
319 adu_interrupt_in_callback, dev, 319 adu_interrupt_in_callback, dev,
320 dev->interrupt_in_endpoint->bInterval); 320 dev->interrupt_in_endpoint->bInterval);
321 dev->read_urb_finished = 0; 321 dev->read_urb_finished = 0;
@@ -483,7 +483,7 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count,
483 usb_rcvintpipe(dev->udev, 483 usb_rcvintpipe(dev->udev,
484 dev->interrupt_in_endpoint->bEndpointAddress), 484 dev->interrupt_in_endpoint->bEndpointAddress),
485 dev->interrupt_in_buffer, 485 dev->interrupt_in_buffer,
486 le16_to_cpu(dev->interrupt_in_endpoint->wMaxPacketSize), 486 usb_endpoint_maxp(dev->interrupt_in_endpoint),
487 adu_interrupt_in_callback, 487 adu_interrupt_in_callback,
488 dev, 488 dev,
489 dev->interrupt_in_endpoint->bInterval); 489 dev->interrupt_in_endpoint->bInterval);
@@ -536,7 +536,7 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count,
536 usb_rcvintpipe(dev->udev, 536 usb_rcvintpipe(dev->udev,
537 dev->interrupt_in_endpoint->bEndpointAddress), 537 dev->interrupt_in_endpoint->bEndpointAddress),
538 dev->interrupt_in_buffer, 538 dev->interrupt_in_buffer,
539 le16_to_cpu(dev->interrupt_in_endpoint->wMaxPacketSize), 539 usb_endpoint_maxp(dev->interrupt_in_endpoint),
540 adu_interrupt_in_callback, 540 adu_interrupt_in_callback,
541 dev, 541 dev,
542 dev->interrupt_in_endpoint->bInterval); 542 dev->interrupt_in_endpoint->bInterval);
@@ -622,7 +622,7 @@ static ssize_t adu_write(struct file *file, const __user char *buffer,
622 dbg(4," %s : sending, count = %Zd", __func__, count); 622 dbg(4," %s : sending, count = %Zd", __func__, count);
623 623
624 /* write the data into interrupt_out_buffer from userspace */ 624 /* write the data into interrupt_out_buffer from userspace */
625 buffer_size = le16_to_cpu(dev->interrupt_out_endpoint->wMaxPacketSize); 625 buffer_size = usb_endpoint_maxp(dev->interrupt_out_endpoint);
626 bytes_to_write = count > buffer_size ? buffer_size : count; 626 bytes_to_write = count > buffer_size ? buffer_size : count;
627 dbg(4," %s : buffer_size = %Zd, count = %Zd, bytes_to_write = %Zd", 627 dbg(4," %s : buffer_size = %Zd, count = %Zd, bytes_to_write = %Zd",
628 __func__, buffer_size, count, bytes_to_write); 628 __func__, buffer_size, count, bytes_to_write);
@@ -752,8 +752,8 @@ static int adu_probe(struct usb_interface *interface,
752 goto error; 752 goto error;
753 } 753 }
754 754
755 in_end_size = le16_to_cpu(dev->interrupt_in_endpoint->wMaxPacketSize); 755 in_end_size = usb_endpoint_maxp(dev->interrupt_in_endpoint);
756 out_end_size = le16_to_cpu(dev->interrupt_out_endpoint->wMaxPacketSize); 756 out_end_size = usb_endpoint_maxp(dev->interrupt_out_endpoint);
757 757
758 dev->read_buffer_primary = kmalloc((4 * in_end_size), GFP_KERNEL); 758 dev->read_buffer_primary = kmalloc((4 * in_end_size), GFP_KERNEL);
759 if (!dev->read_buffer_primary) { 759 if (!dev->read_buffer_primary) {