summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Slaby (SUSE) <jirislaby@kernel.org>2023-08-10 11:15:07 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-08-11 21:12:47 +0200
commitcfc7c12b508ac0a4ebf20a187e471e5b1dc6402c (patch)
tree78219f93125bcfcadfdd905c72cbd2c9b0dcb2eb
parent8428e5223ea2e195f5790bff770b804f3918f3f4 (diff)
downloadlinux-stable-cfc7c12b508ac0a4ebf20a187e471e5b1dc6402c.tar.gz
linux-stable-cfc7c12b508ac0a4ebf20a187e471e5b1dc6402c.tar.bz2
linux-stable-cfc7c12b508ac0a4ebf20a187e471e5b1dc6402c.zip
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>
-rw-r--r--arch/sparc/include/asm/vio.h2
-rw-r--r--drivers/tty/vcc.c12
2 files changed, 7 insertions, 7 deletions
diff --git a/arch/sparc/include/asm/vio.h b/arch/sparc/include/asm/vio.h
index 8a0c3c11c9ce..587fb7841096 100644
--- a/arch/sparc/include/asm/vio.h
+++ b/arch/sparc/include/asm/vio.h
@@ -284,7 +284,7 @@ struct vio_dring_state {
struct ldc_trans_cookie cookies[VIO_MAX_RING_COOKIES];
};
-#define VIO_TAG_SIZE ((int)sizeof(struct vio_msg_tag))
+#define VIO_TAG_SIZE (sizeof(struct vio_msg_tag))
#define VIO_VCC_MTU_SIZE (LDC_PACKET_SIZE - VIO_TAG_SIZE)
struct vio_vcc {
diff --git a/drivers/tty/vcc.c b/drivers/tty/vcc.c
index 9cc569174c83..a39ed981bfd3 100644
--- a/drivers/tty/vcc.c
+++ b/drivers/tty/vcc.c
@@ -36,7 +36,7 @@ struct vcc_port {
* and guarantee that any characters that the driver accepts will
* be eventually sent, either immediately or later.
*/
- int chars_in_buffer;
+ size_t chars_in_buffer;
struct vio_vcc buffer;
struct timer_list rx_timer;
@@ -385,7 +385,7 @@ static void vcc_tx_timer(struct timer_list *t)
struct vcc_port *port = from_timer(port, t, tx_timer);
struct vio_vcc *pkt;
unsigned long flags;
- int tosend = 0;
+ size_t tosend = 0;
int rv;
spin_lock_irqsave(&port->lock, flags);
@@ -809,8 +809,8 @@ static ssize_t vcc_write(struct tty_struct *tty, const u8 *buf, size_t count)
struct vcc_port *port;
struct vio_vcc *pkt;
unsigned long flags;
- int total_sent = 0;
- int tosend = 0;
+ size_t total_sent = 0;
+ size_t tosend = 0;
int rv = -EINVAL;
port = vcc_get_ne(tty->index);
@@ -847,7 +847,7 @@ static ssize_t vcc_write(struct tty_struct *tty, const u8 *buf, size_t count)
* hypervisor actually took it because we have it buffered.
*/
rv = ldc_write(port->vio.lp, pkt, (VIO_TAG_SIZE + tosend));
- vccdbg("VCC: write: ldc_write(%d)=%d\n",
+ vccdbg("VCC: write: ldc_write(%zu)=%d\n",
(VIO_TAG_SIZE + tosend), rv);
total_sent += tosend;
@@ -864,7 +864,7 @@ static ssize_t vcc_write(struct tty_struct *tty, const u8 *buf, size_t count)
vcc_put(port, false);
- vccdbg("VCC: write: total=%d rv=%d", total_sent, rv);
+ vccdbg("VCC: write: total=%zu rv=%d", total_sent, rv);
return total_sent ? total_sent : rv;
}