diff options
author | Joris van Rantwijk <jorispubl@xs4all.nl> | 2007-02-01 14:08:18 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-02-16 18:32:18 -0500 |
commit | 253ca923281aec6975ec4028ddbc58e865d8d13d (patch) | |
tree | 837b437f40ecb75174917e0623b6f4e2cdcc6f46 /include/linux/usb | |
parent | b544d7499cc47fc26e9dbacd7b9cabc67d2bdf2e (diff) |
USB: add flow control to usb-serial generic driver.
I added two fields to struct usb_serial_port to keep track of the
throttle state. Other usb-serial drivers typically use private data for
such things, but the generic driver can not really do that because some
of its code is also used by other drivers (which may have their own
private data needs).
As it is, I am not sure that this patch is useful in all scenarios.
It is certainly helpful for low-bandwidth devices that can hold their
data in response to throttling. But for devices that pump data in
real-time as fast as possible (webcam, A/D converter, etc), throttling
may actually cause more data loss.
From: Joris van Rantwijk <jorispubl@xs4all.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux/usb')
-rw-r--r-- | include/linux/usb/serial.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index 33dcd8576696..32acbae28d24 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h | |||
@@ -54,6 +54,8 @@ | |||
54 | * @write_wait: a wait_queue_head_t used by the port. | 54 | * @write_wait: a wait_queue_head_t used by the port. |
55 | * @work: work queue entry for the line discipline waking up. | 55 | * @work: work queue entry for the line discipline waking up. |
56 | * @open_count: number of times this port has been opened. | 56 | * @open_count: number of times this port has been opened. |
57 | * @throttled: nonzero if the read urb is inactive to throttle the device | ||
58 | * @throttle_req: nonzero if the tty wants to throttle us | ||
57 | * | 59 | * |
58 | * This structure is used by the usb-serial core and drivers for the specific | 60 | * This structure is used by the usb-serial core and drivers for the specific |
59 | * ports of a device. | 61 | * ports of a device. |
@@ -88,6 +90,8 @@ struct usb_serial_port { | |||
88 | wait_queue_head_t write_wait; | 90 | wait_queue_head_t write_wait; |
89 | struct work_struct work; | 91 | struct work_struct work; |
90 | int open_count; | 92 | int open_count; |
93 | char throttled; | ||
94 | char throttle_req; | ||
91 | struct device dev; | 95 | struct device dev; |
92 | }; | 96 | }; |
93 | #define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev) | 97 | #define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev) |
@@ -269,6 +273,8 @@ extern int usb_serial_generic_write_room (struct usb_serial_port *port); | |||
269 | extern int usb_serial_generic_chars_in_buffer (struct usb_serial_port *port); | 273 | extern int usb_serial_generic_chars_in_buffer (struct usb_serial_port *port); |
270 | extern void usb_serial_generic_read_bulk_callback (struct urb *urb); | 274 | extern void usb_serial_generic_read_bulk_callback (struct urb *urb); |
271 | extern void usb_serial_generic_write_bulk_callback (struct urb *urb); | 275 | extern void usb_serial_generic_write_bulk_callback (struct urb *urb); |
276 | extern void usb_serial_generic_throttle (struct usb_serial_port *port); | ||
277 | extern void usb_serial_generic_unthrottle (struct usb_serial_port *port); | ||
272 | extern void usb_serial_generic_shutdown (struct usb_serial *serial); | 278 | extern void usb_serial_generic_shutdown (struct usb_serial *serial); |
273 | extern int usb_serial_generic_register (int debug); | 279 | extern int usb_serial_generic_register (int debug); |
274 | extern void usb_serial_generic_deregister (void); | 280 | extern void usb_serial_generic_deregister (void); |