Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tty: vcc: convert counts to size_t

Unify the type of tty_operations::write() counters with the 'count'
parameter. I.e. use size_t for them.

This includes changing vcc_port::chars_in_buffer to size_t to keep min()
and avoid min_t().

Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>
Link: https://lore.kernel.org/r/20230810091510.13006-34-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jiri Slaby (SUSE) and committed by
Greg Kroah-Hartman
cfc7c12b 8428e522

+7 -7
+1 -1
arch/sparc/include/asm/vio.h
··· 284 284 struct ldc_trans_cookie cookies[VIO_MAX_RING_COOKIES]; 285 285 }; 286 286 287 - #define VIO_TAG_SIZE ((int)sizeof(struct vio_msg_tag)) 287 + #define VIO_TAG_SIZE (sizeof(struct vio_msg_tag)) 288 288 #define VIO_VCC_MTU_SIZE (LDC_PACKET_SIZE - VIO_TAG_SIZE) 289 289 290 290 struct vio_vcc {
+6 -6
drivers/tty/vcc.c
··· 36 36 * and guarantee that any characters that the driver accepts will 37 37 * be eventually sent, either immediately or later. 38 38 */ 39 - int chars_in_buffer; 39 + size_t chars_in_buffer; 40 40 struct vio_vcc buffer; 41 41 42 42 struct timer_list rx_timer; ··· 385 385 struct vcc_port *port = from_timer(port, t, tx_timer); 386 386 struct vio_vcc *pkt; 387 387 unsigned long flags; 388 - int tosend = 0; 388 + size_t tosend = 0; 389 389 int rv; 390 390 391 391 spin_lock_irqsave(&port->lock, flags); ··· 809 809 struct vcc_port *port; 810 810 struct vio_vcc *pkt; 811 811 unsigned long flags; 812 - int total_sent = 0; 813 - int tosend = 0; 812 + size_t total_sent = 0; 813 + size_t tosend = 0; 814 814 int rv = -EINVAL; 815 815 816 816 port = vcc_get_ne(tty->index); ··· 847 847 * hypervisor actually took it because we have it buffered. 848 848 */ 849 849 rv = ldc_write(port->vio.lp, pkt, (VIO_TAG_SIZE + tosend)); 850 - vccdbg("VCC: write: ldc_write(%d)=%d\n", 850 + vccdbg("VCC: write: ldc_write(%zu)=%d\n", 851 851 (VIO_TAG_SIZE + tosend), rv); 852 852 853 853 total_sent += tosend; ··· 864 864 865 865 vcc_put(port, false); 866 866 867 - vccdbg("VCC: write: total=%d rv=%d", total_sent, rv); 867 + vccdbg("VCC: write: total=%zu rv=%d", total_sent, rv); 868 868 869 869 return total_sent ? total_sent : rv; 870 870 }