diff options
author | Oliver Neukum <oneukum@suse.de> | 2007-05-07 07:16:58 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-07-12 19:29:51 -0400 |
commit | 39892da44b21b5362eb848ca424d73a25ccc488f (patch) | |
tree | 856b5d2309633a29784b345cbd1dc7a1cd3d9afb /drivers/usb/serial/digi_acceleport.c | |
parent | b308e74d9c708ee2a9af14fbe235e0a41216f4ed (diff) |
USB: Digi AccelePort adapted to new tty buffering
this fixes the flushing trouble due to its own buffering for this driver.
Signed-off-by: Oliver Neukum <oneukum@suse.de>
Cc: Al Borchers <alborchers@steinerpoint.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial/digi_acceleport.c')
-rw-r--r-- | drivers/usb/serial/digi_acceleport.c | 52 |
1 files changed, 13 insertions, 39 deletions
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index d78692c01cfa..9ffd99aded53 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c | |||
@@ -930,23 +930,17 @@ static void digi_rx_unthrottle( struct usb_serial_port *port ) | |||
930 | { | 930 | { |
931 | 931 | ||
932 | int ret = 0; | 932 | int ret = 0; |
933 | int len; | ||
934 | unsigned long flags; | 933 | unsigned long flags; |
935 | struct digi_port *priv = usb_get_serial_port_data(port); | 934 | struct digi_port *priv = usb_get_serial_port_data(port); |
936 | struct tty_struct *tty = port->tty; | ||
937 | |||
938 | 935 | ||
939 | dbg( "digi_rx_unthrottle: TOP: port=%d", priv->dp_port_num ); | 936 | dbg( "digi_rx_unthrottle: TOP: port=%d", priv->dp_port_num ); |
940 | 937 | ||
941 | spin_lock_irqsave( &priv->dp_port_lock, flags ); | 938 | spin_lock_irqsave( &priv->dp_port_lock, flags ); |
942 | 939 | ||
943 | /* send any buffered chars from throttle time on to tty subsystem */ | 940 | /* turn throttle off */ |
944 | 941 | priv->dp_throttled = 0; | |
945 | len = tty_buffer_request_room(tty, priv->dp_in_buf_len); | 942 | priv->dp_in_buf_len = 0; |
946 | if( len > 0 ) { | 943 | priv->dp_throttle_restart = 0; |
947 | tty_insert_flip_string_flags(tty, priv->dp_in_buf, priv->dp_in_flag_buf, len); | ||
948 | tty_flip_buffer_push( tty ); | ||
949 | } | ||
950 | 944 | ||
951 | /* restart read chain */ | 945 | /* restart read chain */ |
952 | if( priv->dp_throttle_restart ) { | 946 | if( priv->dp_throttle_restart ) { |
@@ -954,11 +948,6 @@ dbg( "digi_rx_unthrottle: TOP: port=%d", priv->dp_port_num ); | |||
954 | ret = usb_submit_urb( port->read_urb, GFP_ATOMIC ); | 948 | ret = usb_submit_urb( port->read_urb, GFP_ATOMIC ); |
955 | } | 949 | } |
956 | 950 | ||
957 | /* turn throttle off */ | ||
958 | priv->dp_throttled = 0; | ||
959 | priv->dp_in_buf_len = 0; | ||
960 | priv->dp_throttle_restart = 0; | ||
961 | |||
962 | spin_unlock_irqrestore( &priv->dp_port_lock, flags ); | 951 | spin_unlock_irqrestore( &priv->dp_port_lock, flags ); |
963 | 952 | ||
964 | if( ret ) { | 953 | if( ret ) { |
@@ -1864,31 +1853,16 @@ static int digi_read_inb_callback( struct urb *urb ) | |||
1864 | /* data length is len-1 (one byte of len is status) */ | 1853 | /* data length is len-1 (one byte of len is status) */ |
1865 | --len; | 1854 | --len; |
1866 | 1855 | ||
1867 | if( throttled ) { | 1856 | len = tty_buffer_request_room(tty, len); |
1868 | 1857 | if( len > 0 ) { | |
1869 | len = min( len, | 1858 | /* Hot path */ |
1870 | DIGI_IN_BUF_SIZE - priv->dp_in_buf_len ); | 1859 | if(flag == TTY_NORMAL) |
1871 | 1860 | tty_insert_flip_string(tty, data, len); | |
1872 | if( len > 0 ) { | 1861 | else { |
1873 | memcpy( priv->dp_in_buf + priv->dp_in_buf_len, | 1862 | for(i = 0; i < len; i++) |
1874 | data, len ); | 1863 | tty_insert_flip_char(tty, data[i], flag); |
1875 | memset( priv->dp_in_flag_buf | ||
1876 | + priv->dp_in_buf_len, flag, len ); | ||
1877 | priv->dp_in_buf_len += len; | ||
1878 | } | ||
1879 | |||
1880 | } else { | ||
1881 | len = tty_buffer_request_room(tty, len); | ||
1882 | if( len > 0 ) { | ||
1883 | /* Hot path */ | ||
1884 | if(flag == TTY_NORMAL) | ||
1885 | tty_insert_flip_string(tty, data, len); | ||
1886 | else { | ||
1887 | for(i = 0; i < len; i++) | ||
1888 | tty_insert_flip_char(tty, data[i], flag); | ||
1889 | } | ||
1890 | tty_flip_buffer_push( tty ); | ||
1891 | } | 1864 | } |
1865 | tty_flip_buffer_push( tty ); | ||
1892 | } | 1866 | } |
1893 | } | 1867 | } |
1894 | 1868 | ||