Skip to content

Commit

Permalink
tty: um: convert to u8/__u8 and size_t
Browse files Browse the repository at this point in the history
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)" <[email protected]>
Cc: Richard Weinberger <[email protected]>
Cc: Anton Ivanov <[email protected]>
Cc: Johannes Berg <[email protected]>
Cc: [email protected]
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Jiri Slaby (SUSE) authored and gregkh committed Dec 8, 2023
1 parent 1897790 commit b49d184
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion arch/um/drivers/chan.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 4 additions & 5 deletions arch/um/drivers/chan_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions arch/um/drivers/chan_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;

Expand Down
9 changes: 5 additions & 4 deletions arch/um/drivers/chan_user.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 *);
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion arch/um/drivers/line.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
6 changes: 3 additions & 3 deletions arch/um/drivers/line.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion arch/um/drivers/null.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit b49d184

Please sign in to comment.