public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
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>,
	Richard Weinberger <richard@nod.at>,
	Anton Ivanov <anton.ivanov@cambridgegreys.com>,
	Johannes Berg <johannes@sipsolutions.net>,
	linux-um@lists.infradead.org
Subject: [PATCH 26/27] tty: um: convert to u8/__u8 and size_t
Date: Wed,  6 Dec 2023 08:37:11 +0100	[thread overview]
Message-ID: <20231206073712.17776-27-jirislaby@kernel.org> (raw)
In-Reply-To: <20231206073712.17776-1-jirislaby@kernel.org>

Switch character types to u8 and sizes to size_t. To conform to
characters/sizes in the rest of the tty layer.

Note we use __u8 in the userspace files.

Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Cc: Richard Weinberger <richard@nod.at>
Cc: Anton Ivanov <anton.ivanov@cambridgegreys.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-um@lists.infradead.org
---
 arch/um/drivers/chan.h      | 2 +-
 arch/um/drivers/chan_kern.c | 9 ++++-----
 arch/um/drivers/chan_user.c | 4 ++--
 arch/um/drivers/chan_user.h | 9 +++++----
 arch/um/drivers/line.c      | 2 +-
 arch/um/drivers/line.h      | 6 +++---
 arch/um/drivers/null.c      | 2 +-
 7 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/arch/um/drivers/chan.h b/arch/um/drivers/chan.h
index 3fec3b8406e9..e14b9cdf7a33 100644
--- a/arch/um/drivers/chan.h
+++ b/arch/um/drivers/chan.h
@@ -30,7 +30,7 @@ struct chan {
 extern void chan_interrupt(struct line *line, int irq);
 extern int parse_chan_pair(char *str, struct line *line, int device,
 			   const struct chan_opts *opts, char **error_out);
-extern int write_chan(struct chan *chan, const char *buf, int len,
+extern int write_chan(struct chan *chan, const u8 *buf, size_t len,
 			     int write_irq);
 extern int console_write_chan(struct chan *chan, const char *buf, 
 			      int len);
diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c
index 26a702a06515..37538b4168da 100644
--- a/arch/um/drivers/chan_kern.c
+++ b/arch/um/drivers/chan_kern.c
@@ -33,14 +33,14 @@ static void not_configged_close(int fd, void *data)
 	       "UML\n");
 }
 
-static int not_configged_read(int fd, char *c_out, void *data)
+static int not_configged_read(int fd, u8 *c_out, void *data)
 {
 	printk(KERN_ERR "Using a channel type which is configured out of "
 	       "UML\n");
 	return -EIO;
 }
 
-static int not_configged_write(int fd, const char *buf, int len, void *data)
+static int not_configged_write(int fd, const u8 *buf, size_t len, void *data)
 {
 	printk(KERN_ERR "Using a channel type which is configured out of "
 	       "UML\n");
@@ -247,8 +247,7 @@ void deactivate_chan(struct chan *chan, int irq)
 		deactivate_fd(chan->fd, irq);
 }
 
-int write_chan(struct chan *chan, const char *buf, int len,
-	       int write_irq)
+int write_chan(struct chan *chan, const u8 *buf, size_t len, int write_irq)
 {
 	int n, ret = 0;
 
@@ -540,7 +539,7 @@ void chan_interrupt(struct line *line, int irq)
 	struct tty_port *port = &line->port;
 	struct chan *chan = line->chan_in;
 	int err;
-	char c;
+	u8 c;
 
 	if (!chan || !chan->ops->read)
 		goto out;
diff --git a/arch/um/drivers/chan_user.c b/arch/um/drivers/chan_user.c
index 25727ed648b7..40d98dd23c8a 100644
--- a/arch/um/drivers/chan_user.c
+++ b/arch/um/drivers/chan_user.c
@@ -19,7 +19,7 @@ void generic_close(int fd, void *unused)
 	close(fd);
 }
 
-int generic_read(int fd, char *c_out, void *unused)
+int generic_read(int fd, __u8 *c_out, void *unused)
 {
 	int n;
 
@@ -35,7 +35,7 @@ int generic_read(int fd, char *c_out, void *unused)
 
 /* XXX Trivial wrapper around write */
 
-int generic_write(int fd, const char *buf, int n, void *unused)
+int generic_write(int fd, const __u8 *buf, size_t n, void *unused)
 {
 	int err;
 
diff --git a/arch/um/drivers/chan_user.h b/arch/um/drivers/chan_user.h
index 4e51b85e2a23..e158e16fb3cc 100644
--- a/arch/um/drivers/chan_user.h
+++ b/arch/um/drivers/chan_user.h
@@ -7,6 +7,7 @@
 #define __CHAN_USER_H__
 
 #include <init.h>
+#include <linux/types.h>
 
 struct chan_opts {
 	void (*const announce)(char *dev_name, int dev);
@@ -19,8 +20,8 @@ struct chan_ops {
 	void *(*init)(char *, int, const struct chan_opts *);
 	int (*open)(int, int, int, void *, char **);
 	void (*close)(int, void *);
-	int (*read)(int, char *, void *);
-	int (*write)(int, const char *, int, void *);
+	int (*read)(int, __u8 *, void *);
+	int (*write)(int, const __u8 *, size_t, void *);
 	int (*console_write)(int, const char *, int);
 	int (*window_size)(int, void *, unsigned short *, unsigned short *);
 	void (*free)(void *);
@@ -31,8 +32,8 @@ extern const struct chan_ops fd_ops, null_ops, port_ops, pts_ops, pty_ops,
 	tty_ops, xterm_ops;
 
 extern void generic_close(int fd, void *unused);
-extern int generic_read(int fd, char *c_out, void *unused);
-extern int generic_write(int fd, const char *buf, int n, void *unused);
+extern int generic_read(int fd, __u8 *c_out, void *unused);
+extern int generic_write(int fd, const __u8 *buf, size_t n, void *unused);
 extern int generic_console_write(int fd, const char *buf, int n);
 extern int generic_window_size(int fd, void *unused, unsigned short *rows_out,
 			       unsigned short *cols_out);
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index b98545f3edb5..c9403629cc56 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -83,7 +83,7 @@ unsigned int line_chars_in_buffer(struct tty_struct *tty)
  *
  * Must be called while holding line->lock!
  */
-static int buffer_data(struct line *line, const char *buf, int len)
+static int buffer_data(struct line *line, const u8 *buf, size_t len)
 {
 	int end, room;
 
diff --git a/arch/um/drivers/line.h b/arch/um/drivers/line.h
index e84fb9b4165e..e8bd6f3dfb50 100644
--- a/arch/um/drivers/line.h
+++ b/arch/um/drivers/line.h
@@ -47,9 +47,9 @@ struct line {
 	 *
 	 * buffer points to a buffer allocated on demand, of length
 	 * LINE_BUFSIZE, head to the start of the ring, tail to the end.*/
-	char *buffer;
-	char *head;
-	char *tail;
+	u8 *buffer;
+	u8 *head;
+	u8 *tail;
 
 	int sigio;
 	struct delayed_work task;
diff --git a/arch/um/drivers/null.c b/arch/um/drivers/null.c
index 87087763a417..30d59b8481b4 100644
--- a/arch/um/drivers/null.c
+++ b/arch/um/drivers/null.c
@@ -28,7 +28,7 @@ static int null_open(int input, int output, int primary, void *d,
 	return (fd < 0) ? -errno : fd;
 }
 
-static int null_read(int fd, char *c_out, void *unused)
+static int null_read(int fd, __u8 *c_out, void *unused)
 {
 	return -ENODEV;
 }
-- 
2.43.0


  parent reply	other threads:[~2023-12-06  7:40 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-06  7:36 [PATCH 00/27] tty: type unifications -- the last part Jiri Slaby (SUSE)
2023-12-06  7:36 ` [PATCH 01/27] tty: goldfish: use bool for is_write parameter Jiri Slaby (SUSE)
2023-12-06  7:36 ` [PATCH 02/27] tty: mmc: sdio_uart: switch sdio_in() to return u8 Jiri Slaby (SUSE)
2023-12-07 14:09   ` Ulf Hansson
2023-12-06  7:36 ` [PATCH 03/27] tty: switch tty_port::xmit_* to u8 Jiri Slaby (SUSE)
2023-12-06  7:36 ` [PATCH 04/27] tty: make tty_operations::send_xchar accept u8 char Jiri Slaby (SUSE)
2023-12-06  8:27   ` Geert Uytterhoeven
2023-12-07 14:09   ` Ulf Hansson
2023-12-06  7:36 ` [PATCH 05/27] tty: core: the rest to u8 Jiri Slaby (SUSE)
2023-12-06  7:36 ` [PATCH 06/27] tty: ami: use u8 for characters and flag Jiri Slaby (SUSE)
2023-12-06  8:28   ` Geert Uytterhoeven
2023-12-06  7:36 ` [PATCH 07/27] tty: bcm: convert to u8 and size_t Jiri Slaby (SUSE)
2023-12-06  7:36 ` [PATCH 08/27] tty: con3215: " Jiri Slaby (SUSE)
2023-12-08 13:19   ` Alexander Gordeev
2023-12-06  7:36 ` [PATCH 09/27] tty: con3270: " Jiri Slaby (SUSE)
2023-12-08 13:19   ` Alexander Gordeev
2023-12-06  7:36 ` [PATCH 10/27] tty: ehv_bytechan: " Jiri Slaby (SUSE)
2023-12-06  7:36 ` [PATCH 11/27] tty: goldfish: " Jiri Slaby (SUSE)
2023-12-06  7:36 ` [PATCH 12/27] tty: hvc: " Jiri Slaby (SUSE)
2023-12-06  9:30   ` Christophe Leroy
2023-12-06  7:36 ` [PATCH 13/27] tty: ipoctal: " Jiri Slaby (SUSE)
2023-12-06  7:36 ` [PATCH 14/27] tty: m68k: nfcon: " Jiri Slaby (SUSE)
2023-12-06  7:51   ` Geert Uytterhoeven
2023-12-06  7:37 ` [PATCH 15/27] tty: mips_ejtag_fdc: use u8 for character pointers Jiri Slaby (SUSE)
2023-12-06  7:37 ` [PATCH 16/27] tty: mmc: sdio: use u8 for flag Jiri Slaby (SUSE)
2023-12-07 14:10   ` Ulf Hansson
2023-12-06  7:37 ` [PATCH 17/27] tty: moxa: convert to u8 and size_t Jiri Slaby (SUSE)
2023-12-06  7:37 ` [PATCH 18/27] tty: mxser: " Jiri Slaby (SUSE)
2023-12-06  7:37 ` [PATCH 19/27] tty: n_gsm: " Jiri Slaby (SUSE)
2023-12-06  7:37 ` [PATCH 20/27] tty: n_hdlc: " Jiri Slaby (SUSE)
2023-12-06  7:37 ` [PATCH 21/27] tty: nozomi: " Jiri Slaby (SUSE)
2023-12-07 12:50   ` Ilpo Järvinen
2023-12-06  7:37 ` [PATCH 22/27] tty: serdev: convert to u8 and size_t in serdev_controller_ops Jiri Slaby (SUSE)
2023-12-06  7:37 ` [PATCH 23/27] tty: serdev: convert to u8 and size_t Jiri Slaby (SUSE)
2023-12-06  8:09   ` Johan Hovold
2023-12-07  1:47     ` Greg KH
2023-12-07  8:19       ` Johan Hovold
2023-12-07 10:09         ` Greg KH
2023-12-06  7:37 ` [PATCH 24/27] tty: srmcons: " Jiri Slaby (SUSE)
2023-12-06  7:37 ` [PATCH 25/27] tty: ttyprintk: " Jiri Slaby (SUSE)
2023-12-06  7:37 ` Jiri Slaby (SUSE) [this message]
2023-12-06  7:37 ` [PATCH 27/27] tty: xtensa/iss: use u8 Jiri Slaby (SUSE)

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=20231206073712.17776-27-jirislaby@kernel.org \
    --to=jirislaby@kernel.org \
    --cc=anton.ivanov@cambridgegreys.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux-um@lists.infradead.org \
    --cc=richard@nod.at \
    /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