diff options
author | David VomLehn <dvomlehn@cisco.com> | 2009-08-28 15:54:27 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-09-23 09:46:34 -0400 |
commit | 8e8dce065088833fc418bfa5fbf035cb0726c04c (patch) | |
tree | 146ad73ff1ee9439263678c5493a5c2d180ad794 /include/linux/usb | |
parent | 74aee796c613f54e9f089170df548c0b3f15af69 (diff) |
USB: use kfifo to buffer usb-generic serial writes
When do_output_char() attempts to write a carriage return/line feed sequence,
it first checks to see how much buffer room is available. If there are at least
two characters free, it will write the carriage return/line feed with two calls
to tty_put_char(). It calls the tty_operation functions write() for devices that
don't support the tty_operations function put_char(). If the USB generic serial
device's write URB is not in use, it will return the buffer size when asked how
much room is available. The write() of the carriage return will cause it to mark
the write URB busy, so the subsequent write() of the line feed will be ignored.
This patch uses the kfifo infrastructure to implement a write FIFO that
accurately returns the amount of space available in the buffer.
Signed-off-by: David VomLehn <dvomlehn@cisco.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux/usb')
-rw-r--r-- | include/linux/usb/serial.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index 7b85e327af91..c17eb64d7213 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h | |||
@@ -59,6 +59,7 @@ enum port_dev_state { | |||
59 | * @bulk_out_buffer: pointer to the bulk out buffer for this port. | 59 | * @bulk_out_buffer: pointer to the bulk out buffer for this port. |
60 | * @bulk_out_size: the size of the bulk_out_buffer, in bytes. | 60 | * @bulk_out_size: the size of the bulk_out_buffer, in bytes. |
61 | * @write_urb: pointer to the bulk out struct urb for this port. | 61 | * @write_urb: pointer to the bulk out struct urb for this port. |
62 | * @write_fifo: kfifo used to buffer outgoing data | ||
62 | * @write_urb_busy: port`s writing status | 63 | * @write_urb_busy: port`s writing status |
63 | * @bulk_out_endpointAddress: endpoint address for the bulk out pipe for this | 64 | * @bulk_out_endpointAddress: endpoint address for the bulk out pipe for this |
64 | * port. | 65 | * port. |
@@ -96,6 +97,7 @@ struct usb_serial_port { | |||
96 | unsigned char *bulk_out_buffer; | 97 | unsigned char *bulk_out_buffer; |
97 | int bulk_out_size; | 98 | int bulk_out_size; |
98 | struct urb *write_urb; | 99 | struct urb *write_urb; |
100 | struct kfifo *write_fifo; | ||
99 | int write_urb_busy; | 101 | int write_urb_busy; |
100 | __u8 bulk_out_endpointAddress; | 102 | __u8 bulk_out_endpointAddress; |
101 | 103 | ||