spcp8x5.c (a9de18eb761f7c1c860964b2e5addc1a35c7e861) spcp8x5.c (50de36f7af3b1d791c402478210790c582126fe5)
1/*
2 * spcp8x5 USB to serial adaptor driver
3 *
4 * Copyright (C) 2006 Linxb (xubin.lin@worldplus.com.cn)
5 * Copyright (C) 2006 S1 Corp.
6 *
7 * Original driver for 2.6.10 pl2303 driver by
8 * Greg Kroah-Hartman (greg@kroah.com)

--- 695 unchanged lines hidden (view full) ---

704static void spcp8x5_read_bulk_callback(struct urb *urb)
705{
706 struct usb_serial_port *port = urb->context;
707 struct spcp8x5_private *priv = usb_get_serial_port_data(port);
708 struct tty_struct *tty;
709 unsigned char *data = urb->transfer_buffer;
710 unsigned long flags;
711 int i;
1/*
2 * spcp8x5 USB to serial adaptor driver
3 *
4 * Copyright (C) 2006 Linxb (xubin.lin@worldplus.com.cn)
5 * Copyright (C) 2006 S1 Corp.
6 *
7 * Original driver for 2.6.10 pl2303 driver by
8 * Greg Kroah-Hartman (greg@kroah.com)

--- 695 unchanged lines hidden (view full) ---

704static void spcp8x5_read_bulk_callback(struct urb *urb)
705{
706 struct usb_serial_port *port = urb->context;
707 struct spcp8x5_private *priv = usb_get_serial_port_data(port);
708 struct tty_struct *tty;
709 unsigned char *data = urb->transfer_buffer;
710 unsigned long flags;
711 int i;
712 int result;
713 u8 status = 0;
712 int result = urb->status;
713 u8 status;
714 char tty_flag;
715
714 char tty_flag;
715
716 dev_dbg(&port->dev, "start, urb->status = %d, "
717 "urb->actual_length = %d\n,", urb->status, urb->actual_length);
716 dev_dbg(&port->dev, "start, result = %d, urb->actual_length = %d\n,",
717 result, urb->actual_length);
718
719 /* check the urb status */
718
719 /* check the urb status */
720 if (urb->status) {
720 if (result) {
721 if (!port->port.count)
722 return;
721 if (!port->port.count)
722 return;
723 if (urb->status == -EPROTO) {
723 if (result == -EPROTO) {
724 /* spcp8x5 mysteriously fails with -EPROTO */
725 /* reschedule the read */
724 /* spcp8x5 mysteriously fails with -EPROTO */
725 /* reschedule the read */
726 urb->status = 0;
727 urb->dev = port->serial->dev;
728 result = usb_submit_urb(urb , GFP_ATOMIC);
729 if (result)
730 dev_dbg(&port->dev,
731 "failed submitting read urb %d\n",
732 result);
733 return;
734 }

--- 93 unchanged lines hidden (view full) ---

828/* this is the call back function for write urb. NOTE we should not sleep in
829 * this routine. check the urb return code and then submit the write urb again
830 * to hold the write loop */
831static void spcp8x5_write_bulk_callback(struct urb *urb)
832{
833 struct usb_serial_port *port = urb->context;
834 struct spcp8x5_private *priv = usb_get_serial_port_data(port);
835 int result;
726 urb->dev = port->serial->dev;
727 result = usb_submit_urb(urb , GFP_ATOMIC);
728 if (result)
729 dev_dbg(&port->dev,
730 "failed submitting read urb %d\n",
731 result);
732 return;
733 }

--- 93 unchanged lines hidden (view full) ---

827/* this is the call back function for write urb. NOTE we should not sleep in
828 * this routine. check the urb return code and then submit the write urb again
829 * to hold the write loop */
830static void spcp8x5_write_bulk_callback(struct urb *urb)
831{
832 struct usb_serial_port *port = urb->context;
833 struct spcp8x5_private *priv = usb_get_serial_port_data(port);
834 int result;
835 int status = urb->status;
836
836
837 switch (urb->status) {
837 switch (status) {
838 case 0:
839 /* success */
840 break;
841 case -ECONNRESET:
842 case -ENOENT:
843 case -ESHUTDOWN:
844 /* this urb is terminated, clean up */
845 dev_dbg(&port->dev, "urb shutting down with status: %d\n",
838 case 0:
839 /* success */
840 break;
841 case -ECONNRESET:
842 case -ENOENT:
843 case -ESHUTDOWN:
844 /* this urb is terminated, clean up */
845 dev_dbg(&port->dev, "urb shutting down with status: %d\n",
846 urb->status);
846 status);
847 priv->write_urb_in_use = 0;
848 return;
849 default:
850 /* error in the urb, so we have to resubmit it */
851 dbg("%s - Overflow in write", __func__);
852 dbg("%s - nonzero write bulk status received: %d",
847 priv->write_urb_in_use = 0;
848 return;
849 default:
850 /* error in the urb, so we have to resubmit it */
851 dbg("%s - Overflow in write", __func__);
852 dbg("%s - nonzero write bulk status received: %d",
853 __func__, urb->status);
853 __func__, status);
854 port->write_urb->transfer_buffer_length = 1;
855 port->write_urb->dev = port->serial->dev;
856 result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
857 if (result)
858 dev_dbg(&port->dev,
859 "failed resubmitting write urb %d\n", result);
860 else
861 return;

--- 220 unchanged lines hidden ---
854 port->write_urb->transfer_buffer_length = 1;
855 port->write_urb->dev = port->serial->dev;
856 result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
857 if (result)
858 dev_dbg(&port->dev,
859 "failed resubmitting write urb %d\n", result);
860 else
861 return;

--- 220 unchanged lines hidden ---