1

tty: make tty_operations::write()'s count size_t

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>
This commit is contained in:
Jiri Slaby (SUSE) 2023-08-10 11:15:03 +02:00 committed by Greg Kroah-Hartman
parent dcaafbe6ee
commit 95713967ba
43 changed files with 82 additions and 61 deletions

View File

@ -129,8 +129,8 @@ srmcons_do_write(struct tty_port *port, const char *buf, int count)
return count; return count;
} }
static int static ssize_t
srmcons_write(struct tty_struct *tty, const u8 *buf, int count) srmcons_write(struct tty_struct *tty, const u8 *buf, size_t count)
{ {
unsigned long flags; unsigned long flags;

View 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); nfputs(buf, count);
return count; return count;

View File

@ -184,7 +184,7 @@ void line_flush_chars(struct tty_struct *tty)
line_flush_buffer(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; struct line *line = tty->driver_data;
unsigned long flags; unsigned long flags;

View File

@ -64,7 +64,7 @@ extern void line_cleanup(struct tty_struct *tty);
extern void line_hangup(struct tty_struct *tty); extern void line_hangup(struct tty_struct *tty);
extern int line_setup(char **conf, unsigned nlines, char **def, extern int line_setup(char **conf, unsigned nlines, char **def,
char *init, char *name); 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 unsigned int line_chars_in_buffer(struct tty_struct *tty);
extern void line_flush_buffer(struct tty_struct *tty); extern void line_flush_buffer(struct tty_struct *tty);
extern void line_flush_chars(struct tty_struct *tty); extern void line_flush_chars(struct tty_struct *tty);

View 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 */ /* see drivers/char/serialX.c to reference original version */

View File

@ -103,7 +103,7 @@ static void tpk_close(struct tty_struct *tty, struct file *filp)
/* /*
* TTY operations write function. * 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; struct ttyprintk_port *tpkp = tty->driver_data;
unsigned long flags; unsigned long flags;

View File

@ -458,7 +458,8 @@ static inline int ipoctal_copy_write_buffer(struct ipoctal_channel *channel,
return i; 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; struct ipoctal_channel *channel = tty->driver_data;
unsigned int char_copied; unsigned int char_copied;

View File

@ -1077,12 +1077,13 @@ static void capinc_tty_close(struct tty_struct *tty, struct file *filp)
tty_port_close(&mp->port, tty, 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 capiminor *mp = tty->driver_data;
struct sk_buff *skb; 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); spin_lock_bh(&mp->outlock);
skb = mp->outskb; skb = mp->outskb;

View 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); 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; int index;
struct bcm_vk *vk; struct bcm_vk *vk;

View File

@ -760,7 +760,8 @@ static void sdio_uart_hangup(struct tty_struct *tty)
tty_port_hangup(&port->port); 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; struct sdio_uart_port *port = tty->driver_data;
int ret; int ret;

View File

@ -1322,7 +1322,8 @@ static void hso_serial_close(struct tty_struct *tty, struct file *filp)
} }
/* close the requested serial port */ /* 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; struct hso_serial *serial = tty->driver_data;
int space, tx_bytes; int space, tx_bytes;

View File

@ -1021,7 +1021,8 @@ static unsigned int tty3215_write_room(struct tty_struct *tty)
/* /*
* String write routine for 3215 ttys * 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); handle_write(tty->driver_data, buf, count);
return count; return count;

View File

@ -1803,7 +1803,8 @@ static void tty3270_do_write(struct tty3270 *tp, struct tty_struct *tty,
/* /*
* String write routine for 3270 ttys * 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; struct tty3270 *tp;

View File

@ -229,8 +229,8 @@ out:
* tty device. The characters may come from user space or kernel space. This * tty device. The characters may come from user space or kernel space. This
* routine will return the number of characters actually accepted for writing. * routine will return the number of characters actually accepted for writing.
*/ */
static int static ssize_t
sclp_tty_write(struct tty_struct *tty, const u8 *buf, int count) sclp_tty_write(struct tty_struct *tty, const u8 *buf, size_t count)
{ {
if (sclp_tty_chars_count > 0) { if (sclp_tty_chars_count > 0) {
sclp_tty_write_string(sclp_tty_chars, sclp_tty_chars_count, 0); sclp_tty_write_string(sclp_tty_chars, sclp_tty_chars_count, 0);

View File

@ -462,8 +462,8 @@ out:
* user space or kernel space. This routine will return the * user space or kernel space. This routine will return the
* number of characters actually accepted for writing. * number of characters actually accepted for writing.
*/ */
static int static ssize_t
sclp_vt220_write(struct tty_struct *tty, const u8 *buf, int count) sclp_vt220_write(struct tty_struct *tty, const u8 *buf, size_t count)
{ {
return __sclp_vt220_write(buf, count, 1, 0, 1); return __sclp_vt220_write(buf, count, 1, 0, 1);
} }

View File

@ -149,7 +149,7 @@ static void gdm_tty_send_complete(void *arg)
tty_port_tty_wakeup(&gdm->port); 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; struct gdm *gdm = tty->driver_data;
int remain = len; int remain = len;

View File

@ -427,7 +427,7 @@ static void gb_tty_hangup(struct tty_struct *tty)
tty_port_hangup(&gb_tty->port); 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; struct gb_tty *gb_tty = tty->driver_data;

View File

@ -741,7 +741,7 @@ static void rs_flush_chars(struct tty_struct *tty)
local_irq_restore(flags); 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; int c, ret = 0;
struct serial_state *info = tty->driver_data; struct serial_state *info = tty->driver_data;

View 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 * ehv_bc_tty_write_room() will never lie, so the tty layer will never send us
* too much data. * 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; struct ehv_bc_data *bc = ttys->driver_data;
unsigned long flags; unsigned long flags;

View File

@ -185,7 +185,8 @@ static void goldfish_tty_hangup(struct tty_struct *tty)
tty_port_hangup(tty->port); 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); goldfish_tty_do_write(tty->index, buf, count);
return count; return count;

View File

@ -496,7 +496,7 @@ static int hvc_push(struct hvc_struct *hp)
return n; 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; struct hvc_struct *hp = tty->driver_data;
unsigned long flags; unsigned long flags;

View 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 * tty_hangup will allow hvcs_write time to complete execution before it
* terminates our device. * 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; struct hvcs_struct *hvcsd = tty->driver_data;
unsigned int unit_address; 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; unit_address = hvcsd->vdev->unit_address;
while (count > 0) { 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 * No more space, this probably means that the last call to
* hvcs_write() didn't succeed and the buffer was filled up. * hvcs_write() didn't succeed and the buffer was filled up.

View File

@ -904,7 +904,8 @@ static unsigned int hvsi_chars_in_buffer(struct tty_struct *tty)
return hp->n_outbuf; 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; struct hvsi_struct *hp = tty->driver_data;
unsigned long flags; unsigned long flags;

View File

@ -186,7 +186,8 @@ static void ipw_write_packet_sent_callback(void *callback_data,
tty->tx_bytes_queued -= packet_length; 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; struct ipw_tty *tty = linux_tty->driver_data;
int room, ret; int room, ret;

View File

@ -796,8 +796,8 @@ static void mips_ejtag_fdc_tty_hangup(struct tty_struct *tty)
tty_port_hangup(tty->port); tty_port_hangup(tty->port);
} }
static int mips_ejtag_fdc_tty_write(struct tty_struct *tty, const u8 *buf, static ssize_t mips_ejtag_fdc_tty_write(struct tty_struct *tty, const u8 *buf,
int total) size_t total)
{ {
int count, block; int count, block;
struct mips_ejtag_fdc_tty_port *dport = tty->driver_data; 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); spin_lock(&dport->xmit_lock);
/* Work out how many bytes we can write to the xmit buffer */ /* 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); atomic_add(total, &priv->xmit_total);
dport->xmit_cnt += total; dport->xmit_cnt += total;
/* Write the actual bytes (may need splitting if it wraps) */ /* Write the actual bytes (may need splitting if it wraps) */

View File

@ -487,7 +487,7 @@ module_param(ttymajor, int, 0);
*/ */
static int moxa_open(struct tty_struct *, struct file *); static int moxa_open(struct tty_struct *, struct file *);
static void moxa_close(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 unsigned int moxa_write_room(struct tty_struct *);
static void moxa_flush_buffer(struct tty_struct *); static void moxa_flush_buffer(struct tty_struct *);
static unsigned int moxa_chars_in_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); 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; struct moxa_port *ch = tty->driver_data;
unsigned long flags; unsigned long flags;

View File

@ -901,7 +901,7 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)
tty_port_close(tty->port, tty, 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; struct mxser_port *info = tty->driver_data;
unsigned long flags; unsigned long flags;

View File

@ -4256,7 +4256,7 @@ static void gsmtty_hangup(struct tty_struct *tty)
gsm_dlci_begin_close(dlci); 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; int sent;
struct gsm_dlci *dlci = tty->driver_data; struct gsm_dlci *dlci = tty->driver_data;

View File

@ -1599,7 +1599,8 @@ static void ntty_hangup(struct tty_struct *tty)
* called when the userspace process writes to the tty (/dev/noz*). * 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. * 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; int rval = -EINVAL;
struct nozomi *dc = get_dc_by_tty(tty); struct nozomi *dc = get_dc_by_tty(tty);

View File

@ -108,7 +108,7 @@ static void pty_unthrottle(struct tty_struct *tty)
* the other side of the pty/tty pair. * 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; struct tty_struct *to = tty->link;

View 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); 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_tty_port *cport = tty->driver_data;
struct rpmsg_device *rpdev; 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) if (msg_max_size < 0)
return msg_max_size; 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 * Use rpmsg_trysend instead of rpmsg_send to send the message so the caller is not

View File

@ -304,7 +304,8 @@ static unsigned int kgdb_nmi_tty_write_room(struct tty_struct *tty)
return 2048; 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; int i;

View File

@ -580,7 +580,7 @@ static void uart_flush_chars(struct tty_struct *tty)
uart_start(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_state *state = tty->driver_data;
struct uart_port *port; struct uart_port *port;

View 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; int ret = 0;
struct slgt_info *info = tty->driver_data; 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")) if (sanity_check(info, tty->name, "write"))
return -EIO; 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)) if (!info->tx_buf || (count > info->max_frame_size))
return -EIO; return -EIO;

View File

@ -29,7 +29,8 @@ static void ttynull_hangup(struct tty_struct *tty)
tty_port_hangup(&ttynull_port); 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; return count;
} }

View File

@ -804,7 +804,7 @@ static void vcc_hangup(struct tty_struct *tty)
tty_port_hangup(tty->port); 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 vcc_port *port;
struct vio_vcc *pkt; struct vio_vcc *pkt;
@ -826,7 +826,8 @@ static int vcc_write(struct tty_struct *tty, const u8 *buf, int count)
while (count > 0) { while (count > 0) {
/* Minimum of data to write and space available */ /* 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) if (!tosend)
break; break;

View File

@ -3238,7 +3238,7 @@ int tioclinux(struct tty_struct *tty, unsigned long arg)
* /dev/ttyN handling * /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; int retval;

View File

@ -789,7 +789,8 @@ static void acm_tty_close(struct tty_struct *tty, struct file *filp)
tty_port_close(&acm->port, tty, 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; struct acm *acm = tty->driver_data;
int stat; int stat;
@ -800,7 +801,7 @@ static int acm_tty_write(struct tty_struct *tty, const u8 *buf, int count)
if (!count) if (!count)
return 0; 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); spin_lock_irqsave(&acm->write_lock, flags);
wbn = acm_wb_alloc(acm); 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; 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); memcpy(wb->buf, buf, count);
wb->len = count; wb->len = count;

View File

@ -734,12 +734,12 @@ exit:
spin_unlock_irq(&port->port_lock); 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; struct gs_port *port = tty->driver_data;
unsigned long flags; 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); port->port_num, tty, count);
spin_lock_irqsave(&port->port_lock, flags); spin_lock_irqsave(&port->port_lock, flags);

View File

@ -208,7 +208,8 @@ static void dbc_tty_close(struct tty_struct *tty, struct file *file)
tty_port_close(&port->port, tty, 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; struct dbc_port *port = tty->driver_data;
unsigned long flags; unsigned long flags;

View File

@ -361,7 +361,7 @@ static void serial_cleanup(struct tty_struct *tty)
module_put(owner); 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; struct usb_serial_port *port = tty->driver_data;
int retval = -ENODEV; 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) if (port->serial->dev->state == USB_STATE_NOTATTACHED)
goto exit; 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); retval = port->serial->type->write(tty, port, buf, count);
if (retval < 0) if (retval < 0)

View File

@ -72,8 +72,8 @@ struct serial_struct;
* is closed for the last time freeing up the resources. This is * is closed for the last time freeing up the resources. This is
* actually the second part of shutdown for routines that might sleep. * actually the second part of shutdown for routines that might sleep.
* *
* @write: ``int ()(struct tty_struct *tty, const unsigned char *buf, * @write: ``ssize_t ()(struct tty_struct *tty, const unsigned char *buf,
* int count)`` * size_t count)``
* *
* This routine is called by the kernel to write a series (@count) of * This routine is called by the kernel to write a series (@count) of
* characters (@buf) to the @tty device. The characters may come from * 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 (*close)(struct tty_struct * tty, struct file * filp);
void (*shutdown)(struct tty_struct *tty); void (*shutdown)(struct tty_struct *tty);
void (*cleanup)(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); int (*put_char)(struct tty_struct *tty, u8 ch);
void (*flush_chars)(struct tty_struct *tty); void (*flush_chars)(struct tty_struct *tty);
unsigned int (*write_room)(struct tty_struct *tty); unsigned int (*write_room)(struct tty_struct *tty);

View File

@ -779,14 +779,15 @@ static void rfcomm_tty_close(struct tty_struct *tty, struct file *filp)
tty_port_close(&dev->port, tty, 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_dev *dev = tty->driver_data;
struct rfcomm_dlc *dlc = dev->dlc; struct rfcomm_dlc *dlc = dev->dlc;
struct sk_buff *skb; struct sk_buff *skb;
int sent = 0, size; int sent = 0, size;
BT_DBG("tty %p count %d", tty, count); BT_DBG("tty %p count %zu", tty, count);
while (count) { while (count) {
size = min_t(uint, count, dlc->mtu); size = min_t(uint, count, dlc->mtu);