diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/serial/pl2303.c | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index a52115407ea1..dceda2e43c15 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -817,15 +817,40 @@ static void pl2303_shutdown (struct usb_serial *serial) | |||
817 | } | 817 | } |
818 | } | 818 | } |
819 | 819 | ||
820 | static void pl2303_update_line_status(struct usb_serial_port *port, | ||
821 | unsigned char *data, | ||
822 | unsigned int actual_length) | ||
823 | { | ||
824 | |||
825 | struct pl2303_private *priv = usb_get_serial_port_data(port); | ||
826 | unsigned long flags; | ||
827 | u8 status_idx = UART_STATE; | ||
828 | u8 length = UART_STATE; | ||
829 | |||
830 | if ((le16_to_cpu(port->serial->dev->descriptor.idVendor) == SIEMENS_VENDOR_ID) && | ||
831 | (le16_to_cpu(port->serial->dev->descriptor.idProduct) == SIEMENS_PRODUCT_ID_X65)) { | ||
832 | length = 1; | ||
833 | status_idx = 0; | ||
834 | } | ||
835 | |||
836 | if (actual_length < length) | ||
837 | goto exit; | ||
838 | |||
839 | /* Save off the uart status for others to look at */ | ||
840 | spin_lock_irqsave(&priv->lock, flags); | ||
841 | priv->line_status = data[status_idx]; | ||
842 | spin_unlock_irqrestore(&priv->lock, flags); | ||
843 | |||
844 | exit: | ||
845 | return; | ||
846 | } | ||
820 | 847 | ||
821 | static void pl2303_read_int_callback (struct urb *urb, struct pt_regs *regs) | 848 | static void pl2303_read_int_callback (struct urb *urb, struct pt_regs *regs) |
822 | { | 849 | { |
823 | struct usb_serial_port *port = (struct usb_serial_port *) urb->context; | 850 | struct usb_serial_port *port = (struct usb_serial_port *) urb->context; |
824 | struct pl2303_private *priv = usb_get_serial_port_data(port); | ||
825 | unsigned char *data = urb->transfer_buffer; | 851 | unsigned char *data = urb->transfer_buffer; |
826 | unsigned long flags; | 852 | unsigned int actual_length = urb->actual_length; |
827 | int status; | 853 | int status; |
828 | u8 uart_state; | ||
829 | 854 | ||
830 | dbg("%s (%d)", __FUNCTION__, port->number); | 855 | dbg("%s (%d)", __FUNCTION__, port->number); |
831 | 856 | ||
@@ -844,19 +869,9 @@ static void pl2303_read_int_callback (struct urb *urb, struct pt_regs *regs) | |||
844 | goto exit; | 869 | goto exit; |
845 | } | 870 | } |
846 | 871 | ||
847 | |||
848 | usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, urb->transfer_buffer); | 872 | usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, urb->transfer_buffer); |
873 | pl2303_update_line_status(port, data, actual_length); | ||
849 | 874 | ||
850 | if (urb->actual_length < UART_STATE) | ||
851 | goto exit; | ||
852 | |||
853 | /* Save off the uart status for others to look at */ | ||
854 | uart_state = data[UART_STATE]; | ||
855 | spin_lock_irqsave(&priv->lock, flags); | ||
856 | uart_state |= (priv->line_status & UART_STATE_TRANSIENT_MASK); | ||
857 | priv->line_status = uart_state; | ||
858 | spin_unlock_irqrestore(&priv->lock, flags); | ||
859 | |||
860 | exit: | 875 | exit: |
861 | status = usb_submit_urb (urb, GFP_ATOMIC); | 876 | status = usb_submit_urb (urb, GFP_ATOMIC); |
862 | if (status) | 877 | if (status) |