Commit aeee7deb authored by Jag Raman's avatar Jag Raman Committed by David S. Miller

sparc64: vcc: Add chars_in_buffer TTY operation

Add handler to support TTY chars_in_buffer operation
Signed-off-by: default avatarJagannathan Raman <jag.raman@oracle.com>
Reviewed-by: default avatarLiam Merwick <liam.merwick@oracle.com>
Reviewed-by: default avatarShannon Nelson <shannon.nelson@oracle.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cf045260
...@@ -937,12 +937,36 @@ static int vcc_write_room(struct tty_struct *tty) ...@@ -937,12 +937,36 @@ static int vcc_write_room(struct tty_struct *tty)
return num; return num;
} }
static int vcc_chars_in_buffer(struct tty_struct *tty)
{
struct vcc_port *port;
u64 num;
if (unlikely(!tty)) {
pr_err("VCC: chars_in_buffer: Invalid TTY handle\n");
return -ENXIO;
}
port = vcc_get_ne(tty->index);
if (unlikely(!port)) {
pr_err("VCC: chars_in_buffer: Failed to find VCC port\n");
return -ENODEV;
}
num = port->chars_in_buffer;
vcc_put(port, false);
return num;
}
static const struct tty_operations vcc_ops = { static const struct tty_operations vcc_ops = {
.open = vcc_open, .open = vcc_open,
.close = vcc_close, .close = vcc_close,
.hangup = vcc_hangup, .hangup = vcc_hangup,
.write = vcc_write, .write = vcc_write,
.write_room = vcc_write_room, .write_room = vcc_write_room,
.chars_in_buffer = vcc_chars_in_buffer,
}; };
#define VCC_TTY_FLAGS (TTY_DRIVER_DYNAMIC_DEV | TTY_DRIVER_REAL_RAW) #define VCC_TTY_FLAGS (TTY_DRIVER_DYNAMIC_DEV | TTY_DRIVER_REAL_RAW)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment