diff options
author | Bill Pemberton <wfp5p@virginia.edu> | 2010-10-21 14:43:05 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-11-11 08:51:15 -0500 |
commit | f7043ecbb3f7b8632a6d6470f8f95160ac868d0f (patch) | |
tree | 643957628f663d5dc9c5d5fb3adbb534896b3ff1 /drivers/usb/serial | |
parent | c8ddb2713c624f432fa5fe3c7ecffcdda46ea0d4 (diff) |
USB: ssu100: remove max_packet_size calculation
The max_packet_size logic is taken from ftdi_sio, but it's not needed
for this device. This also makes proces_read_urb simpler.
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r-- | drivers/usb/serial/ssu100.c | 56 |
1 files changed, 8 insertions, 48 deletions
diff --git a/drivers/usb/serial/ssu100.c b/drivers/usb/serial/ssu100.c index f5312dd3331b..8359ec798959 100644 --- a/drivers/usb/serial/ssu100.c +++ b/drivers/usb/serial/ssu100.c | |||
@@ -79,7 +79,6 @@ struct ssu100_port_private { | |||
79 | u8 shadowLSR; | 79 | u8 shadowLSR; |
80 | u8 shadowMSR; | 80 | u8 shadowMSR; |
81 | wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */ | 81 | wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */ |
82 | unsigned short max_packet_size; | ||
83 | struct async_icount icount; | 82 | struct async_icount icount; |
84 | }; | 83 | }; |
85 | 84 | ||
@@ -464,36 +463,6 @@ static int ssu100_ioctl(struct tty_struct *tty, struct file *file, | |||
464 | return -ENOIOCTLCMD; | 463 | return -ENOIOCTLCMD; |
465 | } | 464 | } |
466 | 465 | ||
467 | static void ssu100_set_max_packet_size(struct usb_serial_port *port) | ||
468 | { | ||
469 | struct ssu100_port_private *priv = usb_get_serial_port_data(port); | ||
470 | struct usb_serial *serial = port->serial; | ||
471 | struct usb_device *udev = serial->dev; | ||
472 | |||
473 | struct usb_interface *interface = serial->interface; | ||
474 | struct usb_endpoint_descriptor *ep_desc = &interface->cur_altsetting->endpoint[1].desc; | ||
475 | |||
476 | unsigned num_endpoints; | ||
477 | int i; | ||
478 | unsigned long flags; | ||
479 | |||
480 | num_endpoints = interface->cur_altsetting->desc.bNumEndpoints; | ||
481 | dev_info(&udev->dev, "Number of endpoints %d\n", num_endpoints); | ||
482 | |||
483 | for (i = 0; i < num_endpoints; i++) { | ||
484 | dev_info(&udev->dev, "Endpoint %d MaxPacketSize %d\n", i+1, | ||
485 | interface->cur_altsetting->endpoint[i].desc.wMaxPacketSize); | ||
486 | ep_desc = &interface->cur_altsetting->endpoint[i].desc; | ||
487 | } | ||
488 | |||
489 | /* set max packet size based on descriptor */ | ||
490 | spin_lock_irqsave(&priv->status_lock, flags); | ||
491 | priv->max_packet_size = ep_desc->wMaxPacketSize; | ||
492 | spin_unlock_irqrestore(&priv->status_lock, flags); | ||
493 | |||
494 | dev_info(&udev->dev, "Setting MaxPacketSize %d\n", priv->max_packet_size); | ||
495 | } | ||
496 | |||
497 | static int ssu100_attach(struct usb_serial *serial) | 466 | static int ssu100_attach(struct usb_serial *serial) |
498 | { | 467 | { |
499 | struct ssu100_port_private *priv; | 468 | struct ssu100_port_private *priv; |
@@ -511,7 +480,6 @@ static int ssu100_attach(struct usb_serial *serial) | |||
511 | spin_lock_init(&priv->status_lock); | 480 | spin_lock_init(&priv->status_lock); |
512 | init_waitqueue_head(&priv->delta_msr_wait); | 481 | init_waitqueue_head(&priv->delta_msr_wait); |
513 | usb_set_serial_port_data(port, priv); | 482 | usb_set_serial_port_data(port, priv); |
514 | ssu100_set_max_packet_size(port); | ||
515 | 483 | ||
516 | return ssu100_initdevice(serial->dev); | 484 | return ssu100_initdevice(serial->dev); |
517 | } | 485 | } |
@@ -641,13 +609,14 @@ static void ssu100_update_lsr(struct usb_serial_port *port, u8 lsr, | |||
641 | 609 | ||
642 | } | 610 | } |
643 | 611 | ||
644 | static int ssu100_process_packet(struct tty_struct *tty, | 612 | static int ssu100_process_packet(struct urb *urb, |
645 | struct usb_serial_port *port, | 613 | struct tty_struct *tty) |
646 | struct ssu100_port_private *priv, | ||
647 | char *packet, int len) | ||
648 | { | 614 | { |
649 | int i; | 615 | struct usb_serial_port *port = urb->context; |
616 | char *packet = (char *)urb->transfer_buffer; | ||
650 | char flag = TTY_NORMAL; | 617 | char flag = TTY_NORMAL; |
618 | u32 len = urb->actual_length; | ||
619 | int i; | ||
651 | char *ch; | 620 | char *ch; |
652 | 621 | ||
653 | dbg("%s - port %d", __func__, port->number); | 622 | dbg("%s - port %d", __func__, port->number); |
@@ -685,12 +654,8 @@ static int ssu100_process_packet(struct tty_struct *tty, | |||
685 | static void ssu100_process_read_urb(struct urb *urb) | 654 | static void ssu100_process_read_urb(struct urb *urb) |
686 | { | 655 | { |
687 | struct usb_serial_port *port = urb->context; | 656 | struct usb_serial_port *port = urb->context; |
688 | struct ssu100_port_private *priv = usb_get_serial_port_data(port); | ||
689 | char *data = (char *)urb->transfer_buffer; | ||
690 | struct tty_struct *tty; | 657 | struct tty_struct *tty; |
691 | int count = 0; | 658 | int count; |
692 | int i; | ||
693 | int len; | ||
694 | 659 | ||
695 | dbg("%s", __func__); | 660 | dbg("%s", __func__); |
696 | 661 | ||
@@ -698,10 +663,7 @@ static void ssu100_process_read_urb(struct urb *urb) | |||
698 | if (!tty) | 663 | if (!tty) |
699 | return; | 664 | return; |
700 | 665 | ||
701 | for (i = 0; i < urb->actual_length; i += priv->max_packet_size) { | 666 | count = ssu100_process_packet(urb, tty); |
702 | len = min_t(int, urb->actual_length - i, priv->max_packet_size); | ||
703 | count += ssu100_process_packet(tty, port, priv, &data[i], len); | ||
704 | } | ||
705 | 667 | ||
706 | if (count) | 668 | if (count) |
707 | tty_flip_buffer_push(tty); | 669 | tty_flip_buffer_push(tty); |
@@ -717,8 +679,6 @@ static struct usb_serial_driver ssu100_device = { | |||
717 | .id_table = id_table, | 679 | .id_table = id_table, |
718 | .usb_driver = &ssu100_driver, | 680 | .usb_driver = &ssu100_driver, |
719 | .num_ports = 1, | 681 | .num_ports = 1, |
720 | .bulk_in_size = 256, | ||
721 | .bulk_out_size = 256, | ||
722 | .open = ssu100_open, | 682 | .open = ssu100_open, |
723 | .close = ssu100_close, | 683 | .close = ssu100_close, |
724 | .attach = ssu100_attach, | 684 | .attach = ssu100_attach, |