tty: make tty_operations::write_room return uint
authorJiri Slaby <jslaby@suse.cz>
Wed, 5 May 2021 09:19:15 +0000 (11:19 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 May 2021 15:03:20 +0000 (17:03 +0200)
Line disciplines expect a positive value or zero returned from
tty->ops->write_room (invoked by tty_write_room). So make this
assumption explicit by using unsigned int as a return value. Both of
tty->ops->write_room and tty_write_room.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Acked-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Acked-by: Alex Elder <elder@linaro.org>
Acked-by: Max Filippov <jcmvbkbc@gmail.com> # xtensa
Acked-by: David Sterba <dsterba@suse.com>
Acked-By: Anton Ivanov <anton.ivanov@cambridgegreys.com>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Richard Henderson <rth@twiddle.net>
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: Jeff Dike <jdike@addtoit.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: Chris Zankel <chris@zankel.net>
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: Scott Branden <scott.branden@broadcom.com>
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: 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-23-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
47 files changed:
arch/alpha/kernel/srmcons.c
arch/m68k/emu/nfcon.c
arch/parisc/kernel/pdc_cons.c
arch/um/drivers/line.c
arch/um/drivers/line.h
arch/xtensa/platforms/iss/console.c
drivers/char/pcmcia/synclink_cs.c
drivers/char/ttyprintk.c
drivers/ipack/devices/ipoctal.c
drivers/isdn/capi/capi.c
drivers/misc/bcm-vk/bcm_vk_tty.c
drivers/mmc/core/sdio_uart.c
drivers/net/usb/hso.c
drivers/s390/char/con3215.c
drivers/s390/char/sclp_tty.c
drivers/s390/char/sclp_vt220.c
drivers/s390/char/tty3270.c
drivers/staging/fwserial/fwserial.c
drivers/staging/gdm724x/gdm_tty.c
drivers/staging/greybus/uart.c
drivers/tty/amiserial.c
drivers/tty/ehv_bytechan.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/pty.c
drivers/tty/serial/kgdb_nmi.c
drivers/tty/serial/serial_core.c
drivers/tty/synclink_gt.c
drivers/tty/tty_ioctl.c
drivers/tty/ttynull.c
drivers/tty/vcc.c
drivers/tty/vt/vt.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 438b10c..2110b7e 100644 (file)
@@ -142,7 +142,7 @@ srmcons_write(struct tty_struct *tty,
        return count;
 }
 
-static int
+static unsigned int
 srmcons_write_room(struct tty_struct *tty)
 {
        return 512;
index 57e8c8f..92636c8 100644 (file)
@@ -85,7 +85,7 @@ static int nfcon_tty_put_char(struct tty_struct *tty, unsigned char ch)
        return 1;
 }
 
-static int nfcon_tty_write_room(struct tty_struct *tty)
+static unsigned int nfcon_tty_write_room(struct tty_struct *tty)
 {
        return 64;
 }
index 7ed404c..fe2ed0b 100644 (file)
@@ -103,7 +103,7 @@ static int pdc_console_tty_write(struct tty_struct *tty, const unsigned char *bu
        return count;
 }
 
-static int pdc_console_tty_write_room(struct tty_struct *tty)
+static unsigned int pdc_console_tty_write_room(struct tty_struct *tty)
 {
        return 32768; /* no limit, no buffer used */
 }
index 1c70a31..2b8810b 100644 (file)
@@ -32,7 +32,7 @@ static irqreturn_t line_interrupt(int irq, void *data)
  *
  * Should be called while holding line->lock (this does not modify data).
  */
-static int write_room(struct line *line)
+static unsigned int write_room(struct line *line)
 {
        int n;
 
@@ -47,11 +47,11 @@ static int write_room(struct line *line)
        return n - 1;
 }
 
-int line_write_room(struct tty_struct *tty)
+unsigned int line_write_room(struct tty_struct *tty)
 {
        struct line *line = tty->driver_data;
        unsigned long flags;
-       int room;
+       unsigned int room;
 
        spin_lock_irqsave(&line->lock, flags);
        room = write_room(line);
index 01d21e7..861edf3 100644 (file)
@@ -70,7 +70,7 @@ extern void line_set_termios(struct tty_struct *tty, struct ktermios * old);
 extern 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 int line_write_room(struct tty_struct *tty);
+extern unsigned int line_write_room(struct tty_struct *tty);
 extern void line_throttle(struct tty_struct *tty);
 extern void line_unthrottle(struct tty_struct *tty);
 
index a3dda25..98ac3a7 100644 (file)
@@ -100,7 +100,7 @@ static void rs_flush_chars(struct tty_struct *tty)
 {
 }
 
-static int rs_write_room(struct tty_struct *tty)
+static unsigned int rs_write_room(struct tty_struct *tty)
 {
        /* Let's say iss can always accept 2K characters.. */
        return 2 * 1024;
index b4707bc..e4b2c68 100644 (file)
@@ -1609,7 +1609,7 @@ cleanup:
 
 /* Return the count of free bytes in transmit buffer
  */
-static int mgslpc_write_room(struct tty_struct *tty)
+static unsigned int mgslpc_write_room(struct tty_struct *tty)
 {
        MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data;
        int ret;
index 93f5d11..e93b0af 100644 (file)
@@ -132,7 +132,7 @@ static int tpk_write(struct tty_struct *tty,
 /*
  * TTY operations write_room function.
  */
-static int tpk_write_room(struct tty_struct *tty)
+static unsigned int tpk_write_room(struct tty_struct *tty)
 {
        return TPK_MAX_ROOM;
 }
index 3940714..ea0f1ae 100644 (file)
@@ -460,7 +460,7 @@ static int ipoctal_write_tty(struct tty_struct *tty,
        return char_copied;
 }
 
-static int ipoctal_write_room(struct tty_struct *tty)
+static unsigned int ipoctal_write_room(struct tty_struct *tty)
 {
        struct ipoctal_channel *channel = tty->driver_data;
 
index fdf87ac..c50c454 100644 (file)
@@ -1175,14 +1175,14 @@ static void capinc_tty_flush_chars(struct tty_struct *tty)
        handle_minor_recv(mp);
 }
 
-static int capinc_tty_write_room(struct tty_struct *tty)
+static unsigned int capinc_tty_write_room(struct tty_struct *tty)
 {
        struct capiminor *mp = tty->driver_data;
-       int room;
+       unsigned int room;
 
        room = CAPINC_MAX_SENDQUEUE-skb_queue_len(&mp->outqueue);
        room *= CAPI_MAX_BLKSIZE;
-       pr_debug("capinc_tty_write_room = %d\n", room);
+       pr_debug("capinc_tty_write_room = %u\n", room);
        return room;
 }
 
index 4d02692..dae9eee 100644 (file)
@@ -214,7 +214,7 @@ static int bcm_vk_tty_write(struct tty_struct *tty,
        return count;
 }
 
-static int bcm_vk_tty_write_room(struct tty_struct *tty)
+static unsigned int bcm_vk_tty_write_room(struct tty_struct *tty)
 {
        struct bcm_vk *vk = dev_get_drvdata(tty->dev);
 
index dbcac2b..c8f4eca 100644 (file)
@@ -797,7 +797,7 @@ static int sdio_uart_write(struct tty_struct *tty, const unsigned char *buf,
        return ret;
 }
 
-static int sdio_uart_write_room(struct tty_struct *tty)
+static unsigned int sdio_uart_write_room(struct tty_struct *tty)
 {
        struct sdio_uart_port *port = tty->driver_data;
        return FIFO_SIZE - kfifo_len(&port->xmit_fifo);
index 3ef4b28..bb8bb85 100644 (file)
@@ -1357,10 +1357,10 @@ out:
 }
 
 /* how much room is there for writing */
-static int hso_serial_write_room(struct tty_struct *tty)
+static unsigned int hso_serial_write_room(struct tty_struct *tty)
 {
        struct hso_serial *serial = tty->driver_data;
-       int room;
+       unsigned int room;
        unsigned long flags;
 
        spin_lock_irqsave(&serial->serial_lock, flags);
index 1fd5bca..c9fd4a0 100644 (file)
@@ -924,7 +924,7 @@ static void tty3215_close(struct tty_struct *tty, struct file * filp)
 /*
  * Returns the amount of free space in the output buffer.
  */
-static int tty3215_write_room(struct tty_struct *tty)
+static unsigned int tty3215_write_room(struct tty_struct *tty)
 {
        struct raw3215_info *raw = tty->driver_data;
 
index 4456ceb..ea1e43f 100644 (file)
@@ -86,12 +86,12 @@ sclp_tty_close(struct tty_struct *tty, struct file *filp)
  * a string of newlines. Every newline creates a new message which
  * needs 82 bytes.
  */
-static int
+static unsigned int
 sclp_tty_write_room (struct tty_struct *tty)
 {
        unsigned long flags;
        struct list_head *l;
-       int count;
+       unsigned int count;
 
        spin_lock_irqsave(&sclp_tty_lock, flags);
        count = 0;
index 7f4445b..b621ade 100644 (file)
@@ -609,12 +609,12 @@ sclp_vt220_flush_chars(struct tty_struct *tty)
  * to change as output buffers get emptied, or if the output flow
  * control is acted.
  */
-static int
+static unsigned int
 sclp_vt220_write_room(struct tty_struct *tty)
 {
        unsigned long flags;
        struct list_head *l;
-       int count;
+       unsigned int count;
 
        spin_lock_irqsave(&sclp_vt220_lock, flags);
        count = 0;
index 1b68564..82d4c96 100644 (file)
@@ -1071,7 +1071,7 @@ static void tty3270_cleanup(struct tty_struct *tty)
 /*
  * We always have room.
  */
-static int
+static unsigned int
 tty3270_write_room(struct tty_struct *tty)
 {
        return INT_MAX;
index 4245532..a151cd7 100644 (file)
@@ -1113,16 +1113,16 @@ static int fwtty_write(struct tty_struct *tty, const unsigned char *buf, int c)
        return (n < 0) ? 0 : n;
 }
 
-static int fwtty_write_room(struct tty_struct *tty)
+static unsigned int fwtty_write_room(struct tty_struct *tty)
 {
        struct fwtty_port *port = tty->driver_data;
-       int n;
+       unsigned int n;
 
        spin_lock_bh(&port->lock);
        n = dma_fifo_avail(&port->tx_fifo);
        spin_unlock_bh(&port->lock);
 
-       fwtty_dbg(port, "%d\n", n);
+       fwtty_dbg(port, "%u\n", n);
 
        return n;
 }
index 0ccc8c2..279de2c 100644 (file)
@@ -183,7 +183,7 @@ static int gdm_tty_write(struct tty_struct *tty, const unsigned char *buf,
        return len;
 }
 
-static int gdm_tty_write_room(struct tty_struct *tty)
+static unsigned int gdm_tty_write_room(struct tty_struct *tty)
 {
        struct gdm *gdm = tty->driver_data;
 
index b1e63f7..529eccb 100644 (file)
@@ -440,7 +440,7 @@ static int gb_tty_write(struct tty_struct *tty, const unsigned char *buf,
        return count;
 }
 
-static int gb_tty_write_room(struct tty_struct *tty)
+static unsigned int gb_tty_write_room(struct tty_struct *tty)
 {
        struct gb_tty *gb_tty = tty->driver_data;
        unsigned long flags;
index a4b8876..ee1f4d7 100644 (file)
@@ -827,7 +827,7 @@ static int rs_write(struct tty_struct * tty, const unsigned char *buf, int count
        return ret;
 }
 
-static int rs_write_room(struct tty_struct *tty)
+static unsigned int rs_write_room(struct tty_struct *tty)
 {
        struct serial_state *info = tty->driver_data;
 
index 3c6dd06..445e5ff 100644 (file)
@@ -536,11 +536,11 @@ static void ehv_bc_tty_close(struct tty_struct *ttys, struct file *filp)
  * how much write room the driver can guarantee will be sent OR BUFFERED.  This
  * driver MUST honor the return value.
  */
-static int ehv_bc_tty_write_room(struct tty_struct *ttys)
+static unsigned int ehv_bc_tty_write_room(struct tty_struct *ttys)
 {
        struct ehv_bc_data *bc = ttys->driver_data;
        unsigned long flags;
-       int count;
+       unsigned int count;
 
        spin_lock_irqsave(&bc->lock, flags);
        count = CIRC_SPACE(bc->head, bc->tail, BUF_SIZE);
index cd23a4b..e4f9a60 100644 (file)
@@ -193,7 +193,7 @@ static int goldfish_tty_write(struct tty_struct *tty, const unsigned char *buf,
        return count;
 }
 
-static int goldfish_tty_write_room(struct tty_struct *tty)
+static unsigned int goldfish_tty_write_room(struct tty_struct *tty)
 {
        return 0x10000;
 }
index cdcc64e..a3725eb 100644 (file)
@@ -586,7 +586,7 @@ static void hvc_set_winsz(struct work_struct *work)
  * how much write room the driver can guarantee will be sent OR BUFFERED.  This
  * driver MUST honor the return value.
  */
-static int hvc_write_room(struct tty_struct *tty)
+static unsigned int hvc_write_room(struct tty_struct *tty)
 {
        struct hvc_struct *hp = tty->driver_data;
 
index 197988c..f43f2f9 100644 (file)
@@ -1376,7 +1376,7 @@ static int hvcs_write(struct tty_struct *tty,
  * absolutely WILL BUFFER if we can't send it.  This driver MUST honor the
  * return value, hence the reason for hvcs_struct buffering.
  */
-static int hvcs_write_room(struct tty_struct *tty)
+static unsigned int hvcs_write_room(struct tty_struct *tty)
 {
        struct hvcs_struct *hvcsd = tty->driver_data;
 
index e8c58f9..0a56f44 100644 (file)
@@ -890,7 +890,7 @@ out:
        spin_unlock_irqrestore(&hp->lock, flags);
 }
 
-static int hvsi_write_room(struct tty_struct *tty)
+static unsigned int hvsi_write_room(struct tty_struct *tty)
 {
        struct hvsi_struct *hp = tty->driver_data;
 
@@ -929,7 +929,7 @@ static int hvsi_write(struct tty_struct *tty,
         * will see there is no room in outbuf and return.
         */
        while ((count > 0) && (hvsi_write_room(tty) > 0)) {
-               int chunksize = min(count, hvsi_write_room(tty));
+               int chunksize = min_t(int, count, hvsi_write_room(tty));
 
                BUG_ON(hp->n_outbuf < 0);
                memcpy(hp->outbuf + hp->n_outbuf, source, chunksize);
index 99bb2f1..ab56283 100644 (file)
@@ -228,7 +228,7 @@ static int ipw_write(struct tty_struct *linux_tty,
        return count;
 }
 
-static int ipw_write_room(struct tty_struct *linux_tty)
+static unsigned int ipw_write_room(struct tty_struct *linux_tty)
 {
        struct ipw_tty *tty = linux_tty->driver_data;
        int room;
index a8e19b4..f427e8e 100644 (file)
@@ -840,11 +840,11 @@ static int mips_ejtag_fdc_tty_write(struct tty_struct *tty,
        return total;
 }
 
-static int mips_ejtag_fdc_tty_write_room(struct tty_struct *tty)
+static unsigned int mips_ejtag_fdc_tty_write_room(struct tty_struct *tty)
 {
        struct mips_ejtag_fdc_tty_port *dport = tty->driver_data;
        struct mips_ejtag_fdc_tty *priv = dport->driver;
-       int room;
+       unsigned int room;
 
        /* Report the space in the xmit buffer */
        spin_lock(&dport->xmit_lock);
index 847ad3d..e4fe931 100644 (file)
@@ -188,7 +188,7 @@ module_param(ttymajor, int, 0);
 static int moxa_open(struct tty_struct *, struct file *);
 static void moxa_close(struct tty_struct *, struct file *);
 static int moxa_write(struct tty_struct *, const unsigned char *, int);
-static int moxa_write_room(struct tty_struct *);
+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 void moxa_set_termios(struct tty_struct *, struct ktermios *);
@@ -218,7 +218,7 @@ static int MoxaPortWriteData(struct tty_struct *, const unsigned char *, int);
 static int MoxaPortReadData(struct moxa_port *);
 static int MoxaPortTxQueue(struct moxa_port *);
 static int MoxaPortRxQueue(struct moxa_port *);
-static int MoxaPortTxFree(struct moxa_port *);
+static unsigned int MoxaPortTxFree(struct moxa_port *);
 static void MoxaPortTxDisable(struct moxa_port *);
 static void MoxaPortTxEnable(struct moxa_port *);
 static int moxa_get_serial_info(struct tty_struct *, struct serial_struct *);
@@ -1217,7 +1217,7 @@ static int moxa_write(struct tty_struct *tty,
        return len;
 }
 
-static int moxa_write_room(struct tty_struct *tty)
+static unsigned int moxa_write_room(struct tty_struct *tty)
 {
        struct moxa_port *ch;
 
@@ -1992,7 +1992,7 @@ static int MoxaPortTxQueue(struct moxa_port *port)
        return (wptr - rptr) & mask;
 }
 
-static int MoxaPortTxFree(struct moxa_port *port)
+static unsigned int MoxaPortTxFree(struct moxa_port *port)
 {
        void __iomem *ofsAddr = port->tableAddr;
        u16 rptr, wptr, mask;
index 85271e1..5851a45 100644 (file)
@@ -1183,7 +1183,7 @@ static void mxser_flush_chars(struct tty_struct *tty)
        spin_unlock_irqrestore(&info->slock, flags);
 }
 
-static int mxser_write_room(struct tty_struct *tty)
+static unsigned int mxser_write_room(struct tty_struct *tty)
 {
        struct mxser_port *info = tty->driver_data;
        int ret;
index 157b26e..06f0c6d 100644 (file)
@@ -3056,7 +3056,7 @@ static int gsmtty_write(struct tty_struct *tty, const unsigned char *buf,
        return sent;
 }
 
-static int gsmtty_write_room(struct tty_struct *tty)
+static unsigned int gsmtty_write_room(struct tty_struct *tty)
 {
        struct gsm_dlci *dlci = tty->driver_data;
        if (dlci->state == DLCI_CLOSED)
index 9a2d78a..c55475a 100644 (file)
@@ -1636,10 +1636,10 @@ static int ntty_write(struct tty_struct *tty, const unsigned char *buffer,
  * If the port is unplugged report lots of room and let the bits
  * dribble away so we don't block anything.
  */
-static int ntty_write_room(struct tty_struct *tty)
+static unsigned int ntty_write_room(struct tty_struct *tty)
 {
        struct port *port = tty->driver_data;
-       int room = 4096;
+       unsigned int room = 4096;
        const struct nozomi *dc = get_dc_by_tty(tty);
 
        if (dc)
index 3e7b5c8..eb8556b 100644 (file)
@@ -136,7 +136,7 @@ static int pty_write(struct tty_struct *tty, const unsigned char *buf, int c)
  *     the other device.
  */
 
-static int pty_write_room(struct tty_struct *tty)
+static unsigned int pty_write_room(struct tty_struct *tty)
 {
        if (tty->flow.stopped)
                return 0;
index db059b6..b193bbc 100644 (file)
@@ -298,7 +298,7 @@ static void kgdb_nmi_tty_hangup(struct tty_struct *tty)
        tty_port_hangup(&priv->port);
 }
 
-static int kgdb_nmi_tty_write_room(struct tty_struct *tty)
+static unsigned int kgdb_nmi_tty_write_room(struct tty_struct *tty)
 {
        /* Actually, we can handle any amount as we use polled writes. */
        return 2048;
index 87f7127..cb46a65 100644 (file)
@@ -616,12 +616,12 @@ static int uart_write(struct tty_struct *tty,
        return ret;
 }
 
-static int uart_write_room(struct tty_struct *tty)
+static unsigned int uart_write_room(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_free(&state->xmit);
index 1555dcc..583aa83 100644 (file)
@@ -868,15 +868,15 @@ exit:
        DBGINFO(("%s wait_until_sent exit\n", info->device_name));
 }
 
-static int write_room(struct tty_struct *tty)
+static unsigned int write_room(struct tty_struct *tty)
 {
        struct slgt_info *info = tty->driver_data;
-       int ret;
+       unsigned int ret;
 
        if (sanity_check(info, tty->name, "write_room"))
                return 0;
        ret = (info->tx_active) ? 0 : HDLC_MAX_FRAME_SIZE;
-       DBGINFO(("%s write_room=%d\n", info->device_name, ret));
+       DBGINFO(("%s write_room=%u\n", info->device_name, ret));
        return ret;
 }
 
index 07c88cc..d883478 100644 (file)
@@ -73,7 +73,7 @@ EXPORT_SYMBOL(tty_chars_in_buffer);
  *     returned and data may be lost as there will be no flow control.
  */
  
-int tty_write_room(struct tty_struct *tty)
+unsigned int tty_write_room(struct tty_struct *tty)
 {
        if (tty->ops->write_room)
                return tty->ops->write_room(tty);
index 17f05b7..af3311a 100644 (file)
@@ -35,7 +35,7 @@ static int ttynull_write(struct tty_struct *tty, const unsigned char *buf,
        return count;
 }
 
-static int ttynull_write_room(struct tty_struct *tty)
+static unsigned int ttynull_write_room(struct tty_struct *tty)
 {
        return 65536;
 }
index 0a3a71e..d82ce3b 100644 (file)
@@ -870,10 +870,10 @@ static int vcc_write(struct tty_struct *tty, const unsigned char *buf,
        return total_sent ? total_sent : rv;
 }
 
-static int vcc_write_room(struct tty_struct *tty)
+static unsigned int vcc_write_room(struct tty_struct *tty)
 {
        struct vcc_port *port;
-       u64 num;
+       unsigned int num;
 
        port = vcc_get_ne(tty->index);
        if (unlikely(!port)) {
index 706f066..96c1307 100644 (file)
@@ -3263,7 +3263,7 @@ static int con_put_char(struct tty_struct *tty, unsigned char ch)
        return do_con_write(tty, &ch, 1);
 }
 
-static int con_write_room(struct tty_struct *tty)
+static unsigned int con_write_room(struct tty_struct *tty)
 {
        if (tty->flow.stopped)
                return 0;
index ca7a611..76b7fd2 100644 (file)
@@ -838,7 +838,7 @@ static int acm_tty_write(struct tty_struct *tty,
        return count;
 }
 
-static int acm_tty_write_room(struct tty_struct *tty)
+static unsigned int acm_tty_write_room(struct tty_struct *tty)
 {
        struct acm *acm = tty->driver_data;
        /*
index 1e59204..676a920 100644 (file)
@@ -774,18 +774,18 @@ static void gs_flush_chars(struct tty_struct *tty)
        spin_unlock_irqrestore(&port->port_lock, flags);
 }
 
-static int gs_write_room(struct tty_struct *tty)
+static unsigned int gs_write_room(struct tty_struct *tty)
 {
        struct gs_port  *port = tty->driver_data;
        unsigned long   flags;
-       int             room = 0;
+       unsigned int room = 0;
 
        spin_lock_irqsave(&port->port_lock, flags);
        if (port->port_usb)
                room = kfifo_avail(&port->port_write_buf);
        spin_unlock_irqrestore(&port->port_lock, flags);
 
-       pr_vdebug("gs_write_room: (%d,%p) room=%d\n",
+       pr_vdebug("gs_write_room: (%d,%p) room=%u\n",
                port->port_num, tty, room);
 
        return room;
index ae4e4ab..cd3ab35 100644 (file)
@@ -240,11 +240,11 @@ static void dbc_tty_flush_chars(struct tty_struct *tty)
        spin_unlock_irqrestore(&port->port_lock, flags);
 }
 
-static int dbc_tty_write_room(struct tty_struct *tty)
+static unsigned int dbc_tty_write_room(struct tty_struct *tty)
 {
        struct dbc_port         *port = tty->driver_data;
        unsigned long           flags;
-       int                     room = 0;
+       unsigned int            room;
 
        spin_lock_irqsave(&port->port_lock, flags);
        room = kfifo_avail(&port->write_fifo);
index 98b33b1..0550968 100644 (file)
@@ -376,7 +376,7 @@ exit:
        return retval;
 }
 
-static int serial_write_room(struct tty_struct *tty)
+static unsigned int serial_write_room(struct tty_struct *tty)
 {
        struct usb_serial_port *port = tty->driver_data;
 
index e18a4f1..d18fc34 100644 (file)
@@ -459,7 +459,7 @@ 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 int tty_write_room(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);
 extern void tty_unthrottle(struct tty_struct *tty);
index 653fa5a..ea5b15c 100644 (file)
@@ -89,7 +89,7 @@
  *
  *     Note: Do not call this function directly, call tty_driver_flush_chars
  * 
- * int  (*write_room)(struct tty_struct *tty);
+ * unsigned int  (*write_room)(struct tty_struct *tty);
  *
  *     This routine returns the numbers of characters the tty driver
  *     will accept for queuing to be written.  This number is subject
@@ -256,7 +256,7 @@ struct tty_operations {
                      const unsigned char *buf, int count);
        int  (*put_char)(struct tty_struct *tty, unsigned char ch);
        void (*flush_chars)(struct tty_struct *tty);
-       int  (*write_room)(struct tty_struct *tty);
+       unsigned int (*write_room)(struct tty_struct *tty);
        int  (*chars_in_buffer)(struct tty_struct *tty);
        int  (*ioctl)(struct tty_struct *tty,
                    unsigned int cmd, unsigned long arg);
index a585849..a5e3d95 100644 (file)
@@ -807,7 +807,7 @@ static int rfcomm_tty_write(struct tty_struct *tty, const unsigned char *buf, in
        return sent;
 }
 
-static int rfcomm_tty_write_room(struct tty_struct *tty)
+static unsigned int rfcomm_tty_write_room(struct tty_struct *tty)
 {
        struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data;
        int room = 0;