From: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
To: gregkh@linuxfoundation.org
Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
"Jiri Slaby (SUSE)" <jirislaby@kernel.org>,
"David S. Miller" <davem@davemloft.net>
Subject: [PATCH 33/36] tty: vcc: convert counts to size_t
Date: Thu, 10 Aug 2023 11:15:07 +0200 [thread overview]
Message-ID: <20230810091510.13006-34-jirislaby@kernel.org> (raw)
In-Reply-To: <20230810091510.13006-1-jirislaby@kernel.org>
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>
---
arch/sparc/include/asm/vio.h | 2 +-
drivers/tty/vcc.c | 12 ++++++------
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;
}
--
2.41.0
next prev parent reply other threads:[~2023-08-10 9:28 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-10 9:14 [PATCH 00/36] tty: type unifications -- part I Jiri Slaby (SUSE)
2023-08-10 9:14 ` [PATCH 01/36] tty: xtensa/iss: drop unneeded tty_operations hooks Jiri Slaby (SUSE)
2023-08-10 12:37 ` Max Filippov
2023-08-10 9:14 ` [PATCH 02/36] tty: ldisc: document that ldops are optional Jiri Slaby (SUSE)
2023-08-10 9:14 ` [PATCH 03/36] tty: remove dummy tty_ldisc_ops::poll() implementations Jiri Slaby (SUSE)
2023-08-10 9:14 ` [PATCH 04/36] tty: n_null: remove optional ldops Jiri Slaby (SUSE)
2023-08-10 9:14 ` [PATCH 05/36] tty: change tty_write_lock()'s ndelay parameter to bool Jiri Slaby (SUSE)
2023-08-10 9:14 ` [PATCH 06/36] tty: tty_port: rename 'disc' to 'ld' Jiri Slaby (SUSE)
2023-08-10 9:14 ` [PATCH 07/36] tty: drop tty_debug_wait_until_sent() Jiri Slaby (SUSE)
2023-08-10 9:14 ` [PATCH 08/36] tty: make tty_change_softcar() more understandable Jiri Slaby (SUSE)
2023-08-10 9:14 ` [PATCH 09/36] tty: make tty_port_client_operations operate with u8 Jiri Slaby (SUSE)
2023-08-10 9:14 ` [PATCH 10/36] tty: make counts in tty_port_client_operations hooks size_t Jiri Slaby (SUSE)
2023-08-10 9:14 ` [PATCH 11/36] tty: switch receive_buf() counts to size_t Jiri Slaby (SUSE)
2023-08-10 9:14 ` [PATCH 12/36] tty: switch count in tty_ldisc_receive_buf() " Jiri Slaby (SUSE)
2023-08-10 9:14 ` [PATCH 13/36] tty: can327: unify error paths in can327_ldisc_rx() Jiri Slaby (SUSE)
2023-08-11 21:32 ` Max Staudt
2023-08-10 9:14 ` [PATCH 14/36] tty: can327, move overflow test inside can327_ldisc_rx()'s loop Jiri Slaby (SUSE)
2023-08-11 21:34 ` Max Staudt
2023-08-10 9:14 ` [PATCH 15/36] tty: make tty_ldisc_ops::*buf*() hooks operate on size_t Jiri Slaby (SUSE)
2023-08-10 12:02 ` Mark Brown
2023-08-11 21:34 ` Max Staudt
2023-08-10 9:14 ` [PATCH 16/36] tty: use u8 for chars Jiri Slaby (SUSE)
2023-08-10 12:04 ` Mark Brown
2023-08-11 10:28 ` Ilpo Järvinen
2023-08-14 6:35 ` Jiri Slaby
2023-08-31 18:33 ` Andy Shevchenko
2023-08-11 21:34 ` Max Staudt
2023-08-10 9:14 ` [PATCH 17/36] tty: use u8 for flags Jiri Slaby (SUSE)
2023-08-10 12:05 ` Mark Brown
2023-08-11 21:35 ` Max Staudt
2023-08-10 9:14 ` [PATCH 18/36] misc: ti-st: make st_recv() conforming to tty_ldisc_ops::receive_buf() Jiri Slaby (SUSE)
2023-08-10 9:14 ` [PATCH 19/36] tty: make char_buf_ptr()/flag_buf_ptr()'s offset unsigned Jiri Slaby (SUSE)
2023-08-10 9:14 ` [PATCH 20/36] tty: tty_buffer: make all offsets unsigned Jiri Slaby (SUSE)
2023-08-10 9:14 ` [PATCH 21/36] tty: don't pass write() to do_tty_write() Jiri Slaby (SUSE)
2023-08-10 9:14 ` [PATCH 22/36] tty: rename and de-inline do_tty_write() Jiri Slaby (SUSE)
2023-08-10 9:14 ` [PATCH 23/36] tty: use min() in iterate_tty_write() Jiri Slaby (SUSE)
2023-08-10 9:14 ` [PATCH 24/36] tty: use ssize_t for iterate_tty_read() returned type Jiri Slaby (SUSE)
2023-08-10 9:14 ` [PATCH 25/36] tty: switch size and count types in iterate_tty_read() to size_t Jiri Slaby (SUSE)
2023-08-10 9:15 ` [PATCH 26/36] tty: use min() for size computation in iterate_tty_read() Jiri Slaby (SUSE)
2023-08-10 9:15 ` [PATCH 27/36] tty: propagate u8 data to tty_operations::write() Jiri Slaby (SUSE)
2023-08-11 11:52 ` Alexander Gordeev
2023-08-17 10:42 ` Jiri Slaby
2023-08-14 14:47 ` Geert Uytterhoeven
2023-08-17 10:53 ` Alexander Gordeev
2023-08-10 9:15 ` [PATCH 28/36] tty: propagate u8 data to tty_operations::put_char() Jiri Slaby (SUSE)
2023-08-14 14:44 ` Geert Uytterhoeven
2023-08-17 10:55 ` Alexander Gordeev
2023-08-10 9:15 ` [PATCH 29/36] tty: make tty_operations::write()'s count size_t Jiri Slaby (SUSE)
2023-08-14 17:58 ` Geert Uytterhoeven
2023-08-10 9:15 ` [PATCH 30/36] tty: audit: unify to u8 Jiri Slaby (SUSE)
2023-08-10 9:15 ` [PATCH 31/36] tty: ldops: " Jiri Slaby (SUSE)
2023-08-10 9:15 ` [PATCH 32/36] tty: hvc: convert counts to size_t Jiri Slaby (SUSE)
2023-08-10 9:15 ` Jiri Slaby (SUSE) [this message]
2023-08-10 9:15 ` [PATCH 34/36] tty: gdm724x: " Jiri Slaby (SUSE)
2023-08-10 9:42 ` Dan Carpenter
2023-08-10 10:08 ` Jiri Slaby
2023-08-10 10:39 ` [PATCH 34-and-three-quarters/36] tty: gdm724x: simplify gdm_tty_write() Jiri Slaby (SUSE)
2023-08-11 9:11 ` Ilpo Järvinen
2023-08-15 17:22 ` [PATCH 34/36] tty: gdm724x: convert counts to size_t Nathan Chancellor
2023-08-16 6:46 ` Jiri Slaby
2023-08-16 8:40 ` David Laight
2023-08-16 8:58 ` Jiri Slaby
2023-08-16 9:18 ` David Laight
2023-08-10 9:15 ` [PATCH 35/36] tty: hso: simplify hso_serial_write() Jiri Slaby (SUSE)
2023-08-10 9:15 ` [PATCH 36/36] tty: rfcomm: convert counts to size_t Jiri Slaby (SUSE)
2023-08-11 10:26 ` [PATCH 00/36] tty: type unifications -- part I Ilpo Järvinen
2023-08-14 6:59 ` Jiri Slaby
2023-08-14 14:47 ` Ilpo Järvinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230810091510.13006-34-jirislaby@kernel.org \
--to=jirislaby@kernel.org \
--cc=davem@davemloft.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox