diff options
author | Johan Hovold <jhovold@gmail.com> | 2010-03-17 18:05:57 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-20 16:21:34 -0400 |
commit | 231543206452f5c42bace54b5c13dfe5a0313812 (patch) | |
tree | cbefc56d6c37f50c895a37c47161ac5733cda24c /drivers/usb | |
parent | 0f3d5bae2bdacce6c6c1d116809d6b3d50338df7 (diff) |
USB: serial: generalise generic read implementation
Add process_read_urb to usb_serial_driver so that a driver can rely on
the generic read (and throttle) mechanism but still do device specific
processing of incoming data (such as adding tty_flags before pushing to
line discipline).
The default generic implementation handles sysrq for consoles but
otherwise simply pushes to tty.
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/serial/generic.c | 5 | ||||
-rw-r--r-- | drivers/usb/serial/usb-serial.c | 1 |
2 files changed, 4 insertions, 2 deletions
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index e16c0b234cc9..176f1257b664 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
@@ -408,7 +408,7 @@ int usb_serial_generic_submit_read_urb(struct usb_serial_port *port, | |||
408 | } | 408 | } |
409 | EXPORT_SYMBOL_GPL(usb_serial_generic_submit_read_urb); | 409 | EXPORT_SYMBOL_GPL(usb_serial_generic_submit_read_urb); |
410 | 410 | ||
411 | static void usb_serial_generic_process_read_urb(struct urb *urb) | 411 | void usb_serial_generic_process_read_urb(struct urb *urb) |
412 | { | 412 | { |
413 | struct usb_serial_port *port = urb->context; | 413 | struct usb_serial_port *port = urb->context; |
414 | struct tty_struct *tty; | 414 | struct tty_struct *tty; |
@@ -433,6 +433,7 @@ static void usb_serial_generic_process_read_urb(struct urb *urb) | |||
433 | tty_flip_buffer_push(tty); | 433 | tty_flip_buffer_push(tty); |
434 | tty_kref_put(tty); | 434 | tty_kref_put(tty); |
435 | } | 435 | } |
436 | EXPORT_SYMBOL_GPL(usb_serial_generic_process_read_urb); | ||
436 | 437 | ||
437 | void usb_serial_generic_read_bulk_callback(struct urb *urb) | 438 | void usb_serial_generic_read_bulk_callback(struct urb *urb) |
438 | { | 439 | { |
@@ -451,7 +452,7 @@ void usb_serial_generic_read_bulk_callback(struct urb *urb) | |||
451 | 452 | ||
452 | usb_serial_debug_data(debug, &port->dev, __func__, | 453 | usb_serial_debug_data(debug, &port->dev, __func__, |
453 | urb->actual_length, data); | 454 | urb->actual_length, data); |
454 | usb_serial_generic_process_read_urb(urb); | 455 | port->serial->type->process_read_urb(urb); |
455 | 456 | ||
456 | /* Throttle the device if requested by tty */ | 457 | /* Throttle the device if requested by tty */ |
457 | spin_lock_irqsave(&port->lock, flags); | 458 | spin_lock_irqsave(&port->lock, flags); |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 538924627eba..1b924425089f 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -1298,6 +1298,7 @@ static void fixup_generic(struct usb_serial_driver *device) | |||
1298 | set_to_generic_if_null(device, write_bulk_callback); | 1298 | set_to_generic_if_null(device, write_bulk_callback); |
1299 | set_to_generic_if_null(device, disconnect); | 1299 | set_to_generic_if_null(device, disconnect); |
1300 | set_to_generic_if_null(device, release); | 1300 | set_to_generic_if_null(device, release); |
1301 | set_to_generic_if_null(device, process_read_urb); | ||
1301 | } | 1302 | } |
1302 | 1303 | ||
1303 | int usb_serial_register(struct usb_serial_driver *driver) | 1304 | int usb_serial_register(struct usb_serial_driver *driver) |