summaryrefslogtreecommitdiff
path: root/drivers/tty/vcc.c
diff options
context:
space:
mode:
authorJag Raman <jag.raman@oracle.com>2017-08-16 00:03:07 +0300
committerDavid S. Miller <davem@davemloft.net>2017-08-16 07:33:54 +0300
commitaeee7debf30b43b276f8aad2e889cd50dd3f0945 (patch)
treeda918344690fd8d2f9425b5c938fdd20dc598b18 /drivers/tty/vcc.c
parentcf0452600b6dbf8bf23b6f7884c7937a0ef60017 (diff)
downloadlinux-aeee7debf30b43b276f8aad2e889cd50dd3f0945.tar.xz
sparc64: vcc: Add chars_in_buffer TTY operation
Add handler to support TTY chars_in_buffer operation Signed-off-by: Jagannathan Raman <jag.raman@oracle.com> Reviewed-by: Liam Merwick <liam.merwick@oracle.com> Reviewed-by: Shannon Nelson <shannon.nelson@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/tty/vcc.c')
-rw-r--r--drivers/tty/vcc.c34
1 files changed, 29 insertions, 5 deletions
diff --git a/drivers/tty/vcc.c b/drivers/tty/vcc.c
index 0c0fe228546b..070c54188971 100644
--- a/drivers/tty/vcc.c
+++ b/drivers/tty/vcc.c
@@ -937,12 +937,36 @@ static int vcc_write_room(struct tty_struct *tty)
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 = {
- .open = vcc_open,
- .close = vcc_close,
- .hangup = vcc_hangup,
- .write = vcc_write,
- .write_room = vcc_write_room,
+ .open = vcc_open,
+ .close = vcc_close,
+ .hangup = vcc_hangup,
+ .write = vcc_write,
+ .write_room = vcc_write_room,
+ .chars_in_buffer = vcc_chars_in_buffer,
};
#define VCC_TTY_FLAGS (TTY_DRIVER_DYNAMIC_DEV | TTY_DRIVER_REAL_RAW)