]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
tty: Remove chars_in_buffer() line discipline method
authorPeter Hurley <peter@hurleysoftware.com>
Mon, 11 Jan 2016 06:40:54 +0000 (22:40 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Jan 2016 23:01:44 +0000 (15:01 -0800)
The chars_in_buffer() line discipline method serves no functional
purpose, other than as a (dubious) debugging aid for mostly bit-rotting
drivers. Despite being documented as an optional method, every caller
is unconditionally executed (although conditionally compiled).
Furthermore, direct tty->ldisc access without an ldisc ref is unsafe.
Lastly, N_TTY's chars_in_buffer() has warned of removal since 3.12.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Documentation/serial/tty.txt
drivers/tty/amiserial.c
drivers/tty/cyclades.c
drivers/tty/n_gsm.c
drivers/tty/n_tty.c
drivers/tty/rocket.c
drivers/tty/serial/crisv10.c
include/linux/tty_ldisc.h

index bc3842dc323a629fae6ec4cf5de0f6d1d6d6f37d..798cba82c762ef85e9aa8c617a8c458f9d5b2e0a 100644 (file)
@@ -72,9 +72,6 @@ flush_buffer()        -       (optional) May be called at any point between
                        open and close, and instructs the line discipline
                        to empty its input buffer.
 
-chars_in_buffer() -    (optional) Report the number of bytes in the input
-                       buffer.
-
 set_termios()  -       (optional) Called on termios structure changes.
                        The caller passes the old termios data and the
                        current data is in the tty. Called under the
index 2caaf5a2516d3c142a1da70f5276c258676a7b59..6ba5681b6385c3f2a87fac2ef8a0c7683ab69038 100644 (file)
@@ -965,8 +965,7 @@ static void rs_throttle(struct tty_struct * tty)
        struct serial_state *info = tty->driver_data;
        unsigned long flags;
 #ifdef SERIAL_DEBUG_THROTTLE
-       printk("throttle %s: %d....\n", tty_name(tty),
-              tty->ldisc.chars_in_buffer(tty));
+       printk("throttle %s ....\n", tty_name(tty));
 #endif
 
        if (serial_paranoia_check(info, tty->name, "rs_throttle"))
@@ -988,8 +987,7 @@ static void rs_unthrottle(struct tty_struct * tty)
        struct serial_state *info = tty->driver_data;
        unsigned long flags;
 #ifdef SERIAL_DEBUG_THROTTLE
-       printk("unthrottle %s: %d....\n", tty_name(tty),
-              tty->ldisc.chars_in_buffer(tty));
+       printk("unthrottle %s ....\n", tty_name(tty));
 #endif
 
        if (serial_paranoia_check(info, tty->name, "rs_unthrottle"))
index abbed201dc744aac81cfd543eaa485a148802a01..a48e7e66b970378e875b1f73573e24a4b4c22b14 100644 (file)
@@ -2852,8 +2852,8 @@ static void cy_throttle(struct tty_struct *tty)
        unsigned long flags;
 
 #ifdef CY_DEBUG_THROTTLE
-       printk(KERN_DEBUG "cyc:throttle %s: %ld...ttyC%d\n", tty_name(tty),
-                       tty->ldisc.chars_in_buffer(tty), info->line);
+       printk(KERN_DEBUG "cyc:throttle %s ...ttyC%d\n", tty_name(tty),
+                        info->line);
 #endif
 
        if (serial_paranoia_check(info, tty->name, "cy_throttle"))
@@ -2891,8 +2891,8 @@ static void cy_unthrottle(struct tty_struct *tty)
        unsigned long flags;
 
 #ifdef CY_DEBUG_THROTTLE
-       printk(KERN_DEBUG "cyc:unthrottle %s: %ld...ttyC%d\n",
-               tty_name(tty), tty_chars_in_buffer(tty), info->line);
+       printk(KERN_DEBUG "cyc:unthrottle %s ...ttyC%d\n",
+               tty_name(tty), info->line);
 #endif
 
        if (serial_paranoia_check(info, tty->name, "cy_unthrottle"))
index c3fe026d3168dda14e7388472db49abf27544e4f..e3cc277493447e558110235d02a927d6b2eb3844 100644 (file)
@@ -2303,21 +2303,6 @@ static void gsmld_receive_buf(struct tty_struct *tty, const unsigned char *cp,
        /* If clogged call tty_throttle(tty); */
 }
 
-/**
- *     gsmld_chars_in_buffer   -       report available bytes
- *     @tty: tty device
- *
- *     Report the number of characters buffered to be delivered to user
- *     at this instant in time.
- *
- *     Locking: gsm lock
- */
-
-static ssize_t gsmld_chars_in_buffer(struct tty_struct *tty)
-{
-       return 0;
-}
-
 /**
  *     gsmld_flush_buffer      -       clean input queue
  *     @tty:   terminal device
@@ -2830,7 +2815,6 @@ static struct tty_ldisc_ops tty_ldisc_packet = {
        .open            = gsmld_open,
        .close           = gsmld_close,
        .flush_buffer    = gsmld_flush_buffer,
-       .chars_in_buffer = gsmld_chars_in_buffer,
        .read            = gsmld_read,
        .write           = gsmld_write,
        .ioctl           = gsmld_ioctl,
index b280abaad91b717639011f1407157eab5f3aaad1..90eca2605fbf43516f0dfbd37bc3d4b165d1ee89 100644 (file)
@@ -380,28 +380,6 @@ static void n_tty_flush_buffer(struct tty_struct *tty)
        up_write(&tty->termios_rwsem);
 }
 
-/**
- *     n_tty_chars_in_buffer   -       report available bytes
- *     @tty: tty device
- *
- *     Report the number of characters buffered to be delivered to user
- *     at this instant in time.
- *
- *     Locking: exclusive termios_rwsem
- */
-
-static ssize_t n_tty_chars_in_buffer(struct tty_struct *tty)
-{
-       ssize_t n;
-
-       WARN_ONCE(1, "%s is deprecated and scheduled for removal.", __func__);
-
-       down_write(&tty->termios_rwsem);
-       n = chars_in_buffer(tty);
-       up_write(&tty->termios_rwsem);
-       return n;
-}
-
 /**
  *     is_utf8_continuation    -       utf8 multibyte check
  *     @c: byte to check
@@ -2525,7 +2503,6 @@ struct tty_ldisc_ops tty_ldisc_N_TTY = {
        .open            = n_tty_open,
        .close           = n_tty_close,
        .flush_buffer    = n_tty_flush_buffer,
-       .chars_in_buffer = n_tty_chars_in_buffer,
        .read            = n_tty_read,
        .write           = n_tty_write,
        .ioctl           = n_tty_ioctl,
index 802eac7e561b85f1aa43601a7a9eb94b05d3cb62..f624b93a237fd29658aaefda3a03baab5e79c152 100644 (file)
@@ -1360,8 +1360,7 @@ static void rp_throttle(struct tty_struct *tty)
        struct r_port *info = tty->driver_data;
 
 #ifdef ROCKET_DEBUG_THROTTLE
-       printk(KERN_INFO "throttle %s: %d....\n", tty->name,
-              tty->ldisc.chars_in_buffer(tty));
+       printk(KERN_INFO "throttle %s ....\n", tty->name);
 #endif
 
        if (rocket_paranoia_check(info, "rp_throttle"))
@@ -1377,8 +1376,7 @@ static void rp_unthrottle(struct tty_struct *tty)
 {
        struct r_port *info = tty->driver_data;
 #ifdef ROCKET_DEBUG_THROTTLE
-       printk(KERN_INFO "unthrottle %s: %d....\n", tty->name,
-              tty->ldisc.chars_in_buffer(tty));
+       printk(KERN_INFO "unthrottle %s ....\n", tty->name);
 #endif
 
        if (rocket_paranoia_check(info, "rp_unthrottle"))
index f13f2ebd215bc9afe2ad64ae9070b8c069967d18..e98aef7970657c9060c3f57f0e02f1035666d2ea 100644 (file)
@@ -2968,7 +2968,7 @@ static int rs_raw_write(struct tty_struct *tty,
 
        local_save_flags(flags);
        DFLOW(DEBUG_LOG(info->line, "write count %i ", count));
-       DFLOW(DEBUG_LOG(info->line, "ldisc %i\n", tty->ldisc.chars_in_buffer(tty)));
+       DFLOW(DEBUG_LOG(info->line, "ldisc\n"));
 
 
        /* The local_irq_disable/restore_flags pairs below are needed
@@ -3161,10 +3161,9 @@ rs_throttle(struct tty_struct * tty)
 {
        struct e100_serial *info = (struct e100_serial *)tty->driver_data;
 #ifdef SERIAL_DEBUG_THROTTLE
-       printk("throttle %s: %lu....\n", tty_name(tty),
-              (unsigned long)tty->ldisc.chars_in_buffer(tty));
+       printk("throttle %s ....\n", tty_name(tty));
 #endif
-       DFLOW(DEBUG_LOG(info->line,"rs_throttle %lu\n", tty->ldisc.chars_in_buffer(tty)));
+       DFLOW(DEBUG_LOG(info->line,"rs_throttle\n"));
 
        /* Do RTS before XOFF since XOFF might take some time */
        if (tty->termios.c_cflag & CRTSCTS) {
@@ -3181,10 +3180,9 @@ rs_unthrottle(struct tty_struct * tty)
 {
        struct e100_serial *info = (struct e100_serial *)tty->driver_data;
 #ifdef SERIAL_DEBUG_THROTTLE
-       printk("unthrottle %s: %lu....\n", tty_name(tty),
-              (unsigned long)tty->ldisc.chars_in_buffer(tty));
+       printk("unthrottle %s ....\n", tty_name(tty));
 #endif
-       DFLOW(DEBUG_LOG(info->line,"rs_unthrottle ldisc %d\n", tty->ldisc.chars_in_buffer(tty)));
+       DFLOW(DEBUG_LOG(info->line,"rs_unthrottle ldisc\n"));
        DFLOW(DEBUG_LOG(info->line,"rs_unthrottle flip.count: %i\n", tty->flip.count));
        /* Do RTS before XOFF since XOFF might take some time */
        if (tty->termios.c_cflag & CRTSCTS) {
index 00c9d688d7b7189cc4e15c266f29296cb3204145..6101ab8dc148856da76e3a61f9155aa74f9f40ab 100644 (file)
  *     buffers of any input characters it may have queued to be
  *     delivered to the user mode process.
  *
- * ssize_t (*chars_in_buffer)(struct tty_struct *tty);
- *
- *     This function returns the number of input characters the line
- *     discipline may have queued up to be delivered to the user mode
- *     process.
- *
  * ssize_t (*read)(struct tty_struct * tty, struct file * file,
  *                unsigned char * buf, size_t nr);
  *
@@ -188,7 +182,6 @@ struct tty_ldisc_ops {
        int     (*open)(struct tty_struct *);
        void    (*close)(struct tty_struct *);
        void    (*flush_buffer)(struct tty_struct *tty);
-       ssize_t (*chars_in_buffer)(struct tty_struct *tty);
        ssize_t (*read)(struct tty_struct *tty, struct file *file,
                        unsigned char __user *buf, size_t nr);
        ssize_t (*write)(struct tty_struct *tty, struct file *file,