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>,
Jeremy Kerr <jk@codeconstruct.com.au>,
Matt Johnston <matt@codeconstruct.com.au>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org
Subject: [PATCH 08/13] mctp: serial: propagage new tty types
Date: Mon, 5 Aug 2024 12:20:41 +0200 [thread overview]
Message-ID: <20240805102046.307511-9-jirislaby@kernel.org> (raw)
In-Reply-To: <20240805102046.307511-1-jirislaby@kernel.org>
In tty, u8 is now used for data, ssize_t for sizes (with possible
negative error codes). Propagate these types (and use unsigned in
next_chunk_len()) to mctp.
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jeremy Kerr <jk@codeconstruct.com.au>
Cc: Matt Johnston <matt@codeconstruct.com.au>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: netdev@vger.kernel.org
---
drivers/net/mctp/mctp-serial.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/drivers/net/mctp/mctp-serial.c b/drivers/net/mctp/mctp-serial.c
index 5bf6fdff701c..78bd59b0930d 100644
--- a/drivers/net/mctp/mctp-serial.c
+++ b/drivers/net/mctp/mctp-serial.c
@@ -64,18 +64,18 @@ struct mctp_serial {
u16 txfcs, rxfcs, rxfcs_rcvd;
unsigned int txlen, rxlen;
unsigned int txpos, rxpos;
- unsigned char txbuf[BUFSIZE],
+ u8 txbuf[BUFSIZE],
rxbuf[BUFSIZE];
};
-static bool needs_escape(unsigned char c)
+static bool needs_escape(u8 c)
{
return c == BYTE_ESC || c == BYTE_FRAME;
}
-static int next_chunk_len(struct mctp_serial *dev)
+static unsigned int next_chunk_len(struct mctp_serial *dev)
{
- int i;
+ unsigned int i;
/* either we have no bytes to send ... */
if (dev->txpos == dev->txlen)
@@ -99,7 +99,7 @@ static int next_chunk_len(struct mctp_serial *dev)
return i;
}
-static int write_chunk(struct mctp_serial *dev, unsigned char *buf, int len)
+static ssize_t write_chunk(struct mctp_serial *dev, u8 *buf, size_t len)
{
return dev->tty->ops->write(dev->tty, buf, len);
}
@@ -108,9 +108,10 @@ static void mctp_serial_tx_work(struct work_struct *work)
{
struct mctp_serial *dev = container_of(work, struct mctp_serial,
tx_work);
- unsigned char c, buf[3];
unsigned long flags;
- int len, txlen;
+ ssize_t txlen;
+ unsigned int len;
+ u8 c, buf[3];
spin_lock_irqsave(&dev->lock, flags);
@@ -293,7 +294,7 @@ static void mctp_serial_rx(struct mctp_serial *dev)
dev->netdev->stats.rx_bytes += dev->rxlen;
}
-static void mctp_serial_push_header(struct mctp_serial *dev, unsigned char c)
+static void mctp_serial_push_header(struct mctp_serial *dev, u8 c)
{
switch (dev->rxpos) {
case 0:
@@ -323,7 +324,7 @@ static void mctp_serial_push_header(struct mctp_serial *dev, unsigned char c)
}
}
-static void mctp_serial_push_trailer(struct mctp_serial *dev, unsigned char c)
+static void mctp_serial_push_trailer(struct mctp_serial *dev, u8 c)
{
switch (dev->rxpos) {
case 0:
@@ -347,7 +348,7 @@ static void mctp_serial_push_trailer(struct mctp_serial *dev, unsigned char c)
}
}
-static void mctp_serial_push(struct mctp_serial *dev, unsigned char c)
+static void mctp_serial_push(struct mctp_serial *dev, u8 c)
{
switch (dev->rxstate) {
case STATE_IDLE:
@@ -394,7 +395,7 @@ static void mctp_serial_tty_receive_buf(struct tty_struct *tty, const u8 *c,
const u8 *f, size_t len)
{
struct mctp_serial *dev = tty->disc_data;
- int i;
+ size_t i;
if (!netif_running(dev->netdev))
return;
--
2.46.0
next prev parent reply other threads:[~2024-08-05 10:21 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-05 10:20 [PATCH 00/13] tty: random fixes and cleanups Jiri Slaby (SUSE)
2024-08-05 10:20 ` [PATCH 01/13] tty: simplify tty_dev_name_to_number() using guard(mutex) Jiri Slaby (SUSE)
2024-08-05 14:25 ` Ilpo Järvinen
2024-08-05 10:20 ` [PATCH 02/13] serial: protect uart_port_dtr_rts() in uart_shutdown() too Jiri Slaby (SUSE)
2024-08-05 10:20 ` [PATCH 03/13] serial: don't use uninitialized value in uart_poll_init() Jiri Slaby (SUSE)
2024-08-05 14:28 ` Ilpo Järvinen
2024-08-05 15:46 ` Doug Anderson
2024-08-08 7:34 ` Jiri Slaby
2024-08-08 7:44 ` Greg Kroah-Hartman
2024-08-08 9:15 ` Ilpo Järvinen
2024-08-05 15:43 ` Doug Anderson
2024-08-05 10:20 ` [PATCH 04/13] serial: remove quot_frac from serial8250_do_set_divisor() Jiri Slaby (SUSE)
2024-08-05 10:20 ` [PATCH 05/13] serial: use guards for simple mutex locks Jiri Slaby (SUSE)
2024-08-05 17:57 ` kernel test robot
2024-08-05 18:09 ` kernel test robot
2024-08-07 11:15 ` Greg KH
2024-08-05 10:20 ` [PATCH 06/13] mxser: remove stale comment Jiri Slaby (SUSE)
2024-08-05 10:20 ` [PATCH 07/13] mxser: remove doubled sets of close times Jiri Slaby (SUSE)
2024-08-05 10:20 ` Jiri Slaby (SUSE) [this message]
2024-08-06 4:51 ` [PATCH 08/13] mctp: serial: propagage new tty types Jeremy Kerr
2024-08-08 10:35 ` Jiri Slaby
2024-08-05 10:20 ` [PATCH 09/13] 6pack: remove sixpack::rbuff Jiri Slaby (SUSE)
2024-08-05 10:20 ` [PATCH 10/13] 6pack: drop sixpack::mtu Jiri Slaby (SUSE)
2024-08-05 10:20 ` [PATCH 11/13] 6pack: drop sixpack::buffsize Jiri Slaby (SUSE)
2024-08-05 10:20 ` [PATCH 12/13] 6pack: remove global strings Jiri Slaby (SUSE)
2024-08-05 10:20 ` [PATCH 13/13] 6pack: propagage new tty types Jiri Slaby (SUSE)
2024-08-07 11:14 ` [PATCH 00/13] tty: random fixes and cleanups Greg KH
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=20240805102046.307511-9-jirislaby@kernel.org \
--to=jirislaby@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=jk@codeconstruct.com.au \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=matt@codeconstruct.com.au \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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