tty: remove tty_operations::chars_in_buffer for non-buffering
authorJiri Slaby <jslaby@suse.cz>
Wed, 5 May 2021 09:19:18 +0000 (11:19 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 May 2021 16:29:11 +0000 (18:29 +0200)
The only user of tty_ops::chars_in_buffer is tty_chars_in_buffer. And it
considers tty_ops::chars_in_buffer optional. In case it's NULL, zero is
returned. So remove all those chars_in_buffer from tty_ops which return
zero. (Zero means such driver doesn't buffer.)

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Richard Henderson <rth@twiddle.net>
Acked-by: Max Filippov <jcmvbkbc@gmail.com> # xtensa
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Matt Turner <mattst88@gmail.com>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: Helge Deller <deller@gmx.de>
Cc: Chris Zankel <chris@zankel.net>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Link: https://lore.kernel.org/r/20210505091928.22010-26-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/alpha/kernel/srmcons.c
arch/parisc/kernel/pdc_cons.c
arch/xtensa/platforms/iss/console.c
drivers/s390/char/tty3270.c
drivers/tty/pty.c
drivers/tty/vt/vt.c

index 2110b7e7f9887fee296b3a630f1fa9cff1db3439..fc03471a0b0f1d3f7184da43eea71962305ed985 100644 (file)
@@ -148,12 +148,6 @@ srmcons_write_room(struct tty_struct *tty)
        return 512;
 }
 
-static int
-srmcons_chars_in_buffer(struct tty_struct *tty)
-{
-       return 0;
-}
-
 static int
 srmcons_open(struct tty_struct *tty, struct file *filp)
 {
@@ -200,7 +194,6 @@ static const struct tty_operations srmcons_ops = {
        .close          = srmcons_close,
        .write          = srmcons_write,
        .write_room     = srmcons_write_room,
-       .chars_in_buffer= srmcons_chars_in_buffer,
 };
 
 static int __init
index fe2ed0bbd07e941aff9e31ee3e30f93c88156c40..39ccad06353313530d23cd6ef9dea605db699df4 100644 (file)
@@ -108,17 +108,11 @@ static unsigned int pdc_console_tty_write_room(struct tty_struct *tty)
        return 32768; /* no limit, no buffer used */
 }
 
-static int pdc_console_tty_chars_in_buffer(struct tty_struct *tty)
-{
-       return 0; /* no buffer */
-}
-
 static const struct tty_operations pdc_console_tty_ops = {
        .open = pdc_console_tty_open,
        .close = pdc_console_tty_close,
        .write = pdc_console_tty_write,
        .write_room = pdc_console_tty_write_room,
-       .chars_in_buffer = pdc_console_tty_chars_in_buffer,
 };
 
 static void pdc_console_poll(struct timer_list *unused)
index 98ac3a7fdb0a8231444636bbf8ad627fdfa4cb64..21184488c277f1bb695e95c284a0c9a04eac4a77 100644 (file)
@@ -106,12 +106,6 @@ static unsigned int rs_write_room(struct tty_struct *tty)
        return 2 * 1024;
 }
 
-static int rs_chars_in_buffer(struct tty_struct *tty)
-{
-       /* the iss doesn't buffer characters */
-       return 0;
-}
-
 static void rs_hangup(struct tty_struct *tty)
 {
        /* Stub, once again.. */
@@ -135,7 +129,6 @@ static const struct tty_operations serial_ops = {
        .put_char = rs_put_char,
        .flush_chars = rs_flush_chars,
        .write_room = rs_write_room,
-       .chars_in_buffer = rs_chars_in_buffer,
        .hangup = rs_hangup,
        .wait_until_sent = rs_wait_until_sent,
        .proc_show = rs_proc_show,
index 82d4c961ed061f15415ea7522cd36bd8c9043027..ba1fbce63fee8a61683121db455df2aacf578cb3 100644 (file)
@@ -1756,17 +1756,6 @@ tty3270_flush_chars(struct tty_struct *tty)
        }
 }
 
-/*
- * Returns the number of characters in the output buffer. This is
- * used in tty_wait_until_sent to wait until all characters have
- * appeared on the screen.
- */
-static int
-tty3270_chars_in_buffer(struct tty_struct *tty)
-{
-       return 0;
-}
-
 static void
 tty3270_flush_buffer(struct tty_struct *tty)
 {
@@ -1892,7 +1881,6 @@ static const struct tty_operations tty3270_ops = {
        .put_char = tty3270_put_char,
        .flush_chars = tty3270_flush_chars,
        .write_room = tty3270_write_room,
-       .chars_in_buffer = tty3270_chars_in_buffer,
        .flush_buffer = tty3270_flush_buffer,
        .throttle = tty3270_throttle,
        .unthrottle = tty3270_unthrottle,
index eb8556b19592c12492a6210b83821191f0ff9278..5ada7e9381eb80726523c96223db7077fbf112f8 100644 (file)
@@ -143,19 +143,6 @@ static unsigned int pty_write_room(struct tty_struct *tty)
        return tty_buffer_space_avail(tty->link->port);
 }
 
-/**
- *     pty_chars_in_buffer     -       characters currently in our tx queue
- *     @tty: our tty
- *
- *     Report how much we have in the transmit queue. As everything is
- *     instantly at the other end this is easy to implement.
- */
-
-static int pty_chars_in_buffer(struct tty_struct *tty)
-{
-       return 0;
-}
-
 /* Set the lock flag on a pty */
 static int pty_set_lock(struct tty_struct *tty, int __user *arg)
 {
@@ -525,7 +512,6 @@ static const struct tty_operations master_pty_ops_bsd = {
        .write = pty_write,
        .write_room = pty_write_room,
        .flush_buffer = pty_flush_buffer,
-       .chars_in_buffer = pty_chars_in_buffer,
        .unthrottle = pty_unthrottle,
        .ioctl = pty_bsd_ioctl,
        .compat_ioctl = pty_bsd_compat_ioctl,
@@ -541,7 +527,6 @@ static const struct tty_operations slave_pty_ops_bsd = {
        .write = pty_write,
        .write_room = pty_write_room,
        .flush_buffer = pty_flush_buffer,
-       .chars_in_buffer = pty_chars_in_buffer,
        .unthrottle = pty_unthrottle,
        .set_termios = pty_set_termios,
        .cleanup = pty_cleanup,
@@ -776,7 +761,6 @@ static const struct tty_operations ptm_unix98_ops = {
        .write = pty_write,
        .write_room = pty_write_room,
        .flush_buffer = pty_flush_buffer,
-       .chars_in_buffer = pty_chars_in_buffer,
        .unthrottle = pty_unthrottle,
        .ioctl = pty_unix98_ioctl,
        .compat_ioctl = pty_unix98_compat_ioctl,
@@ -794,7 +778,6 @@ static const struct tty_operations pty_unix98_ops = {
        .write = pty_write,
        .write_room = pty_write_room,
        .flush_buffer = pty_flush_buffer,
-       .chars_in_buffer = pty_chars_in_buffer,
        .unthrottle = pty_unthrottle,
        .set_termios = pty_set_termios,
        .start = pty_start,
index 96c13071493083cd2ca6b46d28e875b5302955d9..b838f656f4cd04a8f894213cda9bff9af6ae4e2c 100644 (file)
@@ -3270,11 +3270,6 @@ static unsigned int con_write_room(struct tty_struct *tty)
        return 32768;           /* No limit, really; we're not buffering */
 }
 
-static int con_chars_in_buffer(struct tty_struct *tty)
-{
-       return 0;               /* we're not buffering */
-}
-
 /*
  * con_throttle and con_unthrottle are only used for
  * paste_selection(), which has to stuff in a large number of
@@ -3521,7 +3516,6 @@ static const struct tty_operations con_ops = {
        .write_room = con_write_room,
        .put_char = con_put_char,
        .flush_chars = con_flush_chars,
-       .chars_in_buffer = con_chars_in_buffer,
        .ioctl = vt_ioctl,
 #ifdef CONFIG_COMPAT
        .compat_ioctl = vt_compat_ioctl,