mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-06 14:48:06 +00:00
USB: serial: add wait_until_sent operation
Add wait_until_sent operation which can be used to wait for hardware buffers to drain. Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
3b9561e9d9
commit
0693196fe7
2 changed files with 18 additions and 0 deletions
|
@ -375,6 +375,22 @@ static int serial_chars_in_buffer(struct tty_struct *tty)
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void serial_wait_until_sent(struct tty_struct *tty, int timeout)
|
||||||
|
{
|
||||||
|
struct usb_serial_port *port = tty->driver_data;
|
||||||
|
struct usb_serial *serial = port->serial;
|
||||||
|
|
||||||
|
dev_dbg(tty->dev, "%s\n", __func__);
|
||||||
|
|
||||||
|
if (!port->serial->type->wait_until_sent)
|
||||||
|
return;
|
||||||
|
|
||||||
|
mutex_lock(&serial->disc_mutex);
|
||||||
|
if (!serial->disconnected)
|
||||||
|
port->serial->type->wait_until_sent(tty, timeout);
|
||||||
|
mutex_unlock(&serial->disc_mutex);
|
||||||
|
}
|
||||||
|
|
||||||
static void serial_throttle(struct tty_struct *tty)
|
static void serial_throttle(struct tty_struct *tty)
|
||||||
{
|
{
|
||||||
struct usb_serial_port *port = tty->driver_data;
|
struct usb_serial_port *port = tty->driver_data;
|
||||||
|
@ -1191,6 +1207,7 @@ static const struct tty_operations serial_ops = {
|
||||||
.unthrottle = serial_unthrottle,
|
.unthrottle = serial_unthrottle,
|
||||||
.break_ctl = serial_break,
|
.break_ctl = serial_break,
|
||||||
.chars_in_buffer = serial_chars_in_buffer,
|
.chars_in_buffer = serial_chars_in_buffer,
|
||||||
|
.wait_until_sent = serial_wait_until_sent,
|
||||||
.tiocmget = serial_tiocmget,
|
.tiocmget = serial_tiocmget,
|
||||||
.tiocmset = serial_tiocmset,
|
.tiocmset = serial_tiocmset,
|
||||||
.get_icount = serial_get_icount,
|
.get_icount = serial_get_icount,
|
||||||
|
|
|
@ -268,6 +268,7 @@ struct usb_serial_driver {
|
||||||
struct usb_serial_port *port, struct ktermios *old);
|
struct usb_serial_port *port, struct ktermios *old);
|
||||||
void (*break_ctl)(struct tty_struct *tty, int break_state);
|
void (*break_ctl)(struct tty_struct *tty, int break_state);
|
||||||
int (*chars_in_buffer)(struct tty_struct *tty);
|
int (*chars_in_buffer)(struct tty_struct *tty);
|
||||||
|
void (*wait_until_sent)(struct tty_struct *tty, long timeout);
|
||||||
void (*throttle)(struct tty_struct *tty);
|
void (*throttle)(struct tty_struct *tty);
|
||||||
void (*unthrottle)(struct tty_struct *tty);
|
void (*unthrottle)(struct tty_struct *tty);
|
||||||
int (*tiocmget)(struct tty_struct *tty);
|
int (*tiocmget)(struct tty_struct *tty);
|
||||||
|
|
Loading…
Add table
Reference in a new issue