tty: make tty_operations::write()'s count size_t
authorJiri Slaby (SUSE) <jirislaby@kernel.org>
Thu, 10 Aug 2023 09:15:03 +0000 (11:15 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Aug 2023 19:12:46 +0000 (21:12 +0200)
Unify with the rest of the code. Use size_t for counts and ssize_t for
retval.

Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Link: https://lore.kernel.org/r/20230810091510.13006-30-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
43 files changed:
arch/alpha/kernel/srmcons.c
arch/m68k/emu/nfcon.c
arch/um/drivers/line.c
arch/um/drivers/line.h
arch/xtensa/platforms/iss/console.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/con3270.c
drivers/s390/char/sclp_tty.c
drivers/s390/char/sclp_vt220.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/rpmsg_tty.c
drivers/tty/serial/kgdb_nmi.c
drivers/tty/serial/serial_core.c
drivers/tty/synclink_gt.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_driver.h
net/bluetooth/rfcomm/tty.c

index dea3900..d6139db 100644 (file)
@@ -129,8 +129,8 @@ srmcons_do_write(struct tty_port *port, const char *buf, int count)
        return count;
 }
 
-static int
-srmcons_write(struct tty_struct *tty, const u8 *buf, int count)
+static ssize_t
+srmcons_write(struct tty_struct *tty, const u8 *buf, size_t count)
 {
        unsigned long flags;
 
index 87398f8..3a74d49 100644 (file)
@@ -70,7 +70,8 @@ static void nfcon_tty_close(struct tty_struct *tty, struct file *filp)
 {
 }
 
-static int nfcon_tty_write(struct tty_struct *tty, const u8 *buf, int count)
+static ssize_t nfcon_tty_write(struct tty_struct *tty, const u8 *buf,
+                              size_t count)
 {
        nfputs(buf, count);
        return count;
index e5393b4..b98545f 100644 (file)
@@ -184,7 +184,7 @@ void line_flush_chars(struct tty_struct *tty)
        line_flush_buffer(tty);
 }
 
-int line_write(struct tty_struct *tty, const u8 *buf, int len)
+ssize_t line_write(struct tty_struct *tty, const u8 *buf, size_t len)
 {
        struct line *line = tty->driver_data;
        unsigned long flags;
index 8354024..e84fb9b 100644 (file)
@@ -64,7 +64,7 @@ extern void line_cleanup(struct tty_struct *tty);
 extern void line_hangup(struct tty_struct *tty);
 extern int line_setup(char **conf, unsigned nlines, char **def,
                      char *init, char *name);
-extern int line_write(struct tty_struct *tty, const u8 *buf, int len);
+extern ssize_t line_write(struct tty_struct *tty, const u8 *buf, size_t len);
 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);
index 182ec57..7d1f8b3 100644 (file)
@@ -52,7 +52,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
 }
 
 
-static int rs_write(struct tty_struct * tty, const u8 *buf, int count)
+static ssize_t rs_write(struct tty_struct * tty, const u8 *buf, size_t count)
 {
        /* see drivers/char/serialX.c to reference original version */
 
index 4f3dd93..5af804c 100644 (file)
@@ -103,7 +103,7 @@ static void tpk_close(struct tty_struct *tty, struct file *filp)
 /*
  * TTY operations write function.
  */
-static int tpk_write(struct tty_struct *tty, const u8 *buf, int count)
+static ssize_t tpk_write(struct tty_struct *tty, const u8 *buf, size_t count)
 {
        struct ttyprintk_port *tpkp = tty->driver_data;
        unsigned long flags;
index c3cf086..da308be 100644 (file)
@@ -458,7 +458,8 @@ static inline int ipoctal_copy_write_buffer(struct ipoctal_channel *channel,
        return i;
 }
 
-static int ipoctal_write_tty(struct tty_struct *tty, const u8 *buf, int count)
+static ssize_t ipoctal_write_tty(struct tty_struct *tty, const u8 *buf,
+                                size_t count)
 {
        struct ipoctal_channel *channel = tty->driver_data;
        unsigned int char_copied;
index 2f38e1c..2f37895 100644 (file)
@@ -1077,12 +1077,13 @@ static void capinc_tty_close(struct tty_struct *tty, struct file *filp)
        tty_port_close(&mp->port, tty, filp);
 }
 
-static int capinc_tty_write(struct tty_struct *tty, const u8 *buf, int count)
+static ssize_t capinc_tty_write(struct tty_struct *tty, const u8 *buf,
+                               size_t count)
 {
        struct capiminor *mp = tty->driver_data;
        struct sk_buff *skb;
 
-       pr_debug("capinc_tty_write(count=%d)\n", count);
+       pr_debug("capinc_tty_write(count=%zu)\n", count);
 
        spin_lock_bh(&mp->outlock);
        skb = mp->outskb;
index 44851b6..2bce835 100644 (file)
@@ -186,7 +186,8 @@ static void bcm_vk_tty_doorbell(struct bcm_vk *vk, u32 db_val)
                  VK_BAR0_REGSEG_DB_BASE + VK_BAR0_REGSEG_TTY_DB_OFFSET);
 }
 
-static int bcm_vk_tty_write(struct tty_struct *tty, const u8 *buffer, int count)
+static ssize_t bcm_vk_tty_write(struct tty_struct *tty, const u8 *buffer,
+                               size_t count)
 {
        int index;
        struct bcm_vk *vk;
index 90d2fe0..ef38dcd 100644 (file)
@@ -760,7 +760,8 @@ static void sdio_uart_hangup(struct tty_struct *tty)
        tty_port_hangup(&port->port);
 }
 
-static int sdio_uart_write(struct tty_struct *tty, const u8 *buf, int count)
+static ssize_t sdio_uart_write(struct tty_struct *tty, const u8 *buf,
+                             size_t count)
 {
        struct sdio_uart_port *port = tty->driver_data;
        int ret;
index 014a9d2..3f424da 100644 (file)
@@ -1322,7 +1322,8 @@ static void hso_serial_close(struct tty_struct *tty, struct file *filp)
 }
 
 /* close the requested serial port */
-static int hso_serial_write(struct tty_struct *tty, const u8 *buf, int count)
+static ssize_t hso_serial_write(struct tty_struct *tty, const u8 *buf,
+                               size_t count)
 {
        struct hso_serial *serial = tty->driver_data;
        int space, tx_bytes;
index 8bbce6a..9936161 100644 (file)
@@ -1021,7 +1021,8 @@ static unsigned int tty3215_write_room(struct tty_struct *tty)
 /*
  * String write routine for 3215 ttys
  */
-static int tty3215_write(struct tty_struct *tty, const u8 *buf, int count)
+static ssize_t tty3215_write(struct tty_struct *tty, const u8 *buf,
+                            size_t count)
 {
        handle_write(tty->driver_data, buf, count);
        return count;
index 6374555..363315f 100644 (file)
@@ -1803,7 +1803,8 @@ static void tty3270_do_write(struct tty3270 *tp, struct tty_struct *tty,
 /*
  * String write routine for 3270 ttys
  */
-static int tty3270_write(struct tty_struct *tty, const u8 *buf, int count)
+static ssize_t tty3270_write(struct tty_struct *tty, const u8 *buf,
+                            size_t count)
 {
        struct tty3270 *tp;
 
index 831a8c7..892c18d 100644 (file)
@@ -229,8 +229,8 @@ out:
  * tty device. The characters may come from user space or kernel space. This
  * routine will return the number of characters actually accepted for writing.
  */
-static int
-sclp_tty_write(struct tty_struct *tty, const u8 *buf, int count)
+static ssize_t
+sclp_tty_write(struct tty_struct *tty, const u8 *buf, size_t count)
 {
        if (sclp_tty_chars_count > 0) {
                sclp_tty_write_string(sclp_tty_chars, sclp_tty_chars_count, 0);
index e148350..218ae60 100644 (file)
@@ -462,8 +462,8 @@ out:
  * user space or kernel space.  This routine will return the
  * number of characters actually accepted for writing.
  */
-static int
-sclp_vt220_write(struct tty_struct *tty, const u8 *buf, int count)
+static ssize_t
+sclp_vt220_write(struct tty_struct *tty, const u8 *buf, size_t count)
 {
        return __sclp_vt220_write(buf, count, 1, 0, 1);
 }
index ae9978b..b31f2af 100644 (file)
@@ -149,7 +149,7 @@ static void gdm_tty_send_complete(void *arg)
        tty_port_tty_wakeup(&gdm->port);
 }
 
-static int gdm_tty_write(struct tty_struct *tty, const u8 *buf, int len)
+static ssize_t gdm_tty_write(struct tty_struct *tty, const u8 *buf, size_t len)
 {
        struct gdm *gdm = tty->driver_data;
        int remain = len;
index 97c7ddd..999ce61 100644 (file)
@@ -427,7 +427,7 @@ static void gb_tty_hangup(struct tty_struct *tty)
        tty_port_hangup(&gb_tty->port);
 }
 
-static int gb_tty_write(struct tty_struct *tty, const u8 *buf, int count)
+static ssize_t gb_tty_write(struct tty_struct *tty, const u8 *buf, size_t count)
 {
        struct gb_tty *gb_tty = tty->driver_data;
 
index 91cf294..785558c 100644 (file)
@@ -741,7 +741,7 @@ static void rs_flush_chars(struct tty_struct *tty)
        local_irq_restore(flags);
 }
 
-static int rs_write(struct tty_struct * tty, const u8 *buf, int count)
+static ssize_t rs_write(struct tty_struct * tty, const u8 *buf, size_t count)
 {
        int     c, ret = 0;
        struct serial_state *info = tty->driver_data;
index de36347..a067628 100644 (file)
@@ -466,7 +466,8 @@ static irqreturn_t ehv_bc_tty_tx_isr(int irq, void *data)
  * ehv_bc_tty_write_room() will never lie, so the tty layer will never send us
  * too much data.
  */
-static int ehv_bc_tty_write(struct tty_struct *ttys, const u8 *s, int count)
+static ssize_t ehv_bc_tty_write(struct tty_struct *ttys, const u8 *s,
+                               size_t count)
 {
        struct ehv_bc_data *bc = ttys->driver_data;
        unsigned long flags;
index faa597f..4591f94 100644 (file)
@@ -185,7 +185,8 @@ static void goldfish_tty_hangup(struct tty_struct *tty)
        tty_port_hangup(tty->port);
 }
 
-static int goldfish_tty_write(struct tty_struct *tty, const u8 *buf, int count)
+static ssize_t goldfish_tty_write(struct tty_struct *tty, const u8 *buf,
+                                 size_t count)
 {
        goldfish_tty_do_write(tty->index, buf, count);
        return count;
index 4c60d15..e93e807 100644 (file)
@@ -496,7 +496,7 @@ static int hvc_push(struct hvc_struct *hp)
        return n;
 }
 
-static int hvc_write(struct tty_struct *tty, const u8 *buf, int count)
+static ssize_t hvc_write(struct tty_struct *tty, const u8 *buf, size_t count)
 {
        struct hvc_struct *hp = tty->driver_data;
        unsigned long flags;
index 2465d61..1de91fa 100644 (file)
@@ -1257,7 +1257,7 @@ static void hvcs_hangup(struct tty_struct * tty)
  * tty_hangup will allow hvcs_write time to complete execution before it
  * terminates our device.
  */
-static int hvcs_write(struct tty_struct *tty, const u8 *buf, int count)
+static ssize_t hvcs_write(struct tty_struct *tty, const u8 *buf, size_t count)
 {
        struct hvcs_struct *hvcsd = tty->driver_data;
        unsigned int unit_address;
@@ -1299,7 +1299,8 @@ static int hvcs_write(struct tty_struct *tty, const u8 *buf, int count)
        unit_address = hvcsd->vdev->unit_address;
 
        while (count > 0) {
-               tosend = min(count, (HVCS_BUFF_LEN - hvcsd->chars_in_buffer));
+               tosend = min_t(unsigned, count,
+                              (HVCS_BUFF_LEN - hvcsd->chars_in_buffer));
                /*
                 * No more space, this probably means that the last call to
                 * hvcs_write() didn't succeed and the buffer was filled up.
index 46dd62d..c57bd85 100644 (file)
@@ -904,7 +904,8 @@ static unsigned int hvsi_chars_in_buffer(struct tty_struct *tty)
        return hp->n_outbuf;
 }
 
-static int hvsi_write(struct tty_struct *tty, const u8 *source, int count)
+static ssize_t hvsi_write(struct tty_struct *tty, const u8 *source,
+                         size_t count)
 {
        struct hvsi_struct *hp = tty->driver_data;
        unsigned long flags;
index cd43208..b6de408 100644 (file)
@@ -186,7 +186,8 @@ static void ipw_write_packet_sent_callback(void *callback_data,
        tty->tx_bytes_queued -= packet_length;
 }
 
-static int ipw_write(struct tty_struct *linux_tty, const u8 *buf, int count)
+static ssize_t ipw_write(struct tty_struct *linux_tty, const u8 *buf,
+                        size_t count)
 {
        struct ipw_tty *tty = linux_tty->driver_data;
        int room, ret;
index cf4ef0c..369ec71 100644 (file)
@@ -796,8 +796,8 @@ static void mips_ejtag_fdc_tty_hangup(struct tty_struct *tty)
        tty_port_hangup(tty->port);
 }
 
-static int mips_ejtag_fdc_tty_write(struct tty_struct *tty, const u8 *buf,
-                                   int total)
+static ssize_t mips_ejtag_fdc_tty_write(struct tty_struct *tty, const u8 *buf,
+                                       size_t total)
 {
        int count, block;
        struct mips_ejtag_fdc_tty_port *dport = tty->driver_data;
@@ -816,7 +816,7 @@ static int mips_ejtag_fdc_tty_write(struct tty_struct *tty, const u8 *buf,
         */
        spin_lock(&dport->xmit_lock);
        /* Work out how many bytes we can write to the xmit buffer */
-       total = min(total, (int)(priv->xmit_size - dport->xmit_cnt));
+       total = min_t(size_t, total, priv->xmit_size - dport->xmit_cnt);
        atomic_add(total, &priv->xmit_total);
        dport->xmit_cnt += total;
        /* Write the actual bytes (may need splitting if it wraps) */
index d94cf1b..bf3f87b 100644 (file)
@@ -487,7 +487,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 u8 *, int);
+static ssize_t moxa_write(struct tty_struct *, const u8 *, size_t);
 static unsigned int moxa_write_room(struct tty_struct *);
 static void moxa_flush_buffer(struct tty_struct *);
 static unsigned int moxa_chars_in_buffer(struct tty_struct *);
@@ -1499,7 +1499,7 @@ static void moxa_close(struct tty_struct *tty, struct file *filp)
        tty_port_close(&ch->port, tty, filp);
 }
 
-static int moxa_write(struct tty_struct *tty, const u8 *buf, int count)
+static ssize_t moxa_write(struct tty_struct *tty, const u8 *buf, size_t count)
 {
        struct moxa_port *ch = tty->driver_data;
        unsigned long flags;
index a5dfd08..10aa4ed 100644 (file)
@@ -901,7 +901,7 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)
        tty_port_close(tty->port, tty, filp);
 }
 
-static int mxser_write(struct tty_struct *tty, const u8 *buf, int count)
+static ssize_t mxser_write(struct tty_struct *tty, const u8 *buf, size_t count)
 {
        struct mxser_port *info = tty->driver_data;
        unsigned long flags;
index d167e36..3e5cc30 100644 (file)
@@ -4256,7 +4256,7 @@ static void gsmtty_hangup(struct tty_struct *tty)
        gsm_dlci_begin_close(dlci);
 }
 
-static int gsmtty_write(struct tty_struct *tty, const u8 *buf, int len)
+static ssize_t gsmtty_write(struct tty_struct *tty, const u8 *buf, size_t len)
 {
        int sent;
        struct gsm_dlci *dlci = tty->driver_data;
index b375640..02cd401 100644 (file)
@@ -1599,7 +1599,8 @@ static void ntty_hangup(struct tty_struct *tty)
  * called when the userspace process writes to the tty (/dev/noz*).
  * Data is inserted into a fifo, which is then read and transferred to the modem.
  */
-static int ntty_write(struct tty_struct *tty, const u8 *buffer, int count)
+static ssize_t ntty_write(struct tty_struct *tty, const u8 *buffer,
+                         size_t count)
 {
        int rval = -EINVAL;
        struct nozomi *dc = get_dc_by_tty(tty);
index 335f574..df08f13 100644 (file)
@@ -108,7 +108,7 @@ static void pty_unthrottle(struct tty_struct *tty)
  *     the other side of the pty/tty pair.
  */
 
-static int pty_write(struct tty_struct *tty, const u8 *buf, int c)
+static ssize_t pty_write(struct tty_struct *tty, const u8 *buf, size_t c)
 {
        struct tty_struct *to = tty->link;
 
index 29db413..60a2915 100644 (file)
@@ -73,7 +73,8 @@ static void rpmsg_tty_close(struct tty_struct *tty, struct file *filp)
        return tty_port_close(tty->port, tty, filp);
 }
 
-static int rpmsg_tty_write(struct tty_struct *tty, const u8 *buf, int len)
+static ssize_t rpmsg_tty_write(struct tty_struct *tty, const u8 *buf,
+                              size_t len)
 {
        struct rpmsg_tty_port *cport = tty->driver_data;
        struct rpmsg_device *rpdev;
@@ -86,7 +87,7 @@ static int rpmsg_tty_write(struct tty_struct *tty, const u8 *buf, int len)
        if (msg_max_size < 0)
                return msg_max_size;
 
-       msg_size = min(len, msg_max_size);
+       msg_size = min_t(unsigned int, len, msg_max_size);
 
        /*
         * Use rpmsg_trysend instead of rpmsg_send to send the message so the caller is not
index 2a04d19..e93850f 100644 (file)
@@ -304,7 +304,8 @@ static unsigned int kgdb_nmi_tty_write_room(struct tty_struct *tty)
        return 2048;
 }
 
-static int kgdb_nmi_tty_write(struct tty_struct *tty, const u8 *buf, int c)
+static ssize_t kgdb_nmi_tty_write(struct tty_struct *tty, const u8 *buf,
+                                 size_t c)
 {
        int i;
 
index d5b682f..7bdc21d 100644 (file)
@@ -580,7 +580,7 @@ static void uart_flush_chars(struct tty_struct *tty)
        uart_start(tty);
 }
 
-static int uart_write(struct tty_struct *tty, const u8 *buf, int count)
+static ssize_t uart_write(struct tty_struct *tty, const u8 *buf, size_t count)
 {
        struct uart_state *state = tty->driver_data;
        struct uart_port *port;
index 0264e9f..8112d9d 100644 (file)
@@ -745,7 +745,7 @@ static void update_tx_timer(struct slgt_info *info)
        }
 }
 
-static int write(struct tty_struct *tty, const u8 *buf, int count)
+static ssize_t write(struct tty_struct *tty, const u8 *buf, size_t count)
 {
        int ret = 0;
        struct slgt_info *info = tty->driver_data;
@@ -754,7 +754,7 @@ static int write(struct tty_struct *tty, const u8 *buf, int count)
        if (sanity_check(info, tty->name, "write"))
                return -EIO;
 
-       DBGINFO(("%s write count=%d\n", info->device_name, count));
+       DBGINFO(("%s write count=%zu\n", info->device_name, count));
 
        if (!info->tx_buf || (count > info->max_frame_size))
                return -EIO;
index 6b74eba..e4c4273 100644 (file)
@@ -29,7 +29,8 @@ static void ttynull_hangup(struct tty_struct *tty)
        tty_port_hangup(&ttynull_port);
 }
 
-static int ttynull_write(struct tty_struct *tty, const u8 *buf, int count)
+static ssize_t ttynull_write(struct tty_struct *tty, const u8 *buf,
+                            size_t count)
 {
        return count;
 }
index c223879..9cc5691 100644 (file)
@@ -804,7 +804,7 @@ static void vcc_hangup(struct tty_struct *tty)
        tty_port_hangup(tty->port);
 }
 
-static int vcc_write(struct tty_struct *tty, const u8 *buf, int count)
+static ssize_t vcc_write(struct tty_struct *tty, const u8 *buf, size_t count)
 {
        struct vcc_port *port;
        struct vio_vcc *pkt;
@@ -826,7 +826,8 @@ static int vcc_write(struct tty_struct *tty, const u8 *buf, int count)
 
        while (count > 0) {
                /* Minimum of data to write and space available */
-               tosend = min(count, (VCC_BUFF_LEN - port->chars_in_buffer));
+               tosend = min_t(size_t, count,
+                              (VCC_BUFF_LEN - port->chars_in_buffer));
 
                if (!tosend)
                        break;
index ea7c20d..5c47f77 100644 (file)
@@ -3238,7 +3238,7 @@ int tioclinux(struct tty_struct *tty, unsigned long arg)
  * /dev/ttyN handling
  */
 
-static int con_write(struct tty_struct *tty, const u8 *buf, int count)
+static ssize_t con_write(struct tty_struct *tty, const u8 *buf, size_t count)
 {
        int     retval;
 
index 913b07b..3591880 100644 (file)
@@ -789,7 +789,8 @@ static void acm_tty_close(struct tty_struct *tty, struct file *filp)
        tty_port_close(&acm->port, tty, filp);
 }
 
-static int acm_tty_write(struct tty_struct *tty, const u8 *buf, int count)
+static ssize_t acm_tty_write(struct tty_struct *tty, const u8 *buf,
+                            size_t count)
 {
        struct acm *acm = tty->driver_data;
        int stat;
@@ -800,7 +801,7 @@ static int acm_tty_write(struct tty_struct *tty, const u8 *buf, int count)
        if (!count)
                return 0;
 
-       dev_vdbg(&acm->data->dev, "%d bytes from tty layer\n", count);
+       dev_vdbg(&acm->data->dev, "%zu bytes from tty layer\n", count);
 
        spin_lock_irqsave(&acm->write_lock, flags);
        wbn = acm_wb_alloc(acm);
@@ -817,7 +818,7 @@ static int acm_tty_write(struct tty_struct *tty, const u8 *buf, int count)
        }
 
        count = (count > acm->writesize) ? acm->writesize : count;
-       dev_vdbg(&acm->data->dev, "writing %d bytes\n", count);
+       dev_vdbg(&acm->data->dev, "writing %zu bytes\n", count);
        memcpy(wb->buf, buf, count);
        wb->len = count;
 
index 3e6b750..a92eb6d 100644 (file)
@@ -734,12 +734,12 @@ exit:
        spin_unlock_irq(&port->port_lock);
 }
 
-static int gs_write(struct tty_struct *tty, const u8 *buf, int count)
+static ssize_t gs_write(struct tty_struct *tty, const u8 *buf, size_t count)
 {
        struct gs_port  *port = tty->driver_data;
        unsigned long   flags;
 
-       pr_vdebug("gs_write: ttyGS%d (%p) writing %d bytes\n",
+       pr_vdebug("gs_write: ttyGS%d (%p) writing %zu bytes\n",
                        port->port_num, tty, count);
 
        spin_lock_irqsave(&port->port_lock, flags);
index 5b82bdd..b74e98e 100644 (file)
@@ -208,7 +208,8 @@ static void dbc_tty_close(struct tty_struct *tty, struct file *file)
        tty_port_close(&port->port, tty, file);
 }
 
-static int dbc_tty_write(struct tty_struct *tty, const u8 *buf, int count)
+static ssize_t dbc_tty_write(struct tty_struct *tty, const u8 *buf,
+                            size_t count)
 {
        struct dbc_port         *port = tty->driver_data;
        unsigned long           flags;
index 51f738e..17b09f0 100644 (file)
@@ -361,7 +361,7 @@ static void serial_cleanup(struct tty_struct *tty)
        module_put(owner);
 }
 
-static int serial_write(struct tty_struct *tty, const u8 *buf, int count)
+static ssize_t serial_write(struct tty_struct *tty, const u8 *buf, size_t count)
 {
        struct usb_serial_port *port = tty->driver_data;
        int retval = -ENODEV;
@@ -369,7 +369,7 @@ static int serial_write(struct tty_struct *tty, const u8 *buf, int count)
        if (port->serial->dev->state == USB_STATE_NOTATTACHED)
                goto exit;
 
-       dev_dbg(&port->dev, "%s - %d byte(s)\n", __func__, count);
+       dev_dbg(&port->dev, "%s - %zu byte(s)\n", __func__, count);
 
        retval = port->serial->type->write(tty, port, buf, count);
        if (retval < 0)
index c5299d9..18beff0 100644 (file)
@@ -72,8 +72,8 @@ struct serial_struct;
  *     is closed for the last time freeing up the resources. This is
  *     actually the second part of shutdown for routines that might sleep.
  *
- * @write: ``int ()(struct tty_struct *tty, const unsigned char *buf,
- *                 int count)``
+ * @write: ``ssize_t ()(struct tty_struct *tty, const unsigned char *buf,
+ *                 size_t count)``
  *
  *     This routine is called by the kernel to write a series (@count) of
  *     characters (@buf) to the @tty device. The characters may come from
@@ -356,7 +356,7 @@ struct tty_operations {
        void (*close)(struct tty_struct * tty, struct file * filp);
        void (*shutdown)(struct tty_struct *tty);
        void (*cleanup)(struct tty_struct *tty);
-       int  (*write)(struct tty_struct *tty, const u8 *buf, int count);
+       ssize_t (*write)(struct tty_struct *tty, const u8 *buf, size_t count);
        int  (*put_char)(struct tty_struct *tty, u8 ch);
        void (*flush_chars)(struct tty_struct *tty);
        unsigned int (*write_room)(struct tty_struct *tty);
index 3b5f840..33b135e 100644 (file)
@@ -779,14 +779,15 @@ static void rfcomm_tty_close(struct tty_struct *tty, struct file *filp)
        tty_port_close(&dev->port, tty, filp);
 }
 
-static int rfcomm_tty_write(struct tty_struct *tty, const u8 *buf, int count)
+static ssize_t rfcomm_tty_write(struct tty_struct *tty, const u8 *buf,
+                               size_t count)
 {
        struct rfcomm_dev *dev = tty->driver_data;
        struct rfcomm_dlc *dlc = dev->dlc;
        struct sk_buff *skb;
        int sent = 0, size;
 
-       BT_DBG("tty %p count %d", tty, count);
+       BT_DBG("tty %p count %zu", tty, count);
 
        while (count) {
                size = min_t(uint, count, dlc->mtu);