tty: make tty_operations::chars_in_buffer return uint
authorJiri Slaby <jslaby@suse.cz>
Wed, 5 May 2021 09:19:19 +0000 (11:19 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 May 2021 16:29:11 +0000 (18:29 +0200)
tty_operations::chars_in_buffer is another hook which is expected to
return values >= 0. So make it explicit by the return type too -- use
unsigned int.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Acked-By: Anton Ivanov <anton.ivanov@cambridgegreys.com>
Acked-by: David Sterba <dsterba@suse.com>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Cc: Jens Taprogge <jens.taprogge@taprogge.org>
Cc: Karsten Keil <isdn@linux-pingi.de>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: David Lin <dtwlin@gmail.com>
Cc: Johan Hovold <johan@kernel.org>
Cc: Alex Elder <elder@kernel.org>
Cc: Jiri Kosina <jikos@kernel.org>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Oliver Neukum <oneukum@suse.com>
Cc: Felipe Balbi <balbi@kernel.org>
Cc: Mathias Nyman <mathias.nyman@intel.com>
Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: Johan Hedberg <johan.hedberg@gmail.com>
Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Link: https://lore.kernel.org/r/20210505091928.22010-27-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
36 files changed:
arch/um/drivers/line.c
arch/um/drivers/line.h
drivers/char/pcmcia/synclink_cs.c
drivers/ipack/devices/ipoctal.c
drivers/isdn/capi/capi.c
drivers/mmc/core/sdio_uart.c
drivers/net/usb/hso.c
drivers/s390/char/con3215.c
drivers/s390/char/sclp_rw.c
drivers/s390/char/sclp_rw.h
drivers/s390/char/sclp_tty.c
drivers/s390/char/sclp_vt220.c
drivers/staging/fwserial/fwserial.c
drivers/staging/greybus/uart.c
drivers/tty/amiserial.c
drivers/tty/goldfish.c
drivers/tty/hvc/hvc_console.c
drivers/tty/hvc/hvcs.c
drivers/tty/hvc/hvsi.c
drivers/tty/ipwireless/tty.c
drivers/tty/mips_ejtag_fdc.c
drivers/tty/moxa.c
drivers/tty/mxser.c
drivers/tty/n_gsm.c
drivers/tty/nozomi.c
drivers/tty/serial/serial_core.c
drivers/tty/synclink_gt.c
drivers/tty/tty_ioctl.c
drivers/tty/vcc.c
drivers/usb/class/cdc-acm.c
drivers/usb/gadget/function/u_serial.c
drivers/usb/host/xhci-dbgtty.c
drivers/usb/serial/usb-serial.c
include/linux/tty.h
include/linux/tty_driver.h
net/bluetooth/rfcomm/tty.c

index 2b8810ba5470ebf0cc36efea5c24d10642fd7509..159434851417f8735e9a4559105970ba5177fab7 100644 (file)
@@ -60,11 +60,11 @@ unsigned int line_write_room(struct tty_struct *tty)
        return room;
 }
 
-int line_chars_in_buffer(struct tty_struct *tty)
+unsigned int line_chars_in_buffer(struct tty_struct *tty)
 {
        struct line *line = tty->driver_data;
        unsigned long flags;
-       int ret;
+       unsigned int ret;
 
        spin_lock_irqsave(&line->lock, flags);
        /* write_room subtracts 1 for the needed NULL, so we readd it.*/
index 861edf329569aee76395a0c9b73d1f887348ee45..3325e2bc64e40585577cc361eaaf4a3f3df1c7fc 100644 (file)
@@ -67,7 +67,7 @@ extern int line_setup(char **conf, unsigned nlines, char **def,
 extern int line_write(struct tty_struct *tty, const unsigned char *buf,
                      int len);
 extern void line_set_termios(struct tty_struct *tty, struct ktermios * old);
-extern int line_chars_in_buffer(struct tty_struct *tty);
+extern unsigned int line_chars_in_buffer(struct tty_struct *tty);
 extern void line_flush_buffer(struct tty_struct *tty);
 extern void line_flush_chars(struct tty_struct *tty);
 extern unsigned int line_write_room(struct tty_struct *tty);
index e4b2c68f44f51d240dce054e88fe1280eec0b851..9f7420bc50267cc913880aab66d3416ad3e11f77 100644 (file)
@@ -1637,10 +1637,10 @@ static unsigned int mgslpc_write_room(struct tty_struct *tty)
 
 /* Return the count of bytes in transmit buffer
  */
-static int mgslpc_chars_in_buffer(struct tty_struct *tty)
+static unsigned int mgslpc_chars_in_buffer(struct tty_struct *tty)
 {
        MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data;
-       int rc;
+       unsigned int rc;
 
        if (debug_level >= DEBUG_LEVEL_INFO)
                printk("%s(%d):mgslpc_chars_in_buffer(%s)\n",
@@ -1655,7 +1655,7 @@ static int mgslpc_chars_in_buffer(struct tty_struct *tty)
                rc = info->tx_count;
 
        if (debug_level >= DEBUG_LEVEL_INFO)
-               printk("%s(%d):mgslpc_chars_in_buffer(%s)=%d\n",
+               printk("%s(%d):mgslpc_chars_in_buffer(%s)=%u\n",
                         __FILE__, __LINE__, info->device_name, rc);
 
        return rc;
index ea0f1aeaaa06a4b256ac0860c4d531666a5cf95d..0a3b89c17d08ed298ebac38082d96baffa1acf91 100644 (file)
@@ -467,7 +467,7 @@ static unsigned int ipoctal_write_room(struct tty_struct *tty)
        return PAGE_SIZE - channel->nb_bytes;
 }
 
-static int ipoctal_chars_in_buffer(struct tty_struct *tty)
+static unsigned int ipoctal_chars_in_buffer(struct tty_struct *tty)
 {
        struct ipoctal_channel *channel = tty->driver_data;
 
index c50c454006b340f19d35bc7b11e7a5246fe49638..dae80197ad9c25cd2a2bb5cb4a78b99f3b31ef95 100644 (file)
@@ -1186,7 +1186,7 @@ static unsigned int capinc_tty_write_room(struct tty_struct *tty)
        return room;
 }
 
-static int capinc_tty_chars_in_buffer(struct tty_struct *tty)
+static unsigned int capinc_tty_chars_in_buffer(struct tty_struct *tty)
 {
        struct capiminor *mp = tty->driver_data;
 
index c8f4eca7aad48ad14b1de01ac6a75e0b4f9c1a88..c36242b86b1d6b4165cb556b2ae8fb7fe28f1e31 100644 (file)
@@ -803,7 +803,7 @@ static unsigned int sdio_uart_write_room(struct tty_struct *tty)
        return FIFO_SIZE - kfifo_len(&port->xmit_fifo);
 }
 
-static int sdio_uart_chars_in_buffer(struct tty_struct *tty)
+static unsigned int sdio_uart_chars_in_buffer(struct tty_struct *tty)
 {
        struct sdio_uart_port *port = tty->driver_data;
        return kfifo_len(&port->xmit_fifo);
index bb8bb85308ab78d8e0eb79b6caf792b85525bc9a..c7563ed3ac314d3ef0219e1dfe81585746a0c6c5 100644 (file)
@@ -1404,11 +1404,11 @@ static void hso_serial_set_termios(struct tty_struct *tty, struct ktermios *old)
 }
 
 /* how many characters in the buffer */
-static int hso_serial_chars_in_buffer(struct tty_struct *tty)
+static unsigned int hso_serial_chars_in_buffer(struct tty_struct *tty)
 {
        struct hso_serial *serial = tty->driver_data;
-       int chars;
        unsigned long flags;
+       unsigned int chars;
 
        /* sanity check */
        if (serial == NULL)
index c9fd4a05931a88389178808b60ec3407e4529457..8821927ef875863447a9b53c7022b761572023aa 100644 (file)
@@ -980,7 +980,7 @@ static void tty3215_flush_chars(struct tty_struct *tty)
 /*
  * Returns the number of characters in the output buffer
  */
-static int tty3215_chars_in_buffer(struct tty_struct *tty)
+static unsigned int tty3215_chars_in_buffer(struct tty_struct *tty)
 {
        struct raw3215_info *raw = tty->driver_data;
 
index d6c84e354df5b88f083a6c7f3f1773fc2b51f32e..5a1bf6eaa9d925b0c237aefb6176ffa6d10d2e17 100644 (file)
@@ -325,10 +325,10 @@ sclp_buffer_space(struct sclp_buffer *buffer)
 /*
  * Return number of characters in buffer
  */
-int
+unsigned int
 sclp_chars_in_buffer(struct sclp_buffer *buffer)
 {
-       int count;
+       unsigned int count;
 
        count = buffer->char_sum;
        if (buffer->current_line != NULL)
index 93d706e4935ce4e316119ee60e9324687467cae4..b4506be79246bd671fb3ba2873c1c989b8c13af7 100644 (file)
@@ -86,7 +86,7 @@ void *sclp_unmake_buffer(struct sclp_buffer *);
 int sclp_buffer_space(struct sclp_buffer *);
 int sclp_write(struct sclp_buffer *buffer, const unsigned char *, int);
 int sclp_emit_buffer(struct sclp_buffer *,void (*)(struct sclp_buffer *,int));
-int sclp_chars_in_buffer(struct sclp_buffer *);
+unsigned int sclp_chars_in_buffer(struct sclp_buffer *);
 
 #ifdef CONFIG_SCLP_CONSOLE
 void sclp_console_pm_event(enum sclp_pm_event sclp_pm_event);
index ea1e43fd16bc3f60c8f34ae62cc9ad41af84a382..162127ff784583df769bdf9f4e5e2f1a2ecb831d 100644 (file)
@@ -280,16 +280,15 @@ sclp_tty_flush_chars(struct tty_struct *tty)
  * characters in the write buffer (will not be written as long as there is a
  * final line feed missing).
  */
-static int
+static unsigned int
 sclp_tty_chars_in_buffer(struct tty_struct *tty)
 {
        unsigned long flags;
        struct list_head *l;
        struct sclp_buffer *t;
-       int count;
+       unsigned int count = 0;
 
        spin_lock_irqsave(&sclp_tty_lock, flags);
-       count = 0;
        if (sclp_ttybuf != NULL)
                count = sclp_chars_in_buffer(sclp_ttybuf);
        list_for_each(l, &sclp_tty_outqueue) {
index b621adee35f048b7b73947c9b8cb902efa8256eb..24eb3a0b0a9aff159b9a1febfdcc383e39920f50 100644 (file)
@@ -629,16 +629,15 @@ sclp_vt220_write_room(struct tty_struct *tty)
 /*
  * Return number of buffered chars.
  */
-static int
+static unsigned int
 sclp_vt220_chars_in_buffer(struct tty_struct *tty)
 {
        unsigned long flags;
        struct list_head *l;
        struct sclp_vt220_request *r;
-       int count;
+       unsigned int count = 0;
 
        spin_lock_irqsave(&sclp_vt220_lock, flags);
-       count = 0;
        if (sclp_vt220_current_request != NULL)
                count = sclp_vt220_chars_stored(sclp_vt220_current_request);
        list_for_each(l, &sclp_vt220_outqueue) {
index a151cd76d24eac9aba53917d0a24cac1a2b96469..d2b286ea27c5c738c64d213dc1d8b8b47cb026f3 100644 (file)
@@ -1127,16 +1127,16 @@ static unsigned int fwtty_write_room(struct tty_struct *tty)
        return n;
 }
 
-static int fwtty_chars_in_buffer(struct tty_struct *tty)
+static unsigned int fwtty_chars_in_buffer(struct tty_struct *tty)
 {
        struct fwtty_port *port = tty->driver_data;
-       int n;
+       unsigned int n;
 
        spin_lock_bh(&port->lock);
        n = dma_fifo_level(&port->tx_fifo);
        spin_unlock_bh(&port->lock);
 
-       fwtty_dbg(port, "%d\n", n);
+       fwtty_dbg(port, "%u\n", n);
 
        return n;
 }
index 529eccb99b6c87aee1d7e418b30533dfb2e78160..ccfaa0f21b9c27edf5ed5220706d9d0109e25166 100644 (file)
@@ -457,11 +457,11 @@ static unsigned int gb_tty_write_room(struct tty_struct *tty)
        return room;
 }
 
-static int gb_tty_chars_in_buffer(struct tty_struct *tty)
+static unsigned int gb_tty_chars_in_buffer(struct tty_struct *tty)
 {
        struct gb_tty *gb_tty = tty->driver_data;
        unsigned long flags;
-       int chars;
+       unsigned int chars;
 
        spin_lock_irqsave(&gb_tty->write_lock, flags);
        chars = kfifo_len(&gb_tty->write_fifo);
index ee1f4d72cd5ebc8f553a76e90136e3e2e4b49ba6..5ec19c48fb7a7e5fd3180fd124586ab02c8a9e50 100644 (file)
@@ -834,7 +834,7 @@ static unsigned int rs_write_room(struct tty_struct *tty)
        return CIRC_SPACE(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE);
 }
 
-static int rs_chars_in_buffer(struct tty_struct *tty)
+static unsigned int rs_chars_in_buffer(struct tty_struct *tty)
 {
        struct serial_state *info = tty->driver_data;
 
index e4f9a60dcc181cce980e688cf283dd8d76df569d..ccb683a6e6f52f0de65b1ea02261dde94ff402bb 100644 (file)
@@ -198,7 +198,7 @@ static unsigned int goldfish_tty_write_room(struct tty_struct *tty)
        return 0x10000;
 }
 
-static int goldfish_tty_chars_in_buffer(struct tty_struct *tty)
+static unsigned int goldfish_tty_chars_in_buffer(struct tty_struct *tty)
 {
        struct goldfish_tty *qtty = &goldfish_ttys[tty->index];
        void __iomem *base = qtty->base;
index a3725eb69cd34b86b938aa1bfd9a2dd54f747b3a..d0f0253fb93ec9a25762f93f5f46138cc814ee94 100644 (file)
@@ -596,7 +596,7 @@ static unsigned int hvc_write_room(struct tty_struct *tty)
        return hp->outbuf_size - hp->n_outbuf;
 }
 
-static int hvc_chars_in_buffer(struct tty_struct *tty)
+static unsigned int hvc_chars_in_buffer(struct tty_struct *tty)
 {
        struct hvc_struct *hp = tty->driver_data;
 
index f43f2f94d8bd2b1b3476e5eb43f860744ad2a3ed..fe5e6b4f43dea80c67ca7ed014f376505940a438 100644 (file)
@@ -1386,7 +1386,7 @@ static unsigned int hvcs_write_room(struct tty_struct *tty)
        return HVCS_BUFF_LEN - hvcsd->chars_in_buffer;
 }
 
-static int hvcs_chars_in_buffer(struct tty_struct *tty)
+static unsigned int hvcs_chars_in_buffer(struct tty_struct *tty)
 {
        struct hvcs_struct *hvcsd = tty->driver_data;
 
index 0a56f44e6b1232ae447015c1d19048e3047277e7..bfc15279d5bc967e11ad94c4fab529b13c925732 100644 (file)
@@ -897,7 +897,7 @@ static unsigned int hvsi_write_room(struct tty_struct *tty)
        return N_OUTBUF - hp->n_outbuf;
 }
 
-static int hvsi_chars_in_buffer(struct tty_struct *tty)
+static unsigned int hvsi_chars_in_buffer(struct tty_struct *tty)
 {
        struct hvsi_struct *hp = tty->driver_data;
 
index ab562838313b57ca33c2edad9a14ab840de3a7c9..e01ca68f24f4325a0c4cf2d0f393bc6ce507005b 100644 (file)
@@ -270,7 +270,7 @@ static int ipwireless_set_serial_info(struct tty_struct *linux_tty,
        return 0;       /* Keeps the PCMCIA scripts happy. */
 }
 
-static int ipw_chars_in_buffer(struct tty_struct *linux_tty)
+static unsigned int ipw_chars_in_buffer(struct tty_struct *linux_tty)
 {
        struct ipw_tty *tty = linux_tty->driver_data;
 
index f427e8e154d75a3afd18e62a7fa42e0894df88ee..3b5915b94fac62fe22b0970061f022ae31718696 100644 (file)
@@ -854,10 +854,10 @@ static unsigned int mips_ejtag_fdc_tty_write_room(struct tty_struct *tty)
        return room;
 }
 
-static int mips_ejtag_fdc_tty_chars_in_buffer(struct tty_struct *tty)
+static unsigned int mips_ejtag_fdc_tty_chars_in_buffer(struct tty_struct *tty)
 {
        struct mips_ejtag_fdc_tty_port *dport = tty->driver_data;
-       int chars;
+       unsigned int chars;
 
        /* Report the number of bytes in the xmit buffer */
        spin_lock(&dport->xmit_lock);
index e4fe9315de29baf8192df4372cfb59738e2199e5..64b18177c790a623ee1442832e338ef3c46e9c52 100644 (file)
@@ -190,7 +190,7 @@ static void moxa_close(struct tty_struct *, struct file *);
 static int moxa_write(struct tty_struct *, const unsigned char *, int);
 static unsigned int moxa_write_room(struct tty_struct *);
 static void moxa_flush_buffer(struct tty_struct *);
-static int moxa_chars_in_buffer(struct tty_struct *);
+static unsigned int moxa_chars_in_buffer(struct tty_struct *);
 static void moxa_set_termios(struct tty_struct *, struct ktermios *);
 static void moxa_stop(struct tty_struct *);
 static void moxa_start(struct tty_struct *);
@@ -216,7 +216,7 @@ static int MoxaPortLineStatus(struct moxa_port *);
 static void MoxaPortFlushData(struct moxa_port *, int);
 static int MoxaPortWriteData(struct tty_struct *, const unsigned char *, int);
 static int MoxaPortReadData(struct moxa_port *);
-static int MoxaPortTxQueue(struct moxa_port *);
+static unsigned int MoxaPortTxQueue(struct moxa_port *);
 static int MoxaPortRxQueue(struct moxa_port *);
 static unsigned int MoxaPortTxFree(struct moxa_port *);
 static void MoxaPortTxDisable(struct moxa_port *);
@@ -1239,10 +1239,10 @@ static void moxa_flush_buffer(struct tty_struct *tty)
        tty_wakeup(tty);
 }
 
-static int moxa_chars_in_buffer(struct tty_struct *tty)
+static unsigned int moxa_chars_in_buffer(struct tty_struct *tty)
 {
        struct moxa_port *ch = tty->driver_data;
-       int chars;
+       unsigned int chars;
 
        chars = MoxaPortTxQueue(ch);
        if (chars)
@@ -1981,7 +1981,7 @@ static int MoxaPortReadData(struct moxa_port *port)
 }
 
 
-static int MoxaPortTxQueue(struct moxa_port *port)
+static unsigned int MoxaPortTxQueue(struct moxa_port *port)
 {
        void __iomem *ofsAddr = port->tableAddr;
        u16 rptr, wptr, mask;
index 5851a45d828c3df865a4e1362c1ea6af715dbef8..a74e6146a7481a890786b88fc1b80c5ab3de1ad8 100644 (file)
@@ -1192,7 +1192,7 @@ static unsigned int mxser_write_room(struct tty_struct *tty)
        return ret < 0 ? 0 : ret;
 }
 
-static int mxser_chars_in_buffer(struct tty_struct *tty)
+static unsigned int mxser_chars_in_buffer(struct tty_struct *tty)
 {
        struct mxser_port *info = tty->driver_data;
        return info->xmit_cnt;
index 06f0c6d3962000d783f15f7c4f670037f7156bca..bd24dc0d7e9679b3a5d8d0394a4f544abceb8311 100644 (file)
@@ -3064,7 +3064,7 @@ static unsigned int gsmtty_write_room(struct tty_struct *tty)
        return TX_SIZE - kfifo_len(&dlci->fifo);
 }
 
-static int gsmtty_chars_in_buffer(struct tty_struct *tty)
+static unsigned int gsmtty_chars_in_buffer(struct tty_struct *tty)
 {
        struct gsm_dlci *dlci = tty->driver_data;
        if (dlci->state == DLCI_CLOSED)
index c55475a9a184a4e7c34dc0ee8d9b9c91cc82a9c0..62c16731ccd83b7475d83e1707918f3726a5295a 100644 (file)
@@ -1776,7 +1776,7 @@ static void ntty_throttle(struct tty_struct *tty)
 }
 
 /* Returns number of chars in buffer, called by tty layer */
-static s32 ntty_chars_in_buffer(struct tty_struct *tty)
+static unsigned int ntty_chars_in_buffer(struct tty_struct *tty)
 {
        struct port *port = tty->driver_data;
        struct nozomi *dc = get_dc_by_tty(tty);
index cb46a65a5dd82f8d330a1c515a42bf25304c7256..d29329eb52f4d59b45a42deb165e6f9a2316397f 100644 (file)
@@ -629,12 +629,12 @@ static unsigned int uart_write_room(struct tty_struct *tty)
        return ret;
 }
 
-static int uart_chars_in_buffer(struct tty_struct *tty)
+static unsigned int uart_chars_in_buffer(struct tty_struct *tty)
 {
        struct uart_state *state = tty->driver_data;
        struct uart_port *port;
        unsigned long flags;
-       int ret;
+       unsigned int ret;
 
        port = uart_port_lock(state, flags);
        ret = uart_circ_chars_pending(&state->xmit);
index 583aa83421127e34a5d863b2baaea42599a5793f..cf87dc66087b3d46e1d34963d673b509b9aac449 100644 (file)
@@ -1254,14 +1254,14 @@ static int synclink_gt_proc_show(struct seq_file *m, void *v)
 /*
  * return count of bytes in transmit buffer
  */
-static int chars_in_buffer(struct tty_struct *tty)
+static unsigned int chars_in_buffer(struct tty_struct *tty)
 {
        struct slgt_info *info = tty->driver_data;
-       int count;
+       unsigned int count;
        if (sanity_check(info, tty->name, "chars_in_buffer"))
                return 0;
        count = tbuf_bytes(info);
-       DBGINFO(("%s chars_in_buffer()=%d\n", info->device_name, count));
+       DBGINFO(("%s chars_in_buffer()=%u\n", info->device_name, count));
        return count;
 }
 
index d8834784b58670c1d824f430e7ec1a5ac1b35460..aa9ecc8be990bfc64ba851fd930bb284a5e2ab49 100644 (file)
@@ -54,7 +54,7 @@
  *     to be no queue on the device.
  */
 
-int tty_chars_in_buffer(struct tty_struct *tty)
+unsigned int tty_chars_in_buffer(struct tty_struct *tty)
 {
        if (tty->ops->chars_in_buffer)
                return tty->ops->chars_in_buffer(tty);
index d82ce3bb82c37905f51dce53e6324a827be474a1..e883b8f12099338b7421709bb01bb8c4c4ad26e1 100644 (file)
@@ -888,10 +888,10 @@ static unsigned int vcc_write_room(struct tty_struct *tty)
        return num;
 }
 
-static int vcc_chars_in_buffer(struct tty_struct *tty)
+static unsigned int vcc_chars_in_buffer(struct tty_struct *tty)
 {
        struct vcc_port *port;
-       u64 num;
+       unsigned int num;
 
        port = vcc_get_ne(tty->index);
        if (unlikely(!port)) {
index 76b7fd234238fcb20283fbacd0afe835c39bd229..81199efe0312fe9a4e0da8e6f6ddc87dc69447a5 100644 (file)
@@ -848,7 +848,7 @@ static unsigned int acm_tty_write_room(struct tty_struct *tty)
        return acm_wb_is_avail(acm) ? acm->writesize : 0;
 }
 
-static int acm_tty_chars_in_buffer(struct tty_struct *tty)
+static unsigned int acm_tty_chars_in_buffer(struct tty_struct *tty)
 {
        struct acm *acm = tty->driver_data;
        /*
index 676a920d9d6b5ac546195b65517cc2d6c073fe3f..bffef8e47daca81d680bd269f459bd8d1b0d5a93 100644 (file)
@@ -791,17 +791,17 @@ static unsigned int gs_write_room(struct tty_struct *tty)
        return room;
 }
 
-static int gs_chars_in_buffer(struct tty_struct *tty)
+static unsigned int gs_chars_in_buffer(struct tty_struct *tty)
 {
        struct gs_port  *port = tty->driver_data;
        unsigned long   flags;
-       int             chars = 0;
+       unsigned int    chars;
 
        spin_lock_irqsave(&port->port_lock, flags);
        chars = kfifo_len(&port->port_write_buf);
        spin_unlock_irqrestore(&port->port_lock, flags);
 
-       pr_vdebug("gs_chars_in_buffer: (%d,%p) chars=%d\n",
+       pr_vdebug("gs_chars_in_buffer: (%d,%p) chars=%u\n",
                port->port_num, tty, chars);
 
        return chars;
index cd3ab35dd6893d39149cf8872b86b1832910961f..bef104511352c9ce7a21a776f19afb123b0bb66d 100644 (file)
@@ -253,11 +253,11 @@ static unsigned int dbc_tty_write_room(struct tty_struct *tty)
        return room;
 }
 
-static int dbc_tty_chars_in_buffer(struct tty_struct *tty)
+static unsigned int dbc_tty_chars_in_buffer(struct tty_struct *tty)
 {
        struct dbc_port         *port = tty->driver_data;
        unsigned long           flags;
-       int                     chars = 0;
+       unsigned int            chars;
 
        spin_lock_irqsave(&port->port_lock, flags);
        chars = kfifo_len(&port->write_fifo);
index 055096831daf751b45bfb9649228f6d2bc1db065..eeb441c77207086bf611e68f2022e43a32e2e59e 100644 (file)
@@ -385,7 +385,7 @@ static unsigned int serial_write_room(struct tty_struct *tty)
        return port->serial->type->write_room(tty);
 }
 
-static int serial_chars_in_buffer(struct tty_struct *tty)
+static unsigned int serial_chars_in_buffer(struct tty_struct *tty)
 {
        struct usb_serial_port *port = tty->driver_data;
        struct usb_serial *serial = port->serial;
index d18fc34d30546ef9efbcaa5e41115310b32b2a27..5cf6b2e7331b7f80a1dfa29cf925d94e3597e350 100644 (file)
@@ -458,7 +458,7 @@ extern void tty_unregister_device(struct tty_driver *driver, unsigned index);
 extern void tty_write_message(struct tty_struct *tty, char *msg);
 extern int tty_send_xchar(struct tty_struct *tty, char ch);
 extern int tty_put_char(struct tty_struct *tty, unsigned char c);
-extern int tty_chars_in_buffer(struct tty_struct *tty);
+extern unsigned int tty_chars_in_buffer(struct tty_struct *tty);
 extern unsigned int tty_write_room(struct tty_struct *tty);
 extern void tty_driver_flush_buffer(struct tty_struct *tty);
 extern void tty_throttle(struct tty_struct *tty);
index ea5b15c72764f7f8741f6c9be79338c636a87ae0..a4694bb125cc8a6ac4881993d5b41a32f48159b1 100644 (file)
@@ -257,7 +257,7 @@ struct tty_operations {
        int  (*put_char)(struct tty_struct *tty, unsigned char ch);
        void (*flush_chars)(struct tty_struct *tty);
        unsigned int (*write_room)(struct tty_struct *tty);
-       int  (*chars_in_buffer)(struct tty_struct *tty);
+       unsigned int (*chars_in_buffer)(struct tty_struct *tty);
        int  (*ioctl)(struct tty_struct *tty,
                    unsigned int cmd, unsigned long arg);
        long (*compat_ioctl)(struct tty_struct *tty,
index a5e3d957f20fabf04270187a85932fb94f84f3e6..c76dcc0f679b08ee6302b0a91f323be1f738aec7 100644 (file)
@@ -1010,7 +1010,7 @@ static void rfcomm_tty_unthrottle(struct tty_struct *tty)
        rfcomm_dlc_unthrottle(dev->dlc);
 }
 
-static int rfcomm_tty_chars_in_buffer(struct tty_struct *tty)
+static unsigned int rfcomm_tty_chars_in_buffer(struct tty_struct *tty)
 {
        struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data;