From fff4ef17a9400fcd276b5c3a00ce5793f6c465e6 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Wed, 5 May 2021 11:19:19 +0200 Subject: tty: make tty_operations::chars_in_buffer return uint 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 Acked-By: Anton Ivanov Acked-by: David Sterba Cc: Jeff Dike Cc: Richard Weinberger Cc: Arnd Bergmann Cc: Samuel Iglesias Gonsalvez Cc: Jens Taprogge Cc: Karsten Keil Cc: Ulf Hansson Cc: "David S. Miller" Cc: Jakub Kicinski Cc: Heiko Carstens Cc: Vasily Gorbik Cc: Christian Borntraeger Cc: David Lin Cc: Johan Hovold Cc: Alex Elder Cc: Jiri Kosina Cc: Shawn Guo Cc: Sascha Hauer Cc: Oliver Neukum Cc: Felipe Balbi Cc: Mathias Nyman Cc: Marcel Holtmann Cc: Johan Hedberg Cc: Luiz Augusto von Dentz Link: https://lore.kernel.org/r/20210505091928.22010-27-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman --- drivers/tty/amiserial.c | 2 +- drivers/tty/goldfish.c | 2 +- drivers/tty/hvc/hvc_console.c | 2 +- drivers/tty/hvc/hvcs.c | 2 +- drivers/tty/hvc/hvsi.c | 2 +- drivers/tty/ipwireless/tty.c | 2 +- drivers/tty/mips_ejtag_fdc.c | 4 ++-- drivers/tty/moxa.c | 10 +++++----- drivers/tty/mxser.c | 2 +- drivers/tty/n_gsm.c | 2 +- drivers/tty/nozomi.c | 2 +- drivers/tty/serial/serial_core.c | 4 ++-- drivers/tty/synclink_gt.c | 6 +++--- drivers/tty/tty_ioctl.c | 2 +- drivers/tty/vcc.c | 4 ++-- 15 files changed, 24 insertions(+), 24 deletions(-) (limited to 'drivers/tty') diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c index ee1f4d72cd5e..5ec19c48fb7a 100644 --- a/drivers/tty/amiserial.c +++ b/drivers/tty/amiserial.c @@ -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; diff --git a/drivers/tty/goldfish.c b/drivers/tty/goldfish.c index e4f9a60dcc18..ccb683a6e6f5 100644 --- a/drivers/tty/goldfish.c +++ b/drivers/tty/goldfish.c @@ -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; diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c index a3725eb69cd3..d0f0253fb93e 100644 --- a/drivers/tty/hvc/hvc_console.c +++ b/drivers/tty/hvc/hvc_console.c @@ -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; diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c index f43f2f94d8bd..fe5e6b4f43de 100644 --- a/drivers/tty/hvc/hvcs.c +++ b/drivers/tty/hvc/hvcs.c @@ -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; diff --git a/drivers/tty/hvc/hvsi.c b/drivers/tty/hvc/hvsi.c index 0a56f44e6b12..bfc15279d5bc 100644 --- a/drivers/tty/hvc/hvsi.c +++ b/drivers/tty/hvc/hvsi.c @@ -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; diff --git a/drivers/tty/ipwireless/tty.c b/drivers/tty/ipwireless/tty.c index ab562838313b..e01ca68f24f4 100644 --- a/drivers/tty/ipwireless/tty.c +++ b/drivers/tty/ipwireless/tty.c @@ -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; diff --git a/drivers/tty/mips_ejtag_fdc.c b/drivers/tty/mips_ejtag_fdc.c index f427e8e154d7..3b5915b94fac 100644 --- a/drivers/tty/mips_ejtag_fdc.c +++ b/drivers/tty/mips_ejtag_fdc.c @@ -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); diff --git a/drivers/tty/moxa.c b/drivers/tty/moxa.c index e4fe9315de29..64b18177c790 100644 --- a/drivers/tty/moxa.c +++ b/drivers/tty/moxa.c @@ -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; diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 5851a45d828c..a74e6146a748 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -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; diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 06f0c6d39620..bd24dc0d7e96 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -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) diff --git a/drivers/tty/nozomi.c b/drivers/tty/nozomi.c index c55475a9a184..62c16731ccd8 100644 --- a/drivers/tty/nozomi.c +++ b/drivers/tty/nozomi.c @@ -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); diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index cb46a65a5dd8..d29329eb52f4 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -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); diff --git a/drivers/tty/synclink_gt.c b/drivers/tty/synclink_gt.c index 583aa8342112..cf87dc66087b 100644 --- a/drivers/tty/synclink_gt.c +++ b/drivers/tty/synclink_gt.c @@ -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; } diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c index d8834784b586..aa9ecc8be990 100644 --- a/drivers/tty/tty_ioctl.c +++ b/drivers/tty/tty_ioctl.c @@ -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); diff --git a/drivers/tty/vcc.c b/drivers/tty/vcc.c index d82ce3bb82c3..e883b8f12099 100644 --- a/drivers/tty/vcc.c +++ b/drivers/tty/vcc.c @@ -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)) { -- cgit v1.2.3