diff options
author | Jiri Slaby <jslaby@suse.cz> | 2013-01-03 09:53:06 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-16 01:30:15 -0500 |
commit | 2e124b4a390ca85325fae75764bef92f0547fa25 (patch) | |
tree | 5519fbcdbe954e79b271ea6d31ac5a4dc754c4f5 /drivers/net/usb | |
parent | d6c53c0e9bd0a83f9f9ddbc9fd80141a54d83896 (diff) |
TTY: switch tty_flip_buffer_push
Now, we start converting tty buffer functions to actually use
tty_port. This will allow us to get rid of the need of tty in many
call sites. Only tty_port will needed and hence no more
tty_port_tty_get in those paths.
Now, the one where most of tty_port_tty_get gets removed:
tty_flip_buffer_push.
IOW we also closed all the races in drivers not using tty_port_tty_get
at all yet.
Also we move tty_flip_buffer_push declaration from include/linux/tty.h
to include/linux/tty_flip.h to all others while we are changing it
anyway.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/net/usb')
-rw-r--r-- | drivers/net/usb/hso.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index d235ca07548f..f902a14da88c 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c | |||
@@ -2035,24 +2035,23 @@ static int put_rxbuf_data(struct urb *urb, struct hso_serial *serial) | |||
2035 | tty = tty_port_tty_get(&serial->port); | 2035 | tty = tty_port_tty_get(&serial->port); |
2036 | 2036 | ||
2037 | /* Push data to tty */ | 2037 | /* Push data to tty */ |
2038 | if (tty) { | 2038 | write_length_remaining = urb->actual_length - |
2039 | write_length_remaining = urb->actual_length - | 2039 | serial->curr_rx_urb_offset; |
2040 | serial->curr_rx_urb_offset; | 2040 | D1("data to push to tty"); |
2041 | D1("data to push to tty"); | 2041 | while (write_length_remaining) { |
2042 | while (write_length_remaining) { | 2042 | if (tty && test_bit(TTY_THROTTLED, &tty->flags)) { |
2043 | if (test_bit(TTY_THROTTLED, &tty->flags)) { | 2043 | tty_kref_put(tty); |
2044 | tty_kref_put(tty); | 2044 | return -1; |
2045 | return -1; | ||
2046 | } | ||
2047 | curr_write_len = tty_insert_flip_string(&serial->port, | ||
2048 | urb->transfer_buffer + serial->curr_rx_urb_offset, | ||
2049 | write_length_remaining); | ||
2050 | serial->curr_rx_urb_offset += curr_write_len; | ||
2051 | write_length_remaining -= curr_write_len; | ||
2052 | tty_flip_buffer_push(tty); | ||
2053 | } | 2045 | } |
2054 | tty_kref_put(tty); | 2046 | curr_write_len = tty_insert_flip_string(&serial->port, |
2047 | urb->transfer_buffer + serial->curr_rx_urb_offset, | ||
2048 | write_length_remaining); | ||
2049 | serial->curr_rx_urb_offset += curr_write_len; | ||
2050 | write_length_remaining -= curr_write_len; | ||
2051 | tty_flip_buffer_push(&serial->port); | ||
2055 | } | 2052 | } |
2053 | tty_kref_put(tty); | ||
2054 | |||
2056 | if (write_length_remaining == 0) { | 2055 | if (write_length_remaining == 0) { |
2057 | serial->curr_rx_urb_offset = 0; | 2056 | serial->curr_rx_urb_offset = 0; |
2058 | serial->rx_urb_filled[hso_urb_to_index(serial, urb)] = 0; | 2057 | serial->rx_urb_filled[hso_urb_to_index(serial, urb)] = 0; |