tty: type unifications -- the last part
Subsystems (43)
Jiri Slaby (SUSE)
maintainercover tty: type unifications -- the last part
This is a continuation of the previous cleanups in the tty layer. Especially those in the character and size types. As this patchset propagates the unified u8 and size_t to most of the drivers, this is the last part of this very rework.
If people still see char or unsigned char for a character (or flag), please fix. The same holds for signed ints used as sizes.
Note that the first two patches are mostly preparatory cleanup. The rest is switch to u8 and size_t of the tx paths in drivers.
Jiri Slaby (SUSE) (27):
tty: goldfish: use bool for is_write parameter
tty: mmc: sdio_uart: switch sdio_in() to return u8
tty: switch tty_port::xmit_* to u8
tty: make tty_operations::send_xchar accept u8 char
tty: core: the rest to u8
tty: ami: use u8 for characters and flag
tty: bcm: convert to u8 and size_t
tty: con3215: convert to u8 and size_t
tty: con3270: convert to u8 and size_t
tty: ehv_bytechan: convert to u8 and size_t
tty: goldfish: convert to u8 and size_t
tty: hvc: convert to u8 and size_t
tty: ipoctal: convert to u8 and size_t
tty: m68k: nfcon: convert to u8 and size_t
tty: mips_ejtag_fdc: use u8 for character pointers
tty: mmc: sdio: use u8 for flag
tty: moxa: convert to u8 and size_t
tty: mxser: convert to u8 and size_t
tty: n_gsm: convert to u8 and size_t
tty: n_hdlc: convert to u8 and size_t
tty: nozomi: convert to u8 and size_t
tty: serdev: convert to u8 and size_t in serdev_controller_ops
tty: serdev: convert to u8 and size_t
tty: srmcons: convert to u8 and size_t
tty: ttyprintk: convert to u8 and size_t
tty: um: convert to u8/__u8 and size_t
tty: xtensa/iss: use u8
arch/alpha/kernel/srmcons.c | 6 ++--- arch/m68k/emu/nfcon.c | 4 ++-- arch/powerpc/include/asm/hvconsole.h | 4 ++-- arch/powerpc/include/asm/hvsi.h | 18 +++++++------- arch/powerpc/include/asm/opal.h | 8 ++++--- arch/powerpc/platforms/powernv/opal.c | 14 ++++++----- arch/powerpc/platforms/pseries/hvconsole.c | 4 ++-- 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 +- arch/xtensa/platforms/iss/console.c | 2 +- drivers/bluetooth/btmtkuart.c | 4 ++-- drivers/bluetooth/btnxpuart.c | 4 ++-- drivers/bluetooth/hci_serdev.c | 4 ++-- drivers/char/ttyprintk.c | 6 ++--- drivers/char/virtio_console.c | 10 ++++---- drivers/gnss/serial.c | 4 ++-- drivers/gnss/sirf.c | 4 ++-- drivers/greybus/gb-beagleplay.c | 5 ++-- drivers/iio/chemical/pms7003.c | 6 ++--- drivers/iio/chemical/scd30_serial.c | 6 ++--- drivers/iio/chemical/sps30_serial.c | 18 +++++++------- drivers/iio/imu/bno055/bno055_ser_core.c | 6 ++--- drivers/ipack/devices/ipoctal.c | 14 +++++------ drivers/isdn/capi/capi.c | 4 ++-- drivers/mfd/rave-sp.c | 10 ++++---- drivers/misc/bcm-vk/bcm_vk_tty.c | 4 ++-- drivers/mmc/core/sdio_uart.c | 22 +++++++---------- drivers/net/ethernet/qualcomm/qca_uart.c | 5 ++-- drivers/nfc/pn533/uart.c | 4 ++-- drivers/nfc/s3fwrn5/uart.c | 5 ++-- drivers/platform/chrome/cros_ec_uart.c | 5 ++-- .../platform/surface/aggregator/controller.h | 4 ++-- drivers/platform/surface/aggregator/core.c | 4 ++-- .../surface/aggregator/ssh_packet_layer.c | 4 ++-- .../surface/aggregator/ssh_packet_layer.h | 2 +- drivers/s390/char/con3215.c | 24 +++++++++---------- drivers/s390/char/con3270.c | 12 +++++----- drivers/tty/amiserial.c | 6 ++--- drivers/tty/ehv_bytechan.c | 11 ++++----- drivers/tty/goldfish.c | 20 +++++++--------- drivers/tty/hvc/hvc_console.h | 4 ++-- drivers/tty/hvc/hvc_dcc.c | 24 +++++++++---------- drivers/tty/hvc/hvc_iucv.c | 18 +++++++------- drivers/tty/hvc/hvc_opal.c | 5 ++-- drivers/tty/hvc/hvc_riscv_sbi.c | 9 +++---- drivers/tty/hvc/hvc_rtas.c | 11 +++++---- drivers/tty/hvc/hvc_udbg.c | 9 +++---- drivers/tty/hvc/hvc_vio.c | 18 +++++++------- drivers/tty/hvc/hvc_xen.c | 23 +++++++++--------- drivers/tty/hvc/hvsi_lib.c | 20 +++++++++------- drivers/tty/mips_ejtag_fdc.c | 10 ++++---- drivers/tty/moxa.c | 15 ++++++------ drivers/tty/mxser.c | 8 +++---- drivers/tty/n_gsm.c | 17 +++++++------ drivers/tty/n_hdlc.c | 10 ++++---- drivers/tty/nozomi.c | 9 ++++--- drivers/tty/serdev/core.c | 12 ++++------ drivers/tty/serdev/serdev-ttyport.c | 2 +- drivers/tty/serial/serial_core.c | 2 +- drivers/tty/tty_io.c | 12 +++++----- drivers/tty/tty_port.c | 2 +- include/linux/serdev.h | 21 ++++++++-------- include/linux/tty.h | 6 ++--- include/linux/tty_driver.h | 4 ++-- include/linux/tty_port.h | 4 ++-- net/bluetooth/rfcomm/tty.c | 2 +- sound/drivers/serial-generic.c | 4 ++-- 72 files changed, 306 insertions(+), 306 deletions(-)
Signature · 1 line
2.43.0
Jiri Slaby (SUSE)
maintainerPATCH 1/27 tty: goldfish: use bool for is_write parameter
do_rw_io()'s is_write parameter is boolean, but typed int. Switch to the former, so that it's obvious. (And the two users too.)
--- drivers/tty/goldfish.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/tty/goldfish.c +4 -4
@@ -53,7 +53,7 @@ static struct goldfish_tty *goldfish_ttys;static void do_rw_io (struct goldfish_tty *qtty,unsigned long address,unsigned int count, -int is_write) +bool is_write) {unsigned long irq_flags;void __iomem *base = qtty->base;
@@ -76,7 +76,7 @@ static void do_rw_io(struct goldfish_tty *qtty,static void goldfish_tty_rw (struct goldfish_tty *qtty,unsigned long addr,unsigned int count, -int is_write) +bool is_write) {dma_addr_t dma_handle;enum dma_data_direction dma_dir;
@@ -129,7 +129,7 @@ static void goldfish_tty_do_write(int line, const u8 *buf, unsigned int count) {struct goldfish_tty *qtty = &goldfish_ttys[line]; -goldfish_tty_rw (qtty, (unsigned long )buf, count,1 ); +goldfish_tty_rw (qtty, (unsigned long )buf, count, true); }static irqreturn_t goldfish_tty_interrupt (int irq,void *dev_id)
@@ -145,7 +145,7 @@ static irqreturn_t goldfish_tty_interrupt(int irq, void *dev_id) count =tty_prepare_flip_string (&qtty->port, &buf, count); -goldfish_tty_rw (qtty, (unsigned long )buf, count,0 ); +goldfish_tty_rw (qtty, (unsigned long )buf, count, false);tty_flip_buffer_push (&qtty->port);return IRQ_HANDLED ;
Signature · 1 line
2.43.0
Jiri Slaby (SUSE)
maintainerPATCH 2/27 tty: mmc: sdio_uart: switch sdio_in() to return u8
In reply to Jiri Slaby (SUSE)sdio_in() returns a value returned from sdio_readb(). The latter returns u8. So should the former. Therefore, switch sdio_in() return type to u8 and all its callers too.
--- drivers/mmc/core/sdio_uart.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)
drivers/mmc/core/sdio_uart.c +8 -11
@@ -178,11 +178,9 @@ static inline void sdio_uart_release_func(struct sdio_uart_port *port)sdio_release_host (port->func); } -static inline unsigned int sdio_in (struct sdio_uart_port *port,int offset) +static inline u8 sdio_in (struct sdio_uart_port *port,int offset) { -unsigned char c; - c =sdio_readb (port->func, port->regs_offset + offset,NULL ); -return c; +return sdio_readb (port->func, port->regs_offset + offset,NULL ); }static inline void sdio_out (struct sdio_uart_port *port,int offset,int value)
@@ -192,8 +190,8 @@ static inline void sdio_out(struct sdio_uart_port *port, int offset, int value)static unsigned int sdio_uart_get_mctrl (struct sdio_uart_port *port) { -unsigned char status;unsigned int ret; +u8 status;/* FIXME: What stops this losing the delta bits and breaking sdio_uart_check_modem_status ? */
@@ -354,14 +352,13 @@ static void sdio_uart_stop_rx(struct sdio_uart_port *port)sdio_out (port,UART_IER , port->ier); } -static void sdio_uart_receive_chars (struct sdio_uart_port *port, -unsigned int *status) +static void sdio_uart_receive_chars (struct sdio_uart_port *port,u8 *status) { -unsigned int ch, flag; +unsigned int flag;int max_count =256 ; do { - ch = sdio_in(port, UART_RX); + u8 ch = sdio_in(port, UART_RX); flag = TTY_NORMAL; port->icount.rx++;
@@ -449,8 +446,8 @@ static void sdio_uart_transmit_chars(struct sdio_uart_port *port)static void sdio_uart_check_modem_status (struct sdio_uart_port *port) { -int status;struct tty_struct *tty; +u8 status; status =sdio_in (port,UART_MSR );
@@ -499,7 +496,7 @@ static void sdio_uart_check_modem_status(struct sdio_uart_port *port)static void sdio_uart_irq (struct sdio_func *func) {struct sdio_uart_port *port =sdio_get_drvdata (func); -unsigned int iir, lsr; +u8 iir, lsr;/* * In a few places sdio_uart_irq() is called directly instead of
Signature · 1 line
2.43.0
Jiri Slaby (SUSE)
maintainerPATCH 3/27 tty: switch tty_port::xmit_* to u8
In reply to Jiri Slaby (SUSE)Both xmit_buf and xmit_fifo of struct tty_port should be u8. To conform to characters in the rest of the tty layer.
--- drivers/tty/tty_port.c | 2 +- include/linux/tty_port.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/tty/tty_port.c +1 -1
@@ -247,7 +247,7 @@ int tty_port_alloc_xmit_buf(struct tty_port *port)/* We may sleep in get_zeroed_page() */ mutex_lock (&port->buf_mutex);if (port->xmit_buf ==NULL ) { - port->xmit_buf = (unsigned char *)get_zeroed_page (GFP_KERNEL ); + port->xmit_buf = (u8 *)get_zeroed_page (GFP_KERNEL );if (port->xmit_buf)kfifo_init (&port->xmit_fifo, port->xmit_buf,PAGE_SIZE ); }
include/linux/tty_port.h +2 -2
@@ -114,8 +114,8 @@ struct tty_port { unsigned char console:1;struct mutex mutex;struct mutex buf_mutex; -unsigned char *xmit_buf; - DECLARE_KFIFO_PTR(xmit_fifo, unsigned char); +u8 *xmit_buf; +DECLARE_KFIFO_PTR (xmit_fifo, u8);unsigned int close_delay;unsigned int closing_wait;int drain_delay;
Signature · 1 line
2.43.0
Jiri Slaby (SUSE)
maintainerPATCH 4/27 tty: make tty_operations::send_xchar accept u8 char
In reply to Jiri Slaby (SUSE)tty_operations::send_xchar is one of the last users of 'char' type for characters in the tty layer. Convert it to u8 now.
--- drivers/isdn/capi/capi.c | 4 ++-- drivers/mmc/core/sdio_uart.c | 2 +- drivers/tty/amiserial.c | 2 +- drivers/tty/serial/serial_core.c | 2 +- drivers/tty/tty_io.c | 2 +- include/linux/tty.h | 2 +- include/linux/tty_driver.h | 4 ++-- net/bluetooth/rfcomm/tty.c | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-)
drivers/isdn/capi/capi.c +2 -2
@@ -1231,9 +1231,9 @@ static void capinc_tty_hangup(struct tty_struct *tty)tty_port_hangup (&mp->port); } -static void capinc_tty_send_xchar (struct tty_struct *tty,char ch) +static void capinc_tty_send_xchar (struct tty_struct *tty,u8 ch) { -pr_debug ("capinc_tty_send_xchar(%d)\n" , ch); +pr_debug ("capinc_tty_send_xchar(%u)\n" , ch); }static const struct tty_operations capinc_ops = {
drivers/mmc/core/sdio_uart.c +1 -1
@@ -792,7 +792,7 @@ static unsigned int sdio_uart_chars_in_buffer(struct tty_struct *tty)return kfifo_len (&port->xmit_fifo); } -static void sdio_uart_send_xchar (struct tty_struct *tty,char ch) +static void sdio_uart_send_xchar (struct tty_struct *tty,u8 ch) {struct sdio_uart_port *port = tty->driver_data;
drivers/tty/amiserial.c +1 -1
@@ -811,7 +811,7 @@ static void rs_flush_buffer(struct tty_struct *tty)* This function is used to send a high-priority XON/XOFF character to * the device */ -static void rs_send_xchar (struct tty_struct *tty,char ch) +static void rs_send_xchar (struct tty_struct *tty,u8 ch) {struct serial_state *info = tty->driver_data;unsigned long flags;
drivers/tty/serial/serial_core.c +1 -1
@@ -687,7 +687,7 @@ EXPORT_SYMBOL_GPL(uart_xchar_out);* This function is used to send a high-priority XON/XOFF character to * the device */ -static void uart_send_xchar (struct tty_struct *tty,char ch) +static void uart_send_xchar (struct tty_struct *tty,u8 ch) {struct uart_state *state = tty->driver_data;struct uart_port *port;
drivers/tty/tty_io.c +1 -1
@@ -1149,7 +1149,7 @@ ssize_t redirected_tty_write(struct kiocb *iocb, struct iov_iter *iter)* * Locking: none for xchar method, write ordering for write method. */ -int tty_send_xchar (struct tty_struct *tty,char ch) +int tty_send_xchar (struct tty_struct *tty,u8 ch) {bool was_stopped = tty->flow.stopped;
include/linux/tty.h +1 -1
@@ -410,7 +410,7 @@ void tty_wait_until_sent(struct tty_struct *tty, long timeout);void stop_tty (struct tty_struct *tty);void start_tty (struct tty_struct *tty);void tty_write_message (struct tty_struct *tty,char *msg); -int tty_send_xchar (struct tty_struct *tty,char ch); +int tty_send_xchar (struct tty_struct *tty,u8 ch);int tty_put_char (struct tty_struct *tty,unsigned char c);unsigned int tty_chars_in_buffer (struct tty_struct *tty);unsigned int tty_write_room (struct tty_struct *tty);
include/linux/tty_driver.h +2 -2
@@ -242,7 +242,7 @@ struct serial_struct;* Optional: If not provided, the device is assumed to have no FIFO. * Usually correct to invoke via tty_wait_until_sent(). May sleep. * -* @send_xchar: ``void ()(struct tty_struct *tty, char ch)`` +* @send_xchar: ``void ()(struct tty_struct *tty, u8 ch)`` * * This routine is used to send a high-priority XON/XOFF character (@ch) * to the @tty device.
@@ -374,7 +374,7 @@ struct tty_operations {void (*flush_buffer)(struct tty_struct *tty);void (*set_ldisc)(struct tty_struct *tty);void (*wait_until_sent)(struct tty_struct *tty,int timeout); -void (*send_xchar)(struct tty_struct *tty,char ch); +void (*send_xchar)(struct tty_struct *tty,u8 ch);int (*tiocmget)(struct tty_struct *tty);int (*tiocmset)(struct tty_struct *tty,unsigned int set,unsigned int clear);
net/bluetooth/rfcomm/tty.c +1 -1
@@ -1041,7 +1041,7 @@ static void rfcomm_tty_flush_buffer(struct tty_struct *tty)tty_wakeup (tty); } -static void rfcomm_tty_send_xchar (struct tty_struct *tty,char ch) +static void rfcomm_tty_send_xchar (struct tty_struct *tty,u8 ch) {BT_DBG ("tty %p ch %c" , tty, ch); }
Signature · 1 line
2.43.0
Jiri Slaby (SUSE)
maintainerPATCH 5/27 tty: core: the rest to u8
In reply to Jiri Slaby (SUSE)There are still last minor users in the tty core that still reference characters by the 'char' type. Switch them to u8.
--- drivers/tty/tty_io.c | 10 +++++----- include/linux/tty.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/tty/tty_io.c +5 -5
@@ -852,9 +852,9 @@ static ssize_t iterate_tty_read(struct tty_ldisc *ld, struct tty_struct *tty, {void *cookie =NULL ;unsigned long offset =0 ; -char kernel_buf[64 ];ssize_t retval =0 ;size_t copied, count =iov_iter_count (to); +u8 kernel_buf[64 ]; do { ssize_t size = min(count, sizeof(kernel_buf));
@@ -995,7 +995,7 @@ static ssize_t iterate_tty_write(struct tty_ldisc *ld, struct tty_struct *tty,/* write_buf/write_cnt is protected by the atomic_write_lock mutex */ if (tty->write_cnt < chunk) { -unsigned char *buf_chunk; +u8 *buf_chunk;if (chunk <1024 ) chunk =1024 ;
@@ -2278,10 +2278,10 @@ static bool tty_legacy_tiocsti __read_mostly = IS_ENABLED(CONFIG_LEGACY_TIOCSTI)* * Called functions take tty_ldiscs_lock * * current->signal->tty check is safe without locks */ -static int tiocsti (struct tty_struct *tty,char __user *p) +static int tiocsti (struct tty_struct *tty,u8 __user *p) { -char ch;struct tty_ldisc *ld; +u8 ch;if (!tty_legacy_tiocsti && !capable (CAP_SYS_ADMIN ))return -EIO ;
@@ -3142,7 +3142,7 @@ struct tty_struct *alloc_tty_struct(struct tty_driver *driver, int idx)* * Return: the number of characters successfully output. */ -int tty_put_char (struct tty_struct *tty,unsigned char ch) +int tty_put_char (struct tty_struct *tty,u8 ch) {if (tty->ops->put_char)return tty->ops->put_char (tty, ch);
include/linux/tty.h +2 -2
@@ -242,7 +242,7 @@ struct tty_struct {void *driver_data;spinlock_t files_lock;int write_cnt; -unsigned char *write_buf; +u8 *write_buf;struct list_head tty_files;
@@ -411,7 +411,7 @@ void stop_tty(struct tty_struct *tty);void start_tty (struct tty_struct *tty);void tty_write_message (struct tty_struct *tty,char *msg);int tty_send_xchar (struct tty_struct *tty,u8 ch); -int tty_put_char (struct tty_struct *tty,unsigned char c); +int tty_put_char (struct tty_struct *tty,u8 c);unsigned int tty_chars_in_buffer (struct tty_struct *tty);unsigned int tty_write_room (struct tty_struct *tty);void tty_driver_flush_buffer (struct tty_struct *tty);
Signature · 1 line
2.43.0
Jiri Slaby (SUSE)
maintainerPATCH 6/27 tty: ami: use u8 for characters and flag
In reply to Jiri Slaby (SUSE)Switch character types to u8. To conform to characters in the rest of the tty layer.
--- drivers/tty/amiserial.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/amiserial.c +2 -2
@@ -81,7 +81,7 @@ struct serial_state {int quot;int IER ;/* Interrupt Enable Register */ int MCR ;/* Modem control register */ -int x_char;/* xon/xoff character */ +u8 x_char;/* xon/xoff character */ };static struct tty_driver *serial_driver;
@@ -178,7 +178,7 @@ static void receive_chars(struct serial_state *info) {int status;int serdatr; -unsigned char ch, flag; +u8 ch, flag;struct async_icount *icount;bool overrun = false;
Signature · 1 line
2.43.0
Jiri Slaby (SUSE)
maintainerPATCH 7/27 tty: bcm: convert to u8 and size_t
In reply to Jiri Slaby (SUSE)Switch character types to u8 and sizes to size_t. To conform to characters/sizes in the rest of the tty layer.
--- drivers/misc/bcm-vk/bcm_vk_tty.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/misc/bcm-vk/bcm_vk_tty.c +2 -2
@@ -64,9 +64,9 @@ static void bcm_vk_tty_wq_handler(struct work_struct *work)struct bcm_vk_tty *vktty;int card_status;int count; -unsigned char c;int i;int wr; +u8 c; card_status =vkread32 (vk,BAR_0 ,BAR_CARD_STATUS );if (BCM_VK_INTF_IS_DOWN (card_status))
@@ -192,7 +192,7 @@ static ssize_t bcm_vk_tty_write(struct tty_struct *tty, const u8 *buffer,int index;struct bcm_vk *vk;struct bcm_vk_tty *vktty; -int i; +size_t i; index = tty->index; vk =dev_get_drvdata (tty->dev);
Signature · 1 line
2.43.0
Jiri Slaby (SUSE)
maintainerPATCH 8/27 tty: con3215: convert to u8 and size_t
In reply to Jiri Slaby (SUSE)Switch character types to u8 and sizes to size_t. To conform to characters/sizes in the rest of the tty layer.
--- drivers/s390/char/con3215.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/s390/char/con3215.c +12 -12
@@ -79,8 +79,8 @@ struct raw3215_info {struct ccw_device *cdev;/* device for tty driver */ spinlock_t *lock;/* pointer to irq lock */ int flags;/* state flags */ -char *buffer;/* pointer to output buffer */ -char *inbuf;/* pointer to input buffer */ +u8 *buffer;/* pointer to output buffer */ +u8 *inbuf;/* pointer to input buffer */ int head;/* first free byte in output buffer */ int count;/* number of bytes in output buffer */ int written;/* number of bytes in write requests */
@@ -522,12 +522,14 @@ static unsigned int raw3215_make_room(struct raw3215_info *raw,* string without blocking. * Return value is the number of bytes copied. */ -static unsigned int raw3215_addtext (const char *str,unsigned int length, +static unsigned int raw3215_addtext (const u8 *str,size_t length,struct raw3215_info *raw,int opmode,unsigned int todrop) { -unsigned int c, ch, i, blanks, expanded_size =0 ; +unsigned int i, blanks, expanded_size =0 ;unsigned int column = raw->line_pos; +size_t c; +u8 ch;if (opmode ==RAW3215_COUNT ) todrop =0 ;
@@ -558,7 +560,7 @@ static unsigned int raw3215_addtext(const char *str, unsigned int length,if (todrop && expanded_size < todrop)/* Drop head data */ continue ;for (i =0 ; i < blanks; i++) { - raw->buffer[raw->head] = (char )_ascebc[(int )ch]; + raw->buffer[raw->head] = _ascebc[ch]; raw->head = (raw->head +1 ) & (RAW3215_BUFFER_SIZE -1 ); raw->count++; }
@@ -570,8 +572,8 @@ static unsigned int raw3215_addtext(const char *str, unsigned int length,/* * String write routine for 3215 devices */ -static void raw3215_write (struct raw3215_info *raw,const char *str, -unsigned int length) +static void raw3215_write (struct raw3215_info *raw,const u8 *str, +size_t length) {unsigned int count, avail;unsigned long flags;
@@ -596,7 +598,7 @@ static void raw3215_write(struct raw3215_info *raw, const char *str,/* * Put character routine for 3215 devices */ -static void raw3215_putchar (struct raw3215_info *raw,unsigned char ch) +static void raw3215_putchar (struct raw3215_info *raw,u8 ch) {raw3215_write (raw, &ch,1 ); }
@@ -823,12 +825,10 @@ static struct ccw_driver raw3215_ccw_driver = { .int_class = IRQIO_C15, }; -static void handle_write (struct raw3215_info *raw,const char *str,int count) +static void handle_write (struct raw3215_info *raw,const u8 *str,size_t count) { -int i; -while (count >0 ) { - i =min_t (int, count,RAW3215_BUFFER_SIZE -1 ); +size_t i =min_t (size_t, count,RAW3215_BUFFER_SIZE -1 );raw3215_write (raw, str, i); count -= i; str += i;
Signature · 1 line
2.43.0
Jiri Slaby (SUSE)
maintainerPATCH 9/27 tty: con3270: convert to u8 and size_t
In reply to Jiri Slaby (SUSE)Switch character types to u8 and sizes to size_t. To conform to characters/sizes in the rest of the tty layer.
--- drivers/s390/char/con3270.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/s390/char/con3270.c +6 -6
@@ -54,7 +54,7 @@ struct tty3270_attribute { };struct tty3270_cell { -unsigned char character; +u8 character;struct tty3270_attribute attributes; };
@@ -123,7 +123,7 @@ struct tty3270 {/* Character array for put_char/flush_chars. */ unsigned int char_count; -char char_buf[TTY3270_CHAR_BUF_SIZE ]; +u8 char_buf[TTY3270_CHAR_BUF_SIZE ]; };/* tty3270->update_flags. See tty3270_update for details. */
@@ -1255,7 +1255,7 @@ static unsigned int tty3270_write_room(struct tty_struct *tty)* Insert character into the screen at the current position with the * current color and highlight. This function does NOT do cursor movement. */ -static void tty3270_put_character (struct tty3270 *tp,char ch) +static void tty3270_put_character (struct tty3270 *tp,u8 ch) {struct tty3270_line *line;struct tty3270_cell *cell;
@@ -1561,7 +1561,7 @@ static void tty3270_goto_xy(struct tty3270 *tp, int cx, int cy)* Pn is a numeric parameter, a string of zero or more decimal digits. * Ps is a selective parameter. */ -static void tty3270_escape_sequence (struct tty3270 *tp,char ch) +static void tty3270_escape_sequence (struct tty3270 *tp,u8 ch) {enum {ES_NORMAL ,ES_ESC ,ES_SQUARE ,ES_PAREN ,ES_GETPARS };
@@ -1726,7 +1726,7 @@ static void tty3270_escape_sequence(struct tty3270 *tp, char ch)* String write routine for 3270 ttys */ static void tty3270_do_write (struct tty3270 *tp,struct tty_struct *tty, -const unsigned char *buf,int count) +const u8 *buf,size_t count) {int i_msg, i;
@@ -2052,7 +2052,7 @@ con3270_write(struct console *co, const char *str, unsigned int count) {struct tty3270 *tp = co->data;unsigned long flags; -char c; +u8 c;spin_lock_irqsave (&tp->view.lock, flags);while (count--) {
Signature · 1 line
2.43.0
Jiri Slaby (SUSE)
maintainerPATCH 10/27 tty: ehv_bytechan: convert to u8 and size_t
In reply to Jiri Slaby (SUSE)Switch character types to u8 and sizes to size_t. To conform to characters/sizes in the rest of the tty layer.
--- drivers/tty/ehv_bytechan.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/tty/ehv_bytechan.c +5 -6
@@ -49,7 +49,7 @@ struct ehv_bc_data {unsigned int tx_irq;spinlock_t lock;/* lock for transmit buffer */ -unsigned char buf[BUF_SIZE ];/* transmit circular buffer */ +u8 buf[BUF_SIZE ];/* transmit circular buffer */ unsigned int head;/* circular buffer head */ unsigned int tail;/* circular buffer tail */
@@ -138,9 +138,9 @@ static int find_console_handle(void)static unsigned int local_ev_byte_channel_send (unsigned int handle,unsigned int *count, -const char *p) +const u8 *p) { -char buffer[EV_BYTE_CHANNEL_MAX_BYTES ]; +u8 buffer[EV_BYTE_CHANNEL_MAX_BYTES ];unsigned int c = *count;/*
@@ -166,7 +166,7 @@ static unsigned int local_ev_byte_channel_send(unsigned int handle,* has been sent, or if some error has occurred. * */ -static void byte_channel_spin_send (const char data) +static void byte_channel_spin_send (const u8 data) {int ret, count;
@@ -474,8 +474,7 @@ static ssize_t ehv_bc_tty_write(struct tty_struct *ttys, const u8 *s, {struct ehv_bc_data *bc = ttys->driver_data;unsigned long flags; -unsigned int len; -unsigned int written =0 ; +size_t len, written =0 ;while (1 ) {spin_lock_irqsave (&bc->lock, flags);
Signature · 1 line
2.43.0
Jiri Slaby (SUSE)
maintainerPATCH 11/27 tty: goldfish: convert to u8 and size_t
In reply to Jiri Slaby (SUSE)Switch character types to u8 and sizes to size_t. To conform to characters/sizes in the rest of the tty layer.
--- drivers/tty/goldfish.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-)
drivers/tty/goldfish.c +6 -10
@@ -50,10 +50,8 @@ static u32 goldfish_tty_line_count = 8;static u32 goldfish_tty_current_line_count;static struct goldfish_tty *goldfish_ttys; -static void do_rw_io (struct goldfish_tty *qtty, -unsigned long address, -unsigned int count, -bool is_write) +static void do_rw_io (struct goldfish_tty *qtty,unsigned long address, +size_t count,bool is_write) {unsigned long irq_flags;void __iomem *base = qtty->base;
@@ -73,10 +71,8 @@ static void do_rw_io(struct goldfish_tty *qtty,spin_unlock_irqrestore (&qtty->lock, irq_flags); } -static void goldfish_tty_rw (struct goldfish_tty *qtty, -unsigned long addr, -unsigned int count, -bool is_write) +static void goldfish_tty_rw (struct goldfish_tty *qtty,unsigned long addr, +size_t count,bool is_write) {dma_addr_t dma_handle;enum dma_data_direction dma_dir;
@@ -125,7 +121,7 @@ static void goldfish_tty_rw(struct goldfish_tty *qtty, } } -static void goldfish_tty_do_write (int line,const u8 *buf,unsigned int count) +static void goldfish_tty_do_write (int line,const u8 *buf,size_t count) {struct goldfish_tty *qtty = &goldfish_ttys[line];
@@ -136,7 +132,7 @@ static irqreturn_t goldfish_tty_interrupt(int irq, void *dev_id) {struct goldfish_tty *qtty = dev_id;void __iomem *base = qtty->base; -unsigned char *buf; +u8 *buf;u32 count; count =gf_ioread32 (base +GOLDFISH_TTY_REG_BYTES_READY );
Signature · 1 line
2.43.0
Jiri Slaby (SUSE)
maintainerPATCH 12/27 tty: hvc: convert to u8 and size_t
In reply to Jiri Slaby (SUSE)Switch character types to u8 and sizes to size_t. To conform to characters/sizes in the rest of the tty layer.
--- arch/powerpc/include/asm/hvconsole.h | 4 ++-- arch/powerpc/include/asm/hvsi.h | 18 ++++++++-------- arch/powerpc/include/asm/opal.h | 8 +++++--- arch/powerpc/platforms/powernv/opal.c | 14 +++++++------ arch/powerpc/platforms/pseries/hvconsole.c | 4 ++-- drivers/char/virtio_console.c | 10 ++++----- drivers/tty/hvc/hvc_console.h | 4 ++-- drivers/tty/hvc/hvc_dcc.c | 24 +++++++++++----------- drivers/tty/hvc/hvc_iucv.c | 18 ++++++++-------- drivers/tty/hvc/hvc_opal.c | 5 +++-- drivers/tty/hvc/hvc_riscv_sbi.c | 9 ++++---- drivers/tty/hvc/hvc_rtas.c | 11 +++++----- drivers/tty/hvc/hvc_udbg.c | 9 ++++---- drivers/tty/hvc/hvc_vio.c | 18 ++++++++-------- drivers/tty/hvc/hvc_xen.c | 23 +++++++++++---------- drivers/tty/hvc/hvsi_lib.c | 20 ++++++++++-------- 16 files changed, 107 insertions(+), 92 deletions(-)
arch/powerpc/include/asm/hvconsole.h +2 -2
@@ -21,8 +21,8 @@* Vio firmware always attempts to fetch MAX_VIO_GET_CHARS chars. The 'count' * parm is included to conform to put_chars() function pointer template */ -extern int hvc_get_chars (uint32_t vtermno,char *buf,int count); -extern int hvc_put_chars (uint32_t vtermno,const char *buf,int count); +extern ssize_t hvc_get_chars (uint32_t vtermno,u8 *buf,size_t count); +extern ssize_t hvc_put_chars (uint32_t vtermno,const u8 *buf,size_t count);/* Provided by HVC VIO */ void hvc_vio_init_early (void );
arch/powerpc/include/asm/hvsi.h +10 -8
@@ -64,7 +64,7 @@ struct hvsi_priv {unsigned int inbuf_len;/* data in input buffer */ unsigned char inbuf[HVSI_INBUF_SIZE ];unsigned int inbuf_cur;/* Cursor in input buffer */ -unsigned int inbuf_pktlen;/* packet length from cursor */ +size_t inbuf_pktlen;/* packet length from cursor */ atomic_t seqno;/* packet sequence number */ unsigned int opened:1; /* driver opened */ unsigned int established:1; /* protocol established */
@@ -72,24 +72,26 @@ struct hvsi_priv { unsigned int mctrl_update:1; /* modem control updated */unsigned short mctrl;/* modem control */ struct tty_struct *tty;/* tty structure */ -int (*get_chars)(uint32_t termno,char *buf,int count); -int (*put_chars)(uint32_t termno,const char *buf,int count); +ssize_t (*get_chars)(uint32_t termno,u8 *buf,size_t count); +ssize_t (*put_chars)(uint32_t termno,const u8 *buf,size_t count);uint32_t termno; };/* hvsi lib functions */ struct hvc_struct ;extern void hvsilib_init (struct hvsi_priv *pv, -int (*get_chars)(uint32_t termno,char *buf,int count), -int (*put_chars)(uint32_t termno,const char *buf, -int count), +ssize_t (*get_chars)(uint32_t termno,u8 *buf, +size_t count), +ssize_t (*put_chars)(uint32_t termno,const u8 *buf, +size_t count),int termno,int is_console);extern int hvsilib_open (struct hvsi_priv *pv,struct hvc_struct *hp);extern void hvsilib_close (struct hvsi_priv *pv,struct hvc_struct *hp);extern int hvsilib_read_mctrl (struct hvsi_priv *pv);extern int hvsilib_write_mctrl (struct hvsi_priv *pv,int dtr);extern void hvsilib_establish (struct hvsi_priv *pv); -extern int hvsilib_get_chars (struct hvsi_priv *pv,char *buf,int count); -extern int hvsilib_put_chars (struct hvsi_priv *pv,const char *buf,int count); +extern ssize_t hvsilib_get_chars (struct hvsi_priv *pv,u8 *buf,size_t count); +extern ssize_t hvsilib_put_chars (struct hvsi_priv *pv,const u8 *buf, +size_t count);#endif /* _HVSI_H */
arch/powerpc/include/asm/opal.h +5 -3
@@ -313,9 +313,11 @@ extern int early_init_dt_scan_recoverable_ranges(unsigned long node, const char *uname, int depth, void *data);void __init opal_configure_cores (void ); -extern int opal_get_chars (uint32_t vtermno,char *buf,int count); -extern int opal_put_chars (uint32_t vtermno,const char *buf,int total_len); -extern int opal_put_chars_atomic (uint32_t vtermno,const char *buf,int total_len); +extern ssize_t opal_get_chars (uint32_t vtermno,u8 *buf,size_t count); +extern ssize_t opal_put_chars (uint32_t vtermno,const u8 *buf, +size_t total_len); +extern ssize_t opal_put_chars_atomic (uint32_t vtermno,const u8 *buf, +size_t total_len);extern int opal_flush_chars (uint32_t vtermno,bool wait);extern int opal_flush_console (uint32_t vtermno);
arch/powerpc/platforms/powernv/opal.c +8 -6
@@ -424,7 +424,7 @@ static int __init opal_message_init(struct device_node *opal_node)return 0 ; } -int opal_get_chars (uint32_t vtermno,char *buf,int count) +ssize_t opal_get_chars (uint32_t vtermno,u8 *buf,size_t count) {s64 rc;__be64 evt, len;
@@ -441,10 +441,11 @@ int opal_get_chars(uint32_t vtermno, char *buf, int count)return 0 ; } -static int __opal_put_chars (uint32_t vtermno,const char *data,int total_len,bool atomic) +static ssize_t __opal_put_chars (uint32_t vtermno,const u8 *data, +size_t total_len,bool atomic) {unsigned long flags =0 /* shut up gcc */ ; -int written; +ssize_t written;__be64 olen;s64 rc;
@@ -484,7 +485,7 @@ static int __opal_put_chars(uint32_t vtermno, const char *data, int total_len, bif (atomic) {/* Should not happen */ pr_warn ("atomic console write returned partial " -"len=%d written=%d\n" , total_len, written); +"len=%zu written=%zd\n" , total_len, written); }if (!written) written = -EAGAIN ;
@@ -497,7 +498,7 @@ static int __opal_put_chars(uint32_t vtermno, const char *data, int total_len, breturn written; } -int opal_put_chars (uint32_t vtermno,const char *data,int total_len) +ssize_t opal_put_chars (uint32_t vtermno,const u8 *data,size_t total_len) {return __opal_put_chars (vtermno, data, total_len, false); }
@@ -508,7 +509,8 @@ int opal_put_chars(uint32_t vtermno, const char *data, int total_len)* true at the moment because console space can race with OPAL's console * writes. */ -int opal_put_chars_atomic (uint32_t vtermno,const char *data,int total_len) +ssize_t opal_put_chars_atomic (uint32_t vtermno,const u8 *data, +size_t total_len) {return __opal_put_chars (vtermno, data, total_len, true); }
arch/powerpc/platforms/pseries/hvconsole.c +2 -2
@@ -25,7 +25,7 @@* firmware. * @count: not used? */ -int hvc_get_chars (uint32_t vtermno,char *buf,int count) +ssize_t hvc_get_chars (uint32_t vtermno,u8 *buf,size_t count) {long ret;unsigned long retbuf[PLPAR_HCALL_BUFSIZE ];
@@ -52,7 +52,7 @@ EXPORT_SYMBOL(hvc_get_chars);* firmware. Must be at least 16 bytes, even if count is less than 16. * @count: Send this number of characters. */ -int hvc_put_chars (uint32_t vtermno,const char *buf,int count) +ssize_t hvc_put_chars (uint32_t vtermno,const u8 *buf,size_t count) {unsigned long *lbuf = (unsigned long *) buf;long ret;
drivers/char/virtio_console.c +5 -5
@@ -650,7 +650,7 @@ static ssize_t __send_to_port(struct port *port, struct scatterlist *sg,* Give out the data that's requested from the buffer that we have * queued up. */ -static ssize_t fill_readbuf (struct port *port,char __user *out_buf, +static ssize_t fill_readbuf (struct port *port,u8 __user *out_buf,size_t out_count,bool to_user) {struct port_buffer *buf;
@@ -669,7 +669,7 @@ static ssize_t fill_readbuf(struct port *port, char __user *out_buf,if (ret)return -EFAULT ; }else { -memcpy ((__force char *)out_buf, buf->buf + buf->offset, +memcpy ((__force u8 *)out_buf, buf->buf + buf->offset, out_count); }
@@ -1104,7 +1104,7 @@ static const struct file_operations port_fops = {* it to finish: inefficient in theory, but in practice * implementations will do it immediately. */ -static int put_chars (u32 vtermno,const char *buf,int count) +static ssize_t put_chars (u32 vtermno,const u8 *buf,size_t count) {struct port *port;struct scatterlist sg[1 ];
@@ -1132,7 +1132,7 @@ static int put_chars(u32 vtermno, const char *buf, int count)* We call out to fill_readbuf that gets us the required data from the * buffers that are queued up. */ -static int get_chars (u32 vtermno,char *buf,int count) +static ssize_t get_chars (u32 vtermno,u8 *buf,size_t count) {struct port *port;
@@ -1143,7 +1143,7 @@ static int get_chars(u32 vtermno, char *buf, int count)/* If we don't have an input queue yet, we can't get input. */ BUG_ON (!port->in_vq); -return fill_readbuf (port, (__force char __user *)buf, count, false); +return fill_readbuf (port, (__force u8 __user *)buf, count, false); }static void resize_console (struct port *port)
drivers/tty/hvc/hvc_console.h +2 -2
@@ -52,8 +52,8 @@ struct hvc_struct {/* implemented by a low level driver */ struct hv_ops { -int (*get_chars)(uint32_t vtermno,char *buf,int count); -int (*put_chars)(uint32_t vtermno,const char *buf,int count); +ssize_t (*get_chars)(uint32_t vtermno,u8 *buf,size_t count); +ssize_t (*put_chars)(uint32_t vtermno,const u8 *buf,size_t count);int (*flush)(uint32_t vtermno,bool wait);/* Callbacks for notification. Called in open, close and hangup */
drivers/tty/hvc/hvc_dcc.c +12 -12
@@ -26,10 +26,10 @@/* Lock to serialize access to DCC fifo */ static DEFINE_SPINLOCK (dcc_lock); -static DEFINE_KFIFO(inbuf, unsigned char, DCC_INBUF_SIZE); -static DEFINE_KFIFO(outbuf, unsigned char, DCC_OUTBUF_SIZE); +static DEFINE_KFIFO(inbuf, u8, DCC_INBUF_SIZE); +static DEFINE_KFIFO(outbuf, u8, DCC_OUTBUF_SIZE); -static void dcc_uart_console_putchar (struct uart_port *port,unsigned char ch) +static void dcc_uart_console_putchar (struct uart_port *port,u8 ch) {while (__dcc_getstatus () &DCC_STATUS_TX )cpu_relax ();
@@ -54,9 +54,9 @@ static int __init dcc_early_console_setup(struct earlycon_device *device,EARLYCON_DECLARE (dcc, dcc_early_console_setup); -static int hvc_dcc_put_chars (uint32_t vt,const char *buf,int count) +static ssize_t hvc_dcc_put_chars (uint32_t vt,const u8 *buf,size_t count) { -int i; +size_t i;for (i =0 ; i < count; i++) {while (__dcc_getstatus () &DCC_STATUS_TX )
@@ -68,9 +68,9 @@ static int hvc_dcc_put_chars(uint32_t vt, const char *buf, int count)return count; } -static int hvc_dcc_get_chars (uint32_t vt,char *buf,int count) +static ssize_t hvc_dcc_get_chars (uint32_t vt,u8 *buf,size_t count) { -int i; +size_t i;for (i =0 ; i < count; ++i)if (__dcc_getstatus () &DCC_STATUS_RX )
@@ -149,8 +149,8 @@ static DECLARE_WORK(dcc_pwork, dcc_put_work);*/ static void dcc_get_work (struct work_struct *work) { -unsigned char ch;unsigned long irqflags; +u8 ch;/* * Read characters from DCC and put them into the input FIFO, as
@@ -172,10 +172,10 @@ static DECLARE_WORK(dcc_gwork, dcc_get_work);* Write characters directly to the DCC if we're on core 0 and the FIFO * is empty, or write them to the FIFO if we're not. */ -static int hvc_dcc0_put_chars (u32 vt,const char *buf,int count) +static ssize_t hvc_dcc0_put_chars (u32 vt,const u8 *buf,size_t count) { -int len;unsigned long irqflags; +ssize_t len;if (!IS_ENABLED (CONFIG_HVC_DCC_SERIALIZE_SMP ))return hvc_dcc_put_chars (vt, buf, count);
@@ -211,10 +211,10 @@ static int hvc_dcc0_put_chars(u32 vt, const char *buf, int count)* Read characters directly from the DCC if we're on core 0 and the FIFO * is empty, or read them from the FIFO if we're not. */ -static int hvc_dcc0_get_chars (u32 vt,char *buf,int count) +static ssize_t hvc_dcc0_get_chars (u32 vt,u8 *buf,size_t count) { -int len;unsigned long irqflags; +ssize_t len;if (!IS_ENABLED (CONFIG_HVC_DCC_SERIALIZE_SMP ))return hvc_dcc_get_chars (vt, buf, count);
drivers/tty/hvc/hvc_iucv.c +9 -9
@@ -215,11 +215,11 @@ static void destroy_tty_buffer_list(struct list_head *list)* If the IUCV path has been severed, then -EPIPE is returned to cause a * hang up (that is issued by the HVC layer). */ -static int hvc_iucv_write (struct hvc_iucv_private *priv, -char *buf,int count,int *has_more_data) +static ssize_t hvc_iucv_write (struct hvc_iucv_private *priv, +u8 *buf,size_t count,int *has_more_data) {struct iucv_tty_buffer *rb; -int written; +ssize_t written;int rc;/* immediately return if there is no IUCV connection */
@@ -312,10 +312,10 @@ static int hvc_iucv_write(struct hvc_iucv_private *priv,* the routine locks the struct hvc_iucv_private->lock to call * helper functions. */ -static int hvc_iucv_get_chars (uint32_t vtermno,char *buf,int count) +static ssize_t hvc_iucv_get_chars (uint32_t vtermno,u8 *buf,size_t count) {struct hvc_iucv_private *priv =hvc_iucv_get_private (vtermno); -int written; +ssize_t written;int has_more_data;if (count <=0 )
@@ -352,8 +352,8 @@ static int hvc_iucv_get_chars(uint32_t vtermno, char *buf, int count)* If an existing IUCV communicaton path has been severed, -EPIPE is returned * (that can be passed to HVC layer to cause a tty hangup). */ -static int hvc_iucv_queue (struct hvc_iucv_private *priv,const char *buf, -int count) +static ssize_t hvc_iucv_queue (struct hvc_iucv_private *priv,const u8 *buf, +size_t count) {size_t len;
@@ -455,12 +455,12 @@ static void hvc_iucv_sndbuf_work(struct work_struct *work)* Locking: The method gets called under an irqsave() spinlock; and * locks struct hvc_iucv_private->lock. */ -static int hvc_iucv_put_chars (uint32_t vtermno,const char *buf,int count) +static ssize_t hvc_iucv_put_chars (uint32_t vtermno,const u8 *buf,size_t count) {struct hvc_iucv_private *priv =hvc_iucv_get_private (vtermno);int queued; -if (count <=0 ) +if (!count)return 0 ;if (!priv)
drivers/tty/hvc/hvc_opal.c +3 -2
@@ -58,7 +58,7 @@ static const struct hv_ops hvc_opal_raw_ops = { .notifier_hangup = notifier_hangup_irq, }; -static int hvc_opal_hvsi_get_chars (uint32_t vtermno,char *buf,int count) +static ssize_t hvc_opal_hvsi_get_chars (uint32_t vtermno,u8 *buf,size_t count) {struct hvc_opal_priv *pv = hvc_opal_privs[vtermno];
@@ -68,7 +68,8 @@ static int hvc_opal_hvsi_get_chars(uint32_t vtermno, char *buf, int count)return hvsilib_get_chars (&pv->hvsi, buf, count); } -static int hvc_opal_hvsi_put_chars (uint32_t vtermno,const char *buf,int count) +static ssize_t hvc_opal_hvsi_put_chars (uint32_t vtermno,const u8 *buf, +size_t count) {struct hvc_opal_priv *pv = hvc_opal_privs[vtermno];
drivers/tty/hvc/hvc_riscv_sbi.c +5 -4
@@ -15,9 +15,9 @@#include "hvc_console.h" -static int hvc_sbi_tty_put (uint32_t vtermno,const char *buf,int count) +static ssize_t hvc_sbi_tty_put (uint32_t vtermno,const u8 *buf,size_t count) { -int i; +size_t i;for (i =0 ; i < count; i++)sbi_console_putchar (buf[i]);
@@ -25,9 +25,10 @@ static int hvc_sbi_tty_put(uint32_t vtermno, const char *buf, int count)return i; } -static int hvc_sbi_tty_get (uint32_t vtermno,char *buf,int count) +static ssize_t hvc_sbi_tty_get (uint32_t vtermno,u8 *buf,size_t count) { -int i, c; +size_t i; +int c;for (i =0 ; i < count; i++) { c =sbi_console_getchar ();
drivers/tty/hvc/hvc_rtas.c +6 -5
@@ -31,10 +31,10 @@ static struct hvc_struct *hvc_rtas_dev;static int rtascons_put_char_token =RTAS_UNKNOWN_SERVICE ;static int rtascons_get_char_token =RTAS_UNKNOWN_SERVICE ; -static inline int hvc_rtas_write_console (uint32_t vtermno,const char *buf, -int count) +static ssize_t hvc_rtas_write_console (uint32_t vtermno,const u8 *buf, +size_t count) { -int i; +size_t i;for (i =0 ; i < count; i++) {if (rtas_call (rtascons_put_char_token,1 ,1 ,NULL , buf[i]))
@@ -44,9 +44,10 @@ static inline int hvc_rtas_write_console(uint32_t vtermno, const char *buf,return i; } -static int hvc_rtas_read_console (uint32_t vtermno,char *buf,int count) +static ssize_t hvc_rtas_read_console (uint32_t vtermno,u8 *buf,size_t count) { -int i, c; +size_t i; +int c;for (i =0 ; i < count; i++) {if (rtas_call (rtascons_get_char_token,0 ,2 , &c))
drivers/tty/hvc/hvc_udbg.c +5 -4
@@ -19,9 +19,9 @@static struct hvc_struct *hvc_udbg_dev; -static int hvc_udbg_put (uint32_t vtermno,const char *buf,int count) +static ssize_t hvc_udbg_put (uint32_t vtermno,const u8 *buf,size_t count) { -int i; +size_t i;for (i =0 ; i < count && udbg_putc; i++)udbg_putc (buf[i]);
@@ -29,9 +29,10 @@ static int hvc_udbg_put(uint32_t vtermno, const char *buf, int count)return i; } -static int hvc_udbg_get (uint32_t vtermno,char *buf,int count) +static ssize_t hvc_udbg_get (uint32_t vtermno,u8 *buf,size_t count) { -int i, c; +size_t i; +int c;if (!udbg_getc_poll)return 0 ;
drivers/tty/hvc/hvc_vio.c +10 -8
@@ -58,20 +58,20 @@ struct hvterm_priv {hv_protocol_t proto;/* Raw data or HVSI packets */ struct hvsi_priv hvsi;/* HVSI specific data */ spinlock_t buf_lock; -char buf[SIZE_VIO_GET_CHARS ]; -int left; -int offset; +u8 buf[SIZE_VIO_GET_CHARS ]; +size_t left; +size_t offset; };static struct hvterm_priv *hvterm_privs[MAX_NR_HVC_CONSOLES ];/* For early boot console */ static struct hvterm_priv hvterm_priv0; -static int hvterm_raw_get_chars (uint32_t vtermno,char *buf,int count) +static ssize_t hvterm_raw_get_chars (uint32_t vtermno,u8 *buf,size_t count) {struct hvterm_priv *pv = hvterm_privs[vtermno];unsigned long i;unsigned long flags; -int got; +size_t got;if (WARN_ON (!pv))return 0 ;
@@ -115,7 +115,8 @@ static int hvterm_raw_get_chars(uint32_t vtermno, char *buf, int count)* you are sending fewer chars. * @count: number of chars to send. */ -static int hvterm_raw_put_chars (uint32_t vtermno,const char *buf,int count) +static ssize_t hvterm_raw_put_chars (uint32_t vtermno,const u8 *buf, +size_t count) {struct hvterm_priv *pv = hvterm_privs[vtermno];
@@ -133,7 +134,7 @@ static const struct hv_ops hvterm_raw_ops = { .notifier_hangup = notifier_hangup_irq, }; -static int hvterm_hvsi_get_chars (uint32_t vtermno,char *buf,int count) +static ssize_t hvterm_hvsi_get_chars (uint32_t vtermno,u8 *buf,size_t count) {struct hvterm_priv *pv = hvterm_privs[vtermno];
@@ -143,7 +144,8 @@ static int hvterm_hvsi_get_chars(uint32_t vtermno, char *buf, int count)return hvsilib_get_chars (&pv->hvsi, buf, count); } -static int hvterm_hvsi_put_chars (uint32_t vtermno,const char *buf,int count) +static ssize_t hvterm_hvsi_put_chars (uint32_t vtermno,const u8 *buf, +size_t count) {struct hvterm_priv *pv = hvterm_privs[vtermno];
drivers/tty/hvc/hvc_xen.c +12 -11
@@ -84,13 +84,13 @@ static inline void notify_daemon(struct xencons_info *cons)notify_remote_via_evtchn (cons->evtchn); } -static int __write_console (struct xencons_info *xencons, -const char *data,int len) +static ssize_t __write_console (struct xencons_info *xencons, +const u8 *data,size_t len) {XENCONS_RING_IDX cons, prod;struct xencons_interface *intf = xencons->intf; -int sent =0 ;unsigned long flags; +size_t sent =0 ;spin_lock_irqsave (&xencons->ring_lock, flags); cons = intf->out_cons;
@@ -115,10 +115,11 @@ static int __write_console(struct xencons_info *xencons,return sent; } -static int domU_write_console (uint32_t vtermno,const char *data,int len) +static ssize_t domU_write_console (uint32_t vtermno,const u8 *data,size_t len) { -int ret = len;struct xencons_info *cons =vtermno_to_xencons (vtermno); +size_t ret = len; +if (cons ==NULL )return -EINVAL ;
@@ -129,7 +130,7 @@ static int domU_write_console(uint32_t vtermno, const char *data, int len)* kernel is crippled. */ while (len) { -int sent =__write_console (cons, data, len); +ssize_t sent =__write_console (cons, data, len);if (sent <0 )return sent;
@@ -144,14 +145,14 @@ static int domU_write_console(uint32_t vtermno, const char *data, int len)return ret; } -static int domU_read_console (uint32_t vtermno,char *buf,int len) +static ssize_t domU_read_console (uint32_t vtermno,u8 *buf,size_t len) {struct xencons_interface *intf;XENCONS_RING_IDX cons, prod; -int recv =0 ;struct xencons_info *xencons =vtermno_to_xencons (vtermno);unsigned int eoiflag =0 ;unsigned long flags; +size_t recv =0 ;if (xencons ==NULL )return -EINVAL ;
@@ -209,7 +210,7 @@ static const struct hv_ops domU_hvc_ops = { .notifier_hangup = notifier_hangup_irq, }; -static int dom0_read_console (uint32_t vtermno,char *buf,int len) +static ssize_t dom0_read_console (uint32_t vtermno,u8 *buf,size_t len) {return HYPERVISOR_console_io (CONSOLEIO_read, len, buf); }
@@ -218,9 +219,9 @@ static int dom0_read_console(uint32_t vtermno, char *buf, int len)* Either for a dom0 to write to the system console, or a domU with a * debug version of Xen */ -static int dom0_write_console (uint32_t vtermno,const char *str,int len) +static ssize_t dom0_write_console (uint32_t vtermno,const u8 *str,size_t len) { -int rc =HYPERVISOR_console_io (CONSOLEIO_write, len, (char *)str); +int rc =HYPERVISOR_console_io (CONSOLEIO_write, len, (u8 *)str);if (rc <0 )return rc;
drivers/tty/hvc/hvsi_lib.c +11 -9
@@ -12,7 +12,7 @@ static int hvsi_send_packet(struct hvsi_priv *pv, struct hvsi_header *packet) packet->seqno =cpu_to_be16 (atomic_inc_return (&pv->seqno));/* Assumes that always succeeds, works in practice */ -return pv->put_chars (pv->termno, (char *)packet, packet->len); +return pv->put_chars (pv->termno, (u8 *)packet, packet->len); }static void hvsi_start_handshake (struct hvsi_priv *pv)
@@ -178,9 +178,10 @@ static int hvsi_get_packet(struct hvsi_priv *pv)return 0 ; } -int hvsilib_get_chars (struct hvsi_priv *pv,char *buf,int count) +ssize_t hvsilib_get_chars (struct hvsi_priv *pv,u8 *buf,size_t count) { -unsigned int tries, read =0 ; +unsigned int tries; +size_t read =0 ;if (WARN_ON (!pv))return -ENXIO ;
@@ -199,7 +200,7 @@ int hvsilib_get_chars(struct hvsi_priv *pv, char *buf, int count)for (tries =1 ; count && tries <2 ; tries++) {/* Consume existing data packet */ if (pv->inbuf_pktlen) { -unsigned int l =min (count, (int )pv->inbuf_pktlen); +size_t l =min (count, pv->inbuf_pktlen);memcpy (&buf[read], &pv->inbuf[pv->inbuf_cur], l); pv->inbuf_cur += l; pv->inbuf_pktlen -= l;
@@ -228,10 +229,11 @@ int hvsilib_get_chars(struct hvsi_priv *pv, char *buf, int count)return read; } -int hvsilib_put_chars (struct hvsi_priv *pv,const char *buf,int count) +ssize_t hvsilib_put_chars (struct hvsi_priv *pv,const u8 *buf,size_t count) {struct hvsi_data dp; -int rc, adjcount =min (count,HVSI_MAX_OUTGOING_DATA ); +size_t adjcount =min_t (size_t, count,HVSI_MAX_OUTGOING_DATA ); +int rc;if (WARN_ON (!pv))return -ENODEV ;
@@ -411,9 +413,9 @@ void hvsilib_close(struct hvsi_priv *pv, struct hvc_struct *hp) }void hvsilib_init (struct hvsi_priv *pv, -int (*get_chars)(uint32_t termno,char *buf,int count), -int (*put_chars)(uint32_t termno,const char *buf, -int count), +ssize_t (*get_chars)(uint32_t termno,u8 *buf,size_t count), +ssize_t (*put_chars)(uint32_t termno,const u8 *buf, +size_t count),int termno,int is_console) {memset (pv,0 ,sizeof (*pv));
Signature · 1 line
2.43.0
Jiri Slaby (SUSE)
maintainerPATCH 13/27 tty: ipoctal: convert to u8 and size_t
In reply to Jiri Slaby (SUSE)Switch character types to u8 and sizes to size_t. To conform to characters/sizes in the rest of the tty layer.
--- drivers/ipack/devices/ipoctal.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/ipack/devices/ipoctal.c +6 -8
@@ -158,9 +158,7 @@ static int ipoctal_get_icount(struct tty_struct *tty,static void ipoctal_irq_rx (struct ipoctal_channel *channel,u8 sr) {struct tty_port *port = &channel->tty_port; -unsigned char value; -unsigned char flag; -u8 isr; +u8 isr, value, flag; do { value = ioread8(&channel->regs->r.rhr);
@@ -202,8 +200,8 @@ static void ipoctal_irq_rx(struct ipoctal_channel *channel, u8 sr)static void ipoctal_irq_tx (struct ipoctal_channel *channel) { -unsigned char value;unsigned int *pointer_write = &channel->pointer_write; +u8 value;if (channel->nb_bytes ==0 )return ;
@@ -436,11 +434,11 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr,return res; } -static inline int ipoctal_copy_write_buffer (struct ipoctal_channel *channel, -const u8 *buf,int count) +static inline size_t ipoctal_copy_write_buffer (struct ipoctal_channel *channel, +const u8 *buf,size_t count) {unsigned long flags; -int i; +size_t i;unsigned int *pointer_read = &channel->pointer_read;/* Copy the bytes from the user buffer to the internal one */
@@ -462,7 +460,7 @@ static ssize_t ipoctal_write_tty(struct tty_struct *tty, const u8 *buf, size_t count) {struct ipoctal_channel *channel = tty->driver_data; -unsigned int char_copied; +size_t char_copied; char_copied =ipoctal_copy_write_buffer (channel, buf, count);
Signature · 1 line
2.43.0
Jiri Slaby (SUSE)
maintainerPATCH 14/27 tty: m68k: nfcon: convert to u8 and size_t
In reply to Jiri Slaby (SUSE)Switch character types to u8 and sizes to size_t. To conform to characters/sizes in the rest of the tty layer.
--- arch/m68k/emu/nfcon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/m68k/emu/nfcon.c +2 -2
@@ -23,9 +23,9 @@ static int stderr_id;static struct tty_port nfcon_tty_port;static struct tty_driver *nfcon_tty_driver; -static void nfputs (const char *str,unsigned int count) +static void nfputs (const u8 *str,size_t count) { -char buf[68 ]; +u8 buf[68 ];unsigned long phys =virt_to_phys (buf); buf[64 ] =0 ;
Signature · 1 line
2.43.0
Jiri Slaby (SUSE)
maintainerPATCH 15/27 tty: mips_ejtag_fdc: use u8 for character pointers
In reply to Jiri Slaby (SUSE)mips_ejtag_fdc_encode() and mips_ejtag_fdc_put_chan() declare arrays of pointers to characters. Switch their types from char to u8 to conform to the current tty layer types for characters.
--- drivers/tty/mips_ejtag_fdc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/tty/mips_ejtag_fdc.c +5 -5
@@ -213,16 +213,16 @@ struct fdc_word {*/ /* ranges >= 1 && sizes[0] >= 1 */ -static struct fdc_word mips_ejtag_fdc_encode (const char **ptrs, +static struct fdc_word mips_ejtag_fdc_encode (const u8 **ptrs,unsigned int *sizes,unsigned int ranges) {struct fdc_word word = {0 ,0 }; -const char **ptrs_end = ptrs + ranges; +const u8 **ptrs_end = ptrs + ranges;for (; ptrs < ptrs_end; ++ptrs) { -const char *ptr = *(ptrs++); -const char *end = ptr + *(sizes++); +const u8 *ptr = *(ptrs++); +const u8 *end = ptr + *(sizes++);for (; ptr < end; ++ptr) { word.word |= (u8)*ptr << (8 *word.bytes);
@@ -417,7 +417,7 @@ static unsigned int mips_ejtag_fdc_put_chan(struct mips_ejtag_fdc_tty *priv, {struct mips_ejtag_fdc_tty_port *dport;struct tty_struct *tty; -const char *ptrs[2 ]; +const u8 *ptrs[2 ];unsigned int sizes[2 ] = {0 };struct fdc_word word = { .bytes =0 };unsigned long flags;
Signature · 1 line
2.43.0
Jiri Slaby (SUSE)
maintainerPATCH 16/27 tty: mmc: sdio: use u8 for flag
In reply to Jiri Slaby (SUSE)Switch character types to u8. To conform to characters in the rest of the tty layer.
--- drivers/mmc/core/sdio_uart.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mmc/core/sdio_uart.c +1 -2
@@ -354,12 +354,11 @@ static void sdio_uart_stop_rx(struct sdio_uart_port *port) static void sdio_uart_receive_chars(struct sdio_uart_port *port, u8 *status) { - unsigned int flag; int max_count = 256; do { u8 ch = sdio_in(port, UART_RX); - flag = TTY_NORMAL; + u8 flag = TTY_NORMAL; port->icount.rx++; if (unlikely(*status & (UART_LSR_BI | UART_LSR_PE |
Signature · 1 line
2.43.0
Jiri Slaby (SUSE)
maintainerPATCH 17/27 tty: moxa: convert to u8 and size_t
In reply to Jiri Slaby (SUSE)Switch character types to u8 and sizes to size_t. To conform to characters/sizes in the rest of the tty layer.
--- drivers/tty/moxa.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/tty/moxa.c +8 -7
@@ -514,7 +514,7 @@ static void MoxaPortLineCtrl(struct moxa_port *, bool, bool);static void MoxaPortFlowCtrl (struct moxa_port *,int ,int ,int ,int ,int );static int MoxaPortLineStatus (struct moxa_port *);static void MoxaPortFlushData (struct moxa_port *,int ); -static int MoxaPortWriteData (struct tty_struct *,const unsigned char *,int ); +static ssize_t MoxaPortWriteData (struct tty_struct *,const u8 *,size_t );static int MoxaPortReadData (struct moxa_port *);static unsigned int MoxaPortTxQueue (struct moxa_port *);static int MoxaPortRxQueue (struct moxa_port *);
@@ -1933,10 +1933,10 @@ static void MoxaPortFlushData(struct moxa_port *port, int mode)* * Function 20: Write data. * Syntax: -* int MoxaPortWriteData(int port, unsigned char * buffer, int length); +* ssize_t MoxaPortWriteData(int port, u8 *buffer, size_t length); * int port : port number (0 - 127) -* unsigned char * buffer : pointer to write data buffer. -* int length : write data length +* u8 *buffer : pointer to write data buffer. +* size_t length : write data length * * return: 0 - length : real write data length *
@@ -2163,11 +2163,12 @@ static int MoxaPortLineStatus(struct moxa_port *port)return val; } -static int MoxaPortWriteData (struct tty_struct *tty,const u8 *buffer,int len) +static ssize_t MoxaPortWriteData (struct tty_struct *tty,const u8 *buffer, +size_t len) {struct moxa_port *port = tty->driver_data;void __iomem *baseAddr, *ofsAddr, *ofs; -unsigned int c, total; +size_t c, total;u16 head, tail, tx_mask, spage, epage;u16 pageno, pageofs, bufhead;
@@ -2224,8 +2225,8 @@ static int MoxaPortWriteData(struct tty_struct *tty, const u8 *buffer, int len)static int MoxaPortReadData (struct moxa_port *port) {struct tty_struct *tty = port->port.tty; -unsigned char *dst;void __iomem *baseAddr, *ofsAddr, *ofs; +u8 *dst;unsigned int count, len, total;u16 tail, rx_mask, spage, epage;u16 pageno, pageofs, bufhead, head;
Signature · 1 line
2.43.0
Jiri Slaby (SUSE)
maintainerPATCH 18/27 tty: mxser: convert to u8 and size_t
In reply to Jiri Slaby (SUSE)Switch character types to u8 and sizes to size_t. To conform to characters/sizes in the rest of the tty layer.
--- drivers/tty/mxser.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/tty/mxser.c +4 -4
@@ -264,7 +264,7 @@ struct mxser_port {u8 rx_low_water;int type;/* UART type */ -unsigned char x_char;/* xon/xoff character */ +u8 x_char;/* xon/xoff character */ u8 IER ;/* Interrupt Enable Register */ u8 MCR ;/* Modem control register */ u8 FCR ;/* FIFO control register */
@@ -905,7 +905,7 @@ static ssize_t mxser_write(struct tty_struct *tty, const u8 *buf, size_t count) {struct mxser_port *info = tty->driver_data;unsigned long flags; -int written; +size_t written;bool is_empty;spin_lock_irqsave (&info->slock, flags);
@@ -1521,7 +1521,7 @@ static u8 mxser_receive_chars_old(struct tty_struct *tty,if (++ignored >100 )break ; }else { -char flag =0 ; +u8 flag =0 ;if (status &UART_LSR_BRK_ERROR_BITS ) {if (status &UART_LSR_BI ) { flag =TTY_BREAK ;
@@ -1585,7 +1585,7 @@ static void mxser_transmit_chars(struct tty_struct *tty, struct mxser_port *port count = port->xmit_fifo_size; do { - unsigned char c; + u8 c; if (!kfifo_get(&port->port.xmit_fifo, &c)) break;
Signature · 1 line
2.43.0
Jiri Slaby (SUSE)
maintainerPATCH 19/27 tty: n_gsm: convert to u8 and size_t
In reply to Jiri Slaby (SUSE)Switch character types to u8 and sizes to size_t. To conform to characters/sizes in the rest of the tty layer.
--- drivers/tty/n_gsm.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/tty/n_gsm.c +8 -9
@@ -124,8 +124,8 @@ struct gsm_msg {u8 addr;/* DLCI address + flags */ u8 ctrl;/* Control byte + flags */ unsigned int len;/* Length of data block (can be zero) */ -unsigned char *data;/* Points into buffer but not at the start */ -unsigned char buffer[]; +u8 *data;/* Points into buffer but not at the start */ +u8 buffer[]; };enum gsm_dlci_state {
@@ -283,7 +283,7 @@ struct gsm_mux {/* Bits for GSM mode decoding */ /* Framing Layer */ -unsigned char *buf; +u8 *buf;enum gsm_mux_state state;unsigned int len;unsigned int address;
@@ -2856,7 +2856,7 @@ static void gsm_queue(struct gsm_mux *gsm)* Receive bytes in gsm mode 0 */ -static void gsm0_receive (struct gsm_mux *gsm,unsigned char c) +static void gsm0_receive (struct gsm_mux *gsm,u8 c) {unsigned int len;
@@ -2947,7 +2947,7 @@ static void gsm0_receive(struct gsm_mux *gsm, unsigned char c)* Receive bytes in mode 1 (Advanced option) */ -static void gsm1_receive (struct gsm_mux *gsm,unsigned char c) +static void gsm1_receive (struct gsm_mux *gsm,u8 c) {/* handle XON/XOFF */ if ((c &ISO_IEC_646_MASK ) ==XON ) {
@@ -3541,7 +3541,7 @@ static void gsmld_receive_buf(struct tty_struct *tty, const u8 *cp, const u8 *fp, size_t count) {struct gsm_mux *gsm = tty->disc_data; -char flags =TTY_NORMAL ; +u8 flags =TTY_NORMAL ;if (debug &DBG_DATA )gsm_hex_dump_bytes (__func__, cp, count);
@@ -3711,7 +3711,7 @@ static ssize_t gsmld_write(struct tty_struct *tty, struct file *file, {struct gsm_mux *gsm = tty->disc_data;unsigned long flags; -int space; +size_t space;int ret;if (!gsm)
@@ -3909,8 +3909,7 @@ static void gsm_mux_net_tx_timeout(struct net_device *net, unsigned int txqueue) net->stats.tx_errors++; } -static void gsm_mux_rx_netchar (struct gsm_dlci *dlci, -const unsigned char *in_buf,int size) +static void gsm_mux_rx_netchar (struct gsm_dlci *dlci,const u8 *in_buf,int size) {struct net_device *net = dlci->net;struct sk_buff *skb;
Signature · 1 line
2.43.0
Jiri Slaby (SUSE)
maintainerPATCH 20/27 tty: n_hdlc: convert to u8 and size_t
In reply to Jiri Slaby (SUSE)Switch character types to u8 and sizes to size_t. To conform to characters/sizes in the rest of the tty layer.
Note u8 is already both passed in and expected on output.
--- drivers/tty/n_hdlc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/tty/n_hdlc.c +5 -5
@@ -109,8 +109,8 @@struct n_hdlc_buf {struct list_head list_item; -int count; -char buf[]; +size_t count; +u8 buf[]; };struct n_hdlc_buf_list {
@@ -263,9 +263,9 @@ static int n_hdlc_tty_open(struct tty_struct *tty)*/ static void n_hdlc_send_frames (struct n_hdlc *n_hdlc,struct tty_struct *tty) { - registerint actual;unsigned long flags;struct n_hdlc_buf *tbuf; +ssize_t actual; check_again:
@@ -281,7 +281,7 @@ static void n_hdlc_send_frames(struct n_hdlc *n_hdlc, struct tty_struct *tty) tbuf =n_hdlc_buf_get (&n_hdlc->tx_buf_list);while (tbuf) { -pr_debug ("sending frame %p, count=%d\n" , tbuf, tbuf->count); +pr_debug ("sending frame %p, count=%zu\n" , tbuf, tbuf->count);/* Send the next block of data to device */ set_bit (TTY_DO_WRITE_WAKEUP , &tty->flags);
@@ -521,9 +521,9 @@ static ssize_t n_hdlc_tty_write(struct tty_struct *tty, struct file *file, const u8 *data, size_t count) { struct n_hdlc *n_hdlc = tty->disc_data; -int error =0 ;DECLARE_WAITQUEUE (wait, current);struct n_hdlc_buf *tbuf; +ssize_t error =0 ;pr_debug ("%s() called count=%zd\n" , __func__, count);
Signature · 1 line
2.43.0
Jiri Slaby (SUSE)
maintainerPATCH 21/27 tty: nozomi: convert to u8 and size_t
In reply to Jiri Slaby (SUSE)Switch character types to u8 and sizes to size_t. To conform to characters/sizes in the rest of the tty layer.
--- drivers/tty/nozomi.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/tty/nozomi.c +4 -5
@@ -783,11 +783,10 @@ static int receive_data(enum port_type index, struct nozomi *dc)tty_insert_flip_char (&port->port, buf[0 ],TTY_NORMAL ); size =0 ; }else if (size <RECEIVE_BUF_MAX ) { - size -=tty_insert_flip_string (&port->port, - (char *)buf, size); + size -=tty_insert_flip_string (&port->port, buf, size); }else { - i =tty_insert_flip_string (&port->port, - (char *)buf,RECEIVE_BUF_MAX ); + i =tty_insert_flip_string (&port->port, buf, +RECEIVE_BUF_MAX ); size -= i; offset += i; }
@@ -1584,10 +1583,10 @@ static void ntty_hangup(struct tty_struct *tty)static ssize_t ntty_write (struct tty_struct *tty,const u8 *buffer,size_t count) { -int rval = -EINVAL ;struct nozomi *dc =get_dc_by_tty (tty);struct port *port = tty->driver_data;unsigned long flags; +size_t rval;if (!dc || !port)return -ENODEV ;
Signature · 1 line
2.43.0
Jiri Slaby (SUSE)
maintainerPATCH 22/27 tty: serdev: convert to u8 and size_t in serdev_controller_ops
In reply to Jiri Slaby (SUSE)Switch character types to u8 and sizes to size_t. To conform to characters/sizes in the rest of the tty layer.
In this patch, only struct serdev_controller_ops hooks. The rest will follow.
--- drivers/tty/serdev/serdev-ttyport.c | 2 +- include/linux/serdev.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/tty/serdev/serdev-ttyport.c +1 -1
@@ -74,7 +74,7 @@ static const struct tty_port_client_operations client_ops = {* Callback functions from the serdev core. */ -static int ttyport_write_buf (struct serdev_controller *ctrl,const unsigned char *data,size_t len) +static ssize_t ttyport_write_buf (struct serdev_controller *ctrl,const u8 *data,size_t len) {struct serport *serport =serdev_controller_get_drvdata (ctrl);struct tty_struct *tty = serport->tty;
include/linux/serdev.h +4 -4
@@ -82,7 +82,7 @@ enum serdev_parity {* serdev controller structures */ struct serdev_controller_ops { -int (*write_buf)(struct serdev_controller *,const unsigned char *,size_t ); +ssize_t (*write_buf)(struct serdev_controller *,const u8 *,size_t );void (*write_flush)(struct serdev_controller *);int (*write_room)(struct serdev_controller *);int (*open)(struct serdev_controller *);
@@ -185,9 +185,9 @@ static inline void serdev_controller_write_wakeup(struct serdev_controller *ctrl serdev->ops->write_wakeup (serdev); } -static inline int serdev_controller_receive_buf (struct serdev_controller *ctrl, -const unsigned char *data, -size_t count) +static inline ssize_t serdev_controller_receive_buf (struct serdev_controller *ctrl, +const u8 *data, +size_t count) {struct serdev_device *serdev = ctrl->serdev;
Signature · 1 line
2.43.0
Jiri Slaby (SUSE)
maintainerPATCH 23/27 tty: serdev: convert to u8 and size_t
In reply to Jiri Slaby (SUSE)Switch character types to u8 and sizes to size_t. To conform to characters/sizes in the rest of the tty layer.
This patch converts struct serdev_device_ops hooks and its instantiations.
--- drivers/bluetooth/btmtkuart.c | 4 ++-- drivers/bluetooth/btnxpuart.c | 4 ++-- drivers/bluetooth/hci_serdev.c | 4 ++-- drivers/gnss/serial.c | 4 ++-- drivers/gnss/sirf.c | 4 ++-- drivers/greybus/gb-beagleplay.c | 5 +++-- drivers/iio/chemical/pms7003.c | 6 +++--- drivers/iio/chemical/scd30_serial.c | 6 +++--- drivers/iio/chemical/sps30_serial.c | 18 +++++++++--------- drivers/iio/imu/bno055/bno055_ser_core.c | 6 +++--- drivers/mfd/rave-sp.c | 10 +++++----- drivers/net/ethernet/qualcomm/qca_uart.c | 5 ++--- drivers/nfc/pn533/uart.c | 4 ++-- drivers/nfc/s3fwrn5/uart.c | 5 ++--- drivers/platform/chrome/cros_ec_uart.c | 5 ++--- .../platform/surface/aggregator/controller.h | 4 ++-- drivers/platform/surface/aggregator/core.c | 4 ++-- .../surface/aggregator/ssh_packet_layer.c | 4 ++-- .../surface/aggregator/ssh_packet_layer.h | 2 +- drivers/tty/serdev/core.c | 12 +++++------- include/linux/serdev.h | 13 +++++++------ sound/drivers/serial-generic.c | 4 ++-- 22 files changed, 65 insertions(+), 68 deletions(-)
drivers/bluetooth/btmtkuart.c +2 -2
@@ -385,8 +385,8 @@ static int btmtkuart_recv(struct hci_dev *hdev, const u8 *data, size_t count)return 0 ; } -static int btmtkuart_receive_buf (struct serdev_device *serdev,const u8 *data, -size_t count) +static ssize_t btmtkuart_receive_buf (struct serdev_device *serdev, +const u8 *data,size_t count) {struct btmtkuart_dev *bdev =serdev_device_get_drvdata (serdev);int err;
drivers/bluetooth/btnxpuart.c +2 -2
@@ -1264,8 +1264,8 @@ static const struct h4_recv_pkt nxp_recv_pkts[] = { { NXP_RECV_FW_REQ_V3, .recv = nxp_recv_fw_req_v3 }, }; -static int btnxpuart_receive_buf (struct serdev_device *serdev,const u8 *data, -size_t count) +static ssize_t btnxpuart_receive_buf (struct serdev_device *serdev, +const u8 *data,size_t count) {struct btnxpuart_dev *nxpdev =serdev_device_get_drvdata (serdev);
drivers/bluetooth/hci_serdev.c +2 -2
@@ -271,8 +271,8 @@ static void hci_uart_write_wakeup(struct serdev_device *serdev)* * Return: number of processed bytes */ -static int hci_uart_receive_buf (struct serdev_device *serdev,const u8 *data, -size_t count) +static ssize_t hci_uart_receive_buf (struct serdev_device *serdev, +const u8 *data,size_t count) {struct hci_uart *hu =serdev_device_get_drvdata (serdev);
drivers/gnss/serial.c +2 -2
@@ -80,8 +80,8 @@ static const struct gnss_operations gnss_serial_gnss_ops = { .write_raw = gnss_serial_write_raw, }; -static int gnss_serial_receive_buf (struct serdev_device *serdev, -const unsigned char *buf,size_t count) +static ssize_t gnss_serial_receive_buf (struct serdev_device *serdev, +const u8 *buf,size_t count) {struct gnss_serial *gserial =serdev_device_get_drvdata (serdev);struct gnss_device *gdev = gserial->gdev;
drivers/gnss/sirf.c +2 -2
@@ -160,8 +160,8 @@ static const struct gnss_operations sirf_gnss_ops = { .write_raw = sirf_write_raw, }; -static int sirf_receive_buf (struct serdev_device *serdev, -const unsigned char *buf,size_t count) +static ssize_t sirf_receive_buf (struct serdev_device *serdev, +const u8 *buf,size_t count) {struct sirf_data *data =serdev_device_get_drvdata (serdev);struct gnss_device *gdev = data->gdev;
drivers/greybus/gb-beagleplay.c +3 -2
@@ -257,7 +257,7 @@ static void hdlc_rx_frame(struct gb_beagleplay *bg) } } -static int hdlc_rx (struct gb_beagleplay *bg,const u8 *data,size_t count) +static ssize_t hdlc_rx (struct gb_beagleplay *bg,const u8 *data,size_t count) {size_t i;u8 c;
@@ -317,7 +317,8 @@ static void hdlc_deinit(struct gb_beagleplay *bg)flush_work (&bg->tx_work); } -static int gb_tty_receive (struct serdev_device *sd,const unsigned char *data,size_t count) +static ssize_t gb_tty_receive (struct serdev_device *sd,const u8 *data, +size_t count) {struct gb_beagleplay *bg =serdev_device_get_drvdata (sd);
drivers/iio/chemical/pms7003.c +3 -3
@@ -211,13 +211,13 @@ static bool pms7003_frame_is_okay(struct pms7003_frame *frame)return checksum ==pms7003_calc_checksum (frame); } -static int pms7003_receive_buf (struct serdev_device *serdev, -const unsigned char *buf,size_t size) +static ssize_t pms7003_receive_buf (struct serdev_device *serdev,const u8 *buf, +size_t size) {struct iio_dev *indio_dev =serdev_device_get_drvdata (serdev);struct pms7003_state *state =iio_priv (indio_dev);struct pms7003_frame *frame = &state->frame; -int num; +size_t num;if (!frame->expected_length) {u16 magic;
drivers/iio/chemical/scd30_serial.c +3 -3
@@ -174,13 +174,13 @@ static int scd30_serdev_command(struct scd30_state *state, enum scd30_cmd cmd, ureturn 0 ; } -static int scd30_serdev_receive_buf (struct serdev_device *serdev, -const unsigned char *buf,size_t size) +static ssize_t scd30_serdev_receive_buf (struct serdev_device *serdev, +const u8 *buf,size_t size) {struct iio_dev *indio_dev =serdev_device_get_drvdata (serdev);struct scd30_serdev_priv *priv;struct scd30_state *state; -int num; +size_t num;if (!indio_dev)return 0 ;
drivers/iio/chemical/sps30_serial.c +9 -9
@@ -74,8 +74,8 @@ static int sps30_serial_xfer(struct sps30_state *state, const unsigned char *buf }static const struct { -unsigned char byte; -unsigned char byte2; +u8 byte; +u8 byte2; } sps30_serial_bytes[] = { {0x11 ,0x31 }, {0x13 ,0x33 },
@@ -83,7 +83,7 @@ static const struct { { 0x7d, 0x5d }, }; -static int sps30_serial_put_byte (unsigned char *buf,unsigned char byte) +static int sps30_serial_put_byte (u8 *buf,u8 byte) {int i;
@@ -102,7 +102,7 @@ static int sps30_serial_put_byte(unsigned char *buf, unsigned char byte)return 1 ; } -static char sps30_serial_get_byte (bool escaped,unsigned char byte2) +static u8 sps30_serial_get_byte (bool escaped,u8 byte2) {int i;
@@ -130,8 +130,8 @@ static unsigned char sps30_serial_calc_chksum(const unsigned char *buf, size_t nreturn ~chksum; } -static int sps30_serial_prep_frame (unsigned char *buf,unsigned char cmd, -const unsigned char *arg,size_t arg_size) +static int sps30_serial_prep_frame (u8 *buf,u8 cmd,const u8 *arg, +size_t arg_size) {unsigned char chksum;int num =0 ;
@@ -210,14 +210,14 @@ static int sps30_serial_command(struct sps30_state *state, unsigned char cmd,return rsp_size; } -static int sps30_serial_receive_buf (struct serdev_device *serdev, -const unsigned char *buf,size_t size) +static ssize_t sps30_serial_receive_buf (struct serdev_device *serdev, +const u8 *buf,size_t size) {struct iio_dev *indio_dev =dev_get_drvdata (&serdev->dev);struct sps30_serial_priv *priv;struct sps30_state *state; -unsigned char byte;size_t i; +u8 byte;if (!indio_dev)return 0 ;
drivers/iio/imu/bno055/bno055_ser_core.c +3 -3
@@ -378,12 +378,12 @@ static void bno055_ser_handle_rx(struct bno055_ser_priv *priv, int status)* Also, we assume to RX one pkt per time (i.e. the HW doesn't send anything * unless we require to AND we don't queue more than one request per time). */ -static int bno055_ser_receive_buf (struct serdev_device *serdev, -const unsigned char *buf,size_t size) +static ssize_t bno055_ser_receive_buf (struct serdev_device *serdev, +const u8 *buf,size_t size) {int status;struct bno055_ser_priv *priv =serdev_device_get_drvdata (serdev); -int remaining = size; +size_t remaining = size;if (size ==0 )return 0 ;
drivers/mfd/rave-sp.c +5 -5
@@ -471,17 +471,17 @@ static void rave_sp_receive_frame(struct rave_sp *sp,rave_sp_receive_reply (sp, data, length); } -static int rave_sp_receive_buf (struct serdev_device *serdev, -const unsigned char *buf,size_t size) +static ssize_t rave_sp_receive_buf (struct serdev_device *serdev, +const u8 *buf,size_t size) {struct device *dev = &serdev->dev;struct rave_sp *sp =dev_get_drvdata (dev);struct rave_sp_deframer *deframer = &sp->deframer; -const unsigned char *src = buf; -const unsigned char *end = buf + size; +const u8 *src = buf; +const u8 *end = buf + size;while (src < end) { -const unsigned char byte = *src++; +const u8 byte = *src++;switch (deframer->state) {case RAVE_SP_EXPECT_SOF :
drivers/net/ethernet/qualcomm/qca_uart.c +2 -3
@@ -58,9 +58,8 @@ struct qcauart {unsigned char *tx_buffer; }; -static int -qca_tty_receive (struct serdev_device *serdev,const unsigned char *data, -size_t count) +static ssize_t +qca_tty_receive (struct serdev_device *serdev,const u8 *data,size_t count) {struct qcauart *qca =serdev_device_get_drvdata (serdev);struct net_device *netdev = qca->net_dev;
drivers/nfc/pn533/uart.c +2 -2
@@ -203,8 +203,8 @@ static int pn532_uart_rx_is_frame(struct sk_buff *skb)return 0 ; } -static int pn532_receive_buf (struct serdev_device *serdev, -const unsigned char *data,size_t count) +static ssize_t pn532_receive_buf (struct serdev_device *serdev, +const u8 *data,size_t count) {struct pn532_uart_phy *dev =serdev_device_get_drvdata (serdev);size_t i;
drivers/nfc/s3fwrn5/uart.c +2 -3
@@ -51,9 +51,8 @@ static const struct s3fwrn5_phy_ops uart_phy_ops = { .write = s3fwrn82_uart_write, }; -static int s3fwrn82_uart_read (struct serdev_device *serdev, -const unsigned char *data, -size_t count) +static ssize_t s3fwrn82_uart_read (struct serdev_device *serdev, +const u8 *data,size_t count) {struct s3fwrn82_uart_phy *phy =serdev_device_get_drvdata (serdev);size_t i;
drivers/platform/chrome/cros_ec_uart.c +2 -3
@@ -81,9 +81,8 @@ struct cros_ec_uart {struct response_info response; }; -static int cros_ec_uart_rx_bytes (struct serdev_device *serdev, -const u8 *data, -size_t count) +static ssize_t cros_ec_uart_rx_bytes (struct serdev_device *serdev, +const u8 *data,size_t count) {struct ec_host_response *host_response;struct cros_ec_device *ec_dev =serdev_device_get_drvdata (serdev);
drivers/platform/surface/aggregator/controller.h +2 -2
@@ -238,8 +238,8 @@ struct ssam_controller {* layer of the controller has been shut down, %-ESHUTDOWN. */ static inline -int ssam_controller_receive_buf (struct ssam_controller *ctrl, -const unsigned char *buf,size_t n) +ssize_t ssam_controller_receive_buf (struct ssam_controller *ctrl,const u8 *buf, +size_t n) {return ssh_ptl_rx_rcvbuf (&ctrl->rtl.ptl, buf, n); }
drivers/platform/surface/aggregator/core.c +2 -2
@@ -227,8 +227,8 @@ EXPORT_SYMBOL_GPL(ssam_client_bind);/* -- Glue layer (serdev_device -> ssam_controller). ------------------------ */ -static int ssam_receive_buf (struct serdev_device *dev,const unsigned char *buf, -size_t n) +static ssize_t ssam_receive_buf (struct serdev_device *dev,const u8 *buf, +size_t n) {struct ssam_controller *ctrl;int ret;
drivers/platform/surface/aggregator/ssh_packet_layer.c +2 -2
@@ -1887,9 +1887,9 @@ int ssh_ptl_rx_stop(struct ssh_ptl *ptl)* Return: Returns the number of bytes transferred (positive or zero) on * success. Returns %-ESHUTDOWN if the packet layer has been shut down. */ -int ssh_ptl_rx_rcvbuf (struct ssh_ptl *ptl,const u8 *buf,size_t n) +ssize_t ssh_ptl_rx_rcvbuf (struct ssh_ptl *ptl,const u8 *buf,size_t n) { -int used; +size_t used;if (test_bit (SSH_PTL_SF_SHUTDOWN_BIT , &ptl->state))return -ESHUTDOWN ;
drivers/platform/surface/aggregator/ssh_packet_layer.h +1 -1
@@ -162,7 +162,7 @@ void ssh_ptl_shutdown(struct ssh_ptl *ptl);int ssh_ptl_submit (struct ssh_ptl *ptl,struct ssh_packet *p);void ssh_ptl_cancel (struct ssh_packet *p); -int ssh_ptl_rx_rcvbuf (struct ssh_ptl *ptl,const u8 *buf,size_t n); +ssize_t ssh_ptl_rx_rcvbuf (struct ssh_ptl *ptl,const u8 *buf,size_t n);/** * ssh_ptl_tx_wakeup_transfer() - Wake up packet transmitter thread for
drivers/tty/serdev/core.c +5 -7
@@ -225,8 +225,7 @@ EXPORT_SYMBOL_GPL(serdev_device_write_wakeup);* Return: The number of bytes written (less than count if not enough room in * the write buffer), or a negative errno on errors. */ -int serdev_device_write_buf (struct serdev_device *serdev, -const unsigned char *buf,size_t count) +int serdev_device_write_buf (struct serdev_device *serdev,const u8 *buf,size_t count) {struct serdev_controller *ctrl = serdev->ctrl;
@@ -259,13 +258,12 @@ EXPORT_SYMBOL_GPL(serdev_device_write_buf);* -ETIMEDOUT or -ERESTARTSYS if interrupted before any bytes were written, or * a negative errno on errors. */ -int serdev_device_write (struct serdev_device *serdev, -const unsigned char *buf,size_t count, -long timeout) +ssize_t serdev_device_write (struct serdev_device *serdev,const u8 *buf, +size_t count,long timeout) {struct serdev_controller *ctrl = serdev->ctrl; -int written =0 ; -int ret; +size_t written =0 ; +ssize_t ret;if (!ctrl || !ctrl->ops->write_buf || !serdev->ops->write_wakeup)return -EINVAL ;
include/linux/serdev.h +7 -6
@@ -27,7 +27,7 @@ struct serdev_device;* not sleep. */ struct serdev_device_ops { -int (*receive_buf)(struct serdev_device *,const unsigned char *,size_t ); +ssize_t (*receive_buf)(struct serdev_device *,const u8 *,size_t );void (*write_wakeup)(struct serdev_device *); };
@@ -204,13 +204,13 @@ void serdev_device_close(struct serdev_device *);int devm_serdev_device_open (struct device *,struct serdev_device *);unsigned int serdev_device_set_baudrate (struct serdev_device *,unsigned int );void serdev_device_set_flow_control (struct serdev_device *,bool ); -int serdev_device_write_buf (struct serdev_device *,const unsigned char *,size_t ); +int serdev_device_write_buf (struct serdev_device *,const u8 *,size_t );void serdev_device_wait_until_sent (struct serdev_device *,long );int serdev_device_get_tiocm (struct serdev_device *);int serdev_device_set_tiocm (struct serdev_device *,int ,int );int serdev_device_break_ctl (struct serdev_device *serdev,int break_state);void serdev_device_write_wakeup (struct serdev_device *); -int serdev_device_write (struct serdev_device *,const unsigned char *,size_t ,long ); +ssize_t serdev_device_write (struct serdev_device *,const u8 *,size_t ,long );void serdev_device_write_flush (struct serdev_device *);int serdev_device_write_room (struct serdev_device *);
@@ -248,7 +248,7 @@ static inline unsigned int serdev_device_set_baudrate(struct serdev_device *sdev }static inline void serdev_device_set_flow_control (struct serdev_device *sdev,bool enable) {}static inline int serdev_device_write_buf (struct serdev_device *serdev, -const unsigned char *buf, +const u8 *buf,size_t count) {return -ENODEV ;
@@ -266,8 +266,9 @@ static inline int serdev_device_break_ctl(struct serdev_device *serdev, int brea {return -EOPNOTSUPP ; } -static inline int serdev_device_write (struct serdev_device *sdev,const unsigned char *buf, -size_t count,unsigned long timeout) +static inline ssize_t serdev_device_write (struct serdev_device *sdev, +const u8 *buf,size_t count, +unsigned long timeout) {return -ENODEV ; }
sound/drivers/serial-generic.c +2 -2
@@ -100,8 +100,8 @@ static void snd_serial_generic_write_wakeup(struct serdev_device *serdev)snd_serial_generic_tx_wakeup (drvdata); } -static int snd_serial_generic_receive_buf (struct serdev_device *serdev, -const unsigned char *buf,size_t count) +static ssize_t snd_serial_generic_receive_buf (struct serdev_device *serdev, +const u8 *buf,size_t count) {int ret;struct snd_serial_generic *drvdata =serdev_device_get_drvdata (serdev);
Signature · 1 line
2.43.0
Jiri Slaby (SUSE)
maintainerPATCH 24/27 tty: srmcons: convert to u8 and size_t
In reply to Jiri Slaby (SUSE)Switch character types to u8 and sizes to size_t. To conform to characters/sizes in the rest of the tty layer.
--- arch/alpha/kernel/srmcons.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/alpha/kernel/srmcons.c +3 -3
@@ -53,7 +53,7 @@ srmcons_do_receive_chars(struct tty_port *port)do { result.as_long =callback_getc (0 );if (result.bits.status <2 ) { -tty_insert_flip_char (port, (char )result.bits.c,0 ); +tty_insert_flip_char (port, (u8 )result.bits.c,0 ); count++; } }while ((result.bits.status &1 ) && (++loops <10 ));
@@ -89,7 +89,7 @@ srmcons_receive_chars(struct timer_list *t)/* called with callback_lock held */ static void -srmcons_do_write (struct tty_port *port,const char *buf,int count) +srmcons_do_write (struct tty_port *port,const u8 *buf,size_t count) {size_t c;srmcons_result result;
@@ -131,7 +131,7 @@ srmcons_write(struct tty_struct *tty, const u8 *buf, size_t count)unsigned long flags;spin_lock_irqsave (&srmcons_callback_lock, flags); -srmcons_do_write (tty->port, (const char *) buf, count); +srmcons_do_write (tty->port, buf, count);spin_unlock_irqrestore (&srmcons_callback_lock, flags);return count;
Signature · 1 line
2.43.0
Jiri Slaby (SUSE)
maintainerPATCH 25/27 tty: ttyprintk: convert to u8 and size_t
In reply to Jiri Slaby (SUSE)Switch character types to u8 and sizes to size_t. To conform to characters/sizes in the rest of the tty layer.
--- drivers/char/ttyprintk.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/char/ttyprintk.c +3 -3
@@ -40,7 +40,7 @@ static struct ttyprintk_port tpk_port;static int tpk_curr; -static char tpk_buffer[TPK_STR_SIZE +4 ]; +static u8 tpk_buffer[TPK_STR_SIZE +4 ];static void tpk_flush (void ) {
@@ -51,9 +51,9 @@ static void tpk_flush(void) } } -static int tpk_printk (const u8 *buf,int count) +static int tpk_printk (const u8 *buf,size_t count) { -int i; +size_t i;for (i =0 ; i < count; i++) {if (tpk_curr >=TPK_STR_SIZE ) {
Signature · 1 line
2.43.0
Jiri Slaby (SUSE)
maintainerPATCH 26/27 tty: um: convert to u8/__u8 and size_t
In reply to Jiri Slaby (SUSE)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.
--- 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(-)
arch/um/drivers/chan.h +1 -1
@@ -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);
arch/um/drivers/chan_kern.c +4 -5
@@ -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;
arch/um/drivers/chan_user.c +2 -2
@@ -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;
arch/um/drivers/chan_user.h +5 -4
@@ -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);
arch/um/drivers/line.c +1 -1
@@ -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;
arch/um/drivers/line.h +3 -3
@@ -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;
arch/um/drivers/null.c +1 -1
@@ -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 ; }
Signature · 1 line
2.43.0
Jiri Slaby (SUSE)
maintainerPATCH 27/27 tty: xtensa/iss: use u8
In reply to Jiri Slaby (SUSE)Switch character types to u8. To conform to characters in the rest of the tty layer.
--- arch/xtensa/platforms/iss/console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/xtensa/platforms/iss/console.c +1 -1
@@ -65,7 +65,7 @@ static void rs_poll(struct timer_list *unused)struct tty_port *port = &serial_port;int i =0 ;int rd =1 ; -unsigned char c; +u8 c;while (simc_poll (0 )) { rd =simc_read (0 , &c,1 );
Signature · 1 line
2.43.0
Re: [PATCH 14/27] tty: m68k: nfcon: convert to u8 and size_t
In reply to Jiri Slaby (SUSE)Quoted 4 lines · Jiri Slaby (SUSE)
Switch character types to u8 and sizes to
size_t. To conform to characters/sizes in the rest of the tty layer.Signed-off-by Jiri Slaby (SUSE) <[email protected]>
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH 23/27] tty: serdev: convert to u8 and size_t
In reply to Jiri Slaby (SUSE)Quoted 30 lines · Jiri Slaby
Switch character types to u8 and sizes to
size_t. To conform to characters/sizes in the rest of the tty layer.This patch converts struct
serdev_device_opshooks and its instantiations.Signed-off-by Jiri Slaby (SUSE) <[email protected]>Cc Rob Herring <[email protected]>---
drivers/gnss/serial.c +2
-2@@ -80,8 +80,8 @@ static const struct gnss_operations gnss_serial_gnss_ops = { .write_raw = gnss_serial_write_raw, }; -static int gnss_serial_receive_buf (struct serdev_device *serdev, -const unsigned char *buf,size_t count) +static ssize_t gnss_serial_receive_buf (struct serdev_device *serdev, +const u8 *buf,size_t count) {struct gnss_serial *gserial =serdev_device_get_drvdata (serdev);struct gnss_device *gdev = gserial->gdev;drivers/gnss/sirf.c +0
-0
drivers/gnss/sirf.c static const struct gnss_operations sirf_gnss_ops = { · line 165
Quoted 8 lines
drivers/gnss/sirf.c +2
-2@@ -160,8 +160,8 @@ static const struct gnss_operations sirf_gnss_ops = { .write_raw = sirf_write_raw, }; -static int sirf_receive_buf (struct serdev_device *serdev, -const unsigned char *buf,size_t count) +static ssize_t sirf_receive_buf (struct serdev_device *serdev, +const u8 *buf,size_t count) {
The gnss subsystem consistently use tabs-only for indentation of continuation lines so please don't change the indentation for these files.
With that fixed:
Johan
Re: [PATCH 04/27] tty: make tty_operations::send_xchar accept u8 char
In reply to Jiri Slaby (SUSE)CC linux-m68k
Quoted 6 lines · Jiri Slaby (SUSE)
tty_operations::send_xcharis one of the last users of 'char' type for characters in the tty layer. Convert it to u8 now.Signed-off-by Jiri Slaby (SUSE) <[email protected]>drivers/tty/amiserial.c | 2 +-
drivers/tty/amiserial.c static void rs_flush_buffer(struct tty_struct *tty) · line 817
Quoted 11 lines
drivers/tty/amiserial.c +1
-1@@ -811,7 +811,7 @@ static void rs_flush_buffer(struct tty_struct *tty)* This function is used to send a high-priority XON/XOFF character to * the device */ -static void rs_send_xchar (struct tty_struct *tty,char ch) +static void rs_send_xchar (struct tty_struct *tty,u8 ch) {struct serial_state *info = tty->driver_data;unsigned long flags;
Looks like this might fix an actual (harmless?) bug, if anyone evers configures a VSTOP or VSTART character with bit 7 set?
info->x_char = ch; // x_char is int, hence sign-extended
transmit_chars() does:
amiga_custom.serdat = info->x_char | 0x100;
which will inadvertently have all high bits sets, including the bit 9, which is only used if PARENB is enabled. But as it looks like PARENB handling is broken in amiseral anyway, this doesn't matter much...
include/linux/tty.h:#define STOP_CHAR(tty) ((tty)->termios.c_cc[VSTOP]) include/linux/tty.h:#define START_CHAR(tty) ((tty)->termios.c_cc[VSTART])
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH 06/27] tty: ami: use u8 for characters and flag
In reply to Jiri Slaby (SUSE)Hi Jiri,
Quoted 4 lines · Jiri Slaby (SUSE)
Switch character types to u8. To conform to characters in the rest of the tty layer.
Signed-off-by Jiri Slaby (SUSE) <[email protected]>
Thanks for your patch!
Quoted 12 lines
drivers/tty/amiserial.c +1
-1@@ -81,7 +81,7 @@ struct serial_state {int quot;int IER ;/* Interrupt Enable Register */ int MCR ;/* Modem control register */ -int x_char;/* xon/xoff character */ +u8 x_char;/* xon/xoff character */ };static struct tty_driver *serial_driver;
drivers/tty/amiserial.c static void receive_chars(struct serial_state *info) · line 184
Quoted 8 lines
drivers/tty/amiserial.c +1
-1@@ -178,7 +178,7 @@ static void receive_chars(struct serial_state *info) {int status;int serdatr; -unsigned char ch, flag; +u8 ch, flag;struct async_icount *icount;bool overrun = false;
I think it would make sense to fold this into "[PATCH 04/27] tty:
make tty_operations::send_xchar accept u8 char".
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH 12/27] tty: hvc: convert to u8 and size_t
In reply to Jiri Slaby (SUSE)Le 06/12/2023 à 08:36, Jiri Slaby (SUSE) a écrit :
Quoted 39 lines
Switch character types to u8 and sizes to
size_t. To conform to characters/sizes in the rest of the tty layer.Signed-off-by Jiri Slaby (SUSE) <[email protected]>Cc Michael Ellerman <[email protected]>Cc Nicholas Piggin <[email protected]>Cc Christophe Leroy <[email protected]>Cc Amit Shah <[email protected]>Cc Arnd Bergmann <[email protected]>Cc Paul Walmsley <[email protected]>Cc Palmer Dabbelt <[email protected]>Cc Albert Ou <[email protected]>--- arch/powerpc/include/asm/hvconsole.h | 4 ++-- arch/powerpc/include/asm/hvsi.h | 18 ++++++++-------- arch/powerpc/include/asm/opal.h | 8 +++++--- arch/powerpc/platforms/powernv/opal.c | 14 +++++++------ arch/powerpc/platforms/pseries/hvconsole.c | 4 ++-- drivers/char/virtio_console.c | 10 ++++----- drivers/tty/hvc/hvc_console.h | 4 ++-- drivers/tty/hvc/hvc_dcc.c | 24 +++++++++++----------- drivers/tty/hvc/hvc_iucv.c | 18 ++++++++-------- drivers/tty/hvc/hvc_opal.c | 5 +++-- drivers/tty/hvc/hvc_riscv_sbi.c | 9 ++++---- drivers/tty/hvc/hvc_rtas.c | 11 +++++----- drivers/tty/hvc/hvc_udbg.c | 9 ++++---- drivers/tty/hvc/hvc_vio.c | 18 ++++++++-------- drivers/tty/hvc/hvc_xen.c | 23 +++++++++++---------- drivers/tty/hvc/hvsi_lib.c | 20 ++++++++++-------- 16 files changed, 107 insertions(+), 92 deletions(-)arch/powerpc/include/asm/hvconsole.h +0
-0
arch/powerpc/include/asm/hvconsole.h line 25
Quoted 7 lines
arch/powerpc/include/asm/hvconsole.h +2
-2@@ -21,8 +21,8 @@* Vio firmware always attempts to fetch MAX_VIO_GET_CHARS chars. The 'count' * parm is included to conform to put_chars() function pointer template */ -extern int hvc_get_chars (uint32_t vtermno,char *buf,int count); -extern int hvc_put_chars (uint32_t vtermno,const char *buf,int count); +extern ssize_t hvc_get_chars (uint32_t vtermno,u8 *buf,size_t count); +extern ssize_t hvc_put_chars (uint32_t vtermno,const u8 *buf,size_t count);
Would be a good opportunity to drop this pointless deprecated 'extern' keyword on all function prototypes you are changing.
Christophe
Greg KH
maintainerRe: [PATCH 23/27] tty: serdev: convert to u8 and size_t
In reply to Johan HovoldQuoted 34 lines · Johan Hovold
Quoted 33 lines · Jiri Slaby
Switch character types to u8 and sizes to
size_t. To conform to characters/sizes in the rest of the tty layer.This patch converts struct
serdev_device_opshooks and its instantiations.Signed-off-by Jiri Slaby (SUSE) <[email protected]>Cc Rob Herring <[email protected]>---
drivers/gnss/serial.c +2
-2@@ -80,8 +80,8 @@ static const struct gnss_operations gnss_serial_gnss_ops = { .write_raw = gnss_serial_write_raw, }; -static int gnss_serial_receive_buf (struct serdev_device *serdev, -const unsigned char *buf,size_t count) +static ssize_t gnss_serial_receive_buf (struct serdev_device *serdev, +const u8 *buf,size_t count) {struct gnss_serial *gserial =serdev_device_get_drvdata (serdev);struct gnss_device *gdev = gserial->gdev;drivers/gnss/sirf.c +0
-0@@ -160,8 +160,8 @@ static const struct gnss_operations sirf_gnss_ops = { .write_raw = sirf_write_raw, };
Quoted 9 lines
drivers/gnss/sirf.c static const struct gnss_operations sirf_gnss_ops = { · line 165
Quoted 5 lines
drivers/gnss/sirf.c +2
-2-static int sirf_receive_buf (struct serdev_device *serdev, -const unsigned char *buf,size_t count) +static ssize_t sirf_receive_buf (struct serdev_device *serdev, +const u8 *buf,size_t count) {The gnss subsystem consistently use tabs-only for indentation of continuation lines so please don't change the indentation for these files.
That's going to drive checkpatch.pl crazy, please don't inist on it as that is not going to work well over time as we would all have to remember that just for this one subsystem :(
thanks,
greg k-h
Johan Hovold
maintainerRe: [PATCH 23/27] tty: serdev: convert to u8 and size_t
Quoted 20 lines · Greg Kroah-Hartman
Quoted 10 lines · Johan Hovold
Quoted 8 lines · Jiri Slaby
drivers/gnss/serial.c +0
-0@@ -80,8 +80,8 @@ static const struct gnss_operations gnss_serial_gnss_ops = { .write_raw = gnss_serial_write_raw, };Quoted 8 lines
drivers/gnss/serial.c static const struct gnss_operations gnss_serial_gnss_ops = { · line 84
Quoted 4 lines
drivers/gnss/serial.c +2
-2-static int gnss_serial_receive_buf (struct serdev_device *serdev, -const unsigned char *buf,size_t count) +static ssize_t gnss_serial_receive_buf (struct serdev_device *serdev, +const u8 *buf,size_t count)The gnss subsystem consistently use tabs-only for indentation of continuation lines so please don't change the indentation for these files.
Quoted 3 lines
That's going to drive checkpatch.pl crazy, please don't inist on it as that is not going to work well over time as we would all have to remember that just for this one subsystem :(
Open-parenthesis alignment is not part of the coding standard and is hidden behind the checkpatch.pl --strict option along with other (often excessive) checks that are not generally agreed upon.
Only staging and networking enable that option by default and I think checkpatch.pl handles that transparently.
So this should not be an issue unless you're trying to enforce the contentious checks tree wide (i.e. just drop the --strict option).
That said, as this only affects one function (the other one happened to align while still only using tabs) I can fix that up later unless Jiri is resending for some other reason.
Johan
Greg KH
maintainerRe: [PATCH 23/27] tty: serdev: convert to u8 and size_t
Quoted 25 lines · Johan Hovold
Quoted 20 lines · Greg Kroah-Hartman
Quoted 10 lines · Johan Hovold
Quoted 8 lines · Jiri Slaby
drivers/gnss/serial.c +0
-0@@ -80,8 +80,8 @@ static const struct gnss_operations gnss_serial_gnss_ops = { .write_raw = gnss_serial_write_raw, };Quoted 8 lines
drivers/gnss/serial.c static const struct gnss_operations gnss_serial_gnss_ops = { · line 84
Quoted 4 lines
drivers/gnss/serial.c +2
-2-static int gnss_serial_receive_buf (struct serdev_device *serdev, -const unsigned char *buf,size_t count) +static ssize_t gnss_serial_receive_buf (struct serdev_device *serdev, +const u8 *buf,size_t count)The gnss subsystem consistently use tabs-only for indentation of continuation lines so please don't change the indentation for these files.
Quoted 3 lines
That's going to drive checkpatch.pl crazy, please don't inist on it as that is not going to work well over time as we would all have to remember that just for this one subsystem :(
Quoted 6 lines
Open-parenthesis alignment is not part of the coding standard and is hidden behind the checkpatch.pl --strict option along with other (often excessive) checks that are not generally agreed upon.
Only staging and networking enable that option by default and I think checkpatch.pl handles that transparently.
Ah, didn't realize this was a staging-only thing, sorry. As that's what I get loads of checkpatch fixes for, I figured it was what everyone should be using :)
thanks,
greg k-h
Ilpo Järvinen
maintainerRe: [PATCH 21/27] tty: nozomi: convert to u8 and size_t
In reply to Jiri Slaby (SUSE)Quoted 30 lines · Jiri Slaby (SUSE)
Switch character types to u8 and sizes to
size_t. To conform to characters/sizes in the rest of the tty layer.Signed-off-by Jiri Slaby (SUSE) <[email protected]>--- drivers/tty/nozomi.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)drivers/tty/nozomi.c +3
-4@@ -783,11 +783,10 @@ static int receive_data(enum port_type index, struct nozomi *dc)tty_insert_flip_char (&port->port, buf[0 ],TTY_NORMAL ); size =0 ; }else if (size <RECEIVE_BUF_MAX ) { - size -=tty_insert_flip_string (&port->port, - (char *)buf, size); + size -=tty_insert_flip_string (&port->port, buf, size); }else { - i =tty_insert_flip_string (&port->port, - (char *)buf,RECEIVE_BUF_MAX ); + i =tty_insert_flip_string (&port->port, buf, +RECEIVE_BUF_MAX ); size -= i; offset += i; }@@ -1584,10 +1583,10 @@ static void ntty_hangup(struct tty_struct *tty) static ssize_t ntty_write(struct tty_struct *tty, const u8 *buffer,
drivers/tty/nozomi.c static void ntty_hangup(struct tty_struct *tty) · line 1592
Quoted 10 lines
drivers/tty/nozomi.c +1
-1size_t count) { -int rval = -EINVAL ;struct nozomi *dc =get_dc_by_tty (tty);struct port *port = tty->driver_data;unsigned long flags; +size_t rval;if (!dc || !port)return -ENODEV ;
It wouldn't hurt to mention in the commit message that -EINVAL initialization is unnecessary.
Signature · 1 line
i.
Re: [PATCH 04/27] tty: make tty_operations::send_xchar accept u8 char
In reply to Jiri Slaby (SUSE)Quoted 4 lines · Jiri Slaby (SUSE)
tty_operations::send_xcharis one of the last users of 'char' type for characters in the tty layer. Convert it to u8 now.
Quoted 9 lines
Signed-off-by Jiri Slaby (SUSE) <[email protected]>Cc Karsten Keil <[email protected]>Cc Ulf Hansson <[email protected]>Cc Marcel Holtmann <[email protected]>Cc Johan Hedberg <[email protected]>Cc Luiz Augusto von Dentz <[email protected]>
Kind regards
Uffe
Quoted 130 lines
--- drivers/isdn/capi/capi.c | 4 ++-- drivers/mmc/core/sdio_uart.c | 2 +- drivers/tty/amiserial.c | 2 +- drivers/tty/serial/serial_core.c | 2 +- drivers/tty/tty_io.c | 2 +- include/linux/tty.h | 2 +- include/linux/tty_driver.h | 4 ++-- net/bluetooth/rfcomm/tty.c | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-)drivers/isdn/capi/capi.c +2
-2@@ -1231,9 +1231,9 @@ static void capinc_tty_hangup(struct tty_struct *tty)tty_port_hangup (&mp->port); } -static void capinc_tty_send_xchar (struct tty_struct *tty,char ch) +static void capinc_tty_send_xchar (struct tty_struct *tty,u8 ch) { -pr_debug ("capinc_tty_send_xchar(%d)\n" , ch); +pr_debug ("capinc_tty_send_xchar(%u)\n" , ch); }static const struct tty_operations capinc_ops = {drivers/mmc/core/sdio_uart.c +1
-1@@ -792,7 +792,7 @@ static unsigned int sdio_uart_chars_in_buffer(struct tty_struct *tty)return kfifo_len (&port->xmit_fifo); } -static void sdio_uart_send_xchar (struct tty_struct *tty,char ch) +static void sdio_uart_send_xchar (struct tty_struct *tty,u8 ch) {struct sdio_uart_port *port = tty->driver_data;drivers/tty/amiserial.c +1
-1@@ -811,7 +811,7 @@ static void rs_flush_buffer(struct tty_struct *tty)* This function is used to send a high-priority XON/XOFF character to * the device */ -static void rs_send_xchar (struct tty_struct *tty,char ch) +static void rs_send_xchar (struct tty_struct *tty,u8 ch) {struct serial_state *info = tty->driver_data;unsigned long flags;drivers/tty/serial/serial_core.c +1
-1@@ -687,7 +687,7 @@ EXPORT_SYMBOL_GPL(uart_xchar_out);* This function is used to send a high-priority XON/XOFF character to * the device */ -static void uart_send_xchar (struct tty_struct *tty,char ch) +static void uart_send_xchar (struct tty_struct *tty,u8 ch) {struct uart_state *state = tty->driver_data;struct uart_port *port;drivers/tty/tty_io.c +1
-1@@ -1149,7 +1149,7 @@ ssize_t redirected_tty_write(struct kiocb *iocb, struct iov_iter *iter)* * Locking: none for xchar method, write ordering for write method. */ -int tty_send_xchar (struct tty_struct *tty,char ch) +int tty_send_xchar (struct tty_struct *tty,u8 ch) {bool was_stopped = tty->flow.stopped;include/linux/tty.h +1
-1@@ -410,7 +410,7 @@ void tty_wait_until_sent(struct tty_struct *tty, long timeout);void stop_tty (struct tty_struct *tty);void start_tty (struct tty_struct *tty);void tty_write_message (struct tty_struct *tty,char *msg); -int tty_send_xchar (struct tty_struct *tty,char ch); +int tty_send_xchar (struct tty_struct *tty,u8 ch);int tty_put_char (struct tty_struct *tty,unsigned char c);unsigned int tty_chars_in_buffer (struct tty_struct *tty);unsigned int tty_write_room (struct tty_struct *tty);include/linux/tty_driver.h +2
-2@@ -242,7 +242,7 @@ struct serial_struct;* Optional: If not provided, the device is assumed to have no FIFO. * Usually correct to invoke via tty_wait_until_sent(). May sleep. * -* @send_xchar: ``void ()(struct tty_struct *tty, char ch)`` +* @send_xchar: ``void ()(struct tty_struct *tty, u8 ch)`` * * This routine is used to send a high-priority XON/XOFF character (@ch) * to the @tty device. @@ -374,7 +374,7 @@ struct tty_operations {void (*flush_buffer)(struct tty_struct *tty);void (*set_ldisc)(struct tty_struct *tty);void (*wait_until_sent)(struct tty_struct *tty,int timeout); -void (*send_xchar)(struct tty_struct *tty,char ch); +void (*send_xchar)(struct tty_struct *tty,u8 ch);int (*tiocmget)(struct tty_struct *tty);int (*tiocmset)(struct tty_struct *tty,unsigned int set,unsigned int clear);net/bluetooth/rfcomm/tty.c +1
-2@@ -1041,7 +1041,7 @@ static void rfcomm_tty_flush_buffer(struct tty_struct *tty)tty_wakeup (tty); } -static void rfcomm_tty_send_xchar (struct tty_struct *tty,char ch) +static void rfcomm_tty_send_xchar (struct tty_struct *tty,u8 ch) {BT_DBG ("tty %p ch %c" , tty, ch); } --2.43.0
Re: [PATCH 02/27] tty: mmc: sdio_uart: switch sdio_in() to return u8
In reply to Jiri Slaby (SUSE)Quoted 8 lines · Jiri Slaby (SUSE)
sdio_in()returns a value returned fromsdio_readb(). The latter returns u8. So should the former. Therefore, switchsdio_in()return type to u8 and all its callers too.Signed-off-by Jiri Slaby (SUSE) <[email protected]>Cc Ulf Hansson <[email protected]>
Quoted 72 lines
--- drivers/mmc/core/sdio_uart.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)drivers/mmc/core/sdio_uart.c +8
-12@@ -178,11 +178,9 @@ static inline void sdio_uart_release_func(struct sdio_uart_port *port)sdio_release_host (port->func); } -static inline unsigned int sdio_in (struct sdio_uart_port *port,int offset) +static inline u8 sdio_in (struct sdio_uart_port *port,int offset) { -unsigned char c; - c =sdio_readb (port->func, port->regs_offset + offset,NULL ); -return c; +return sdio_readb (port->func, port->regs_offset + offset,NULL ); }static inline void sdio_out (struct sdio_uart_port *port,int offset,int value)@@ -192,8 +190,8 @@ static inline void sdio_out(struct sdio_uart_port *port, int offset, int value)static unsigned int sdio_uart_get_mctrl (struct sdio_uart_port *port) { -unsigned char status;unsigned int ret; +u8 status;/* FIXME: What stops this losing the delta bits and breaking sdio_uart_check_modem_status ? */ @@ -354,14 +352,13 @@ static void sdio_uart_stop_rx(struct sdio_uart_port *port)sdio_out (port,UART_IER , port->ier); } -static void sdio_uart_receive_chars (struct sdio_uart_port *port, -unsigned int *status) +static void sdio_uart_receive_chars (struct sdio_uart_port *port,u8 *status) { -unsigned int ch, flag; +unsigned int flag;int max_count =256 ; do { - ch = sdio_in(port, UART_RX); + u8 ch = sdio_in(port, UART_RX); flag = TTY_NORMAL; port->icount.rx++;@@ -449,8 +446,8 @@ static void sdio_uart_transmit_chars(struct sdio_uart_port *port)static void sdio_uart_check_modem_status (struct sdio_uart_port *port) { -int status;struct tty_struct *tty; +u8 status; status =sdio_in (port,UART_MSR );@@ -499,7 +496,7 @@ static void sdio_uart_check_modem_status(struct sdio_uart_port *port)static void sdio_uart_irq (struct sdio_func *func) {struct sdio_uart_port *port =sdio_get_drvdata (func); -unsigned int iir, lsr; +u8 iir, lsr;/* * In a few places sdio_uart_irq() is called directly instead of -- 2.43.0
Re: [PATCH 16/27] tty: mmc: sdio: use u8 for flag
In reply to Jiri Slaby (SUSE)Quoted 7 lines · Jiri Slaby (SUSE)
Switch character types to u8. To conform to characters in the rest of the tty layer.
Signed-off-by Jiri Slaby (SUSE) <[email protected]>Cc Ulf Hansson <[email protected]>
Kind regards
Uffe
Quoted 25 lines
--- drivers/mmc/core/sdio_uart.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/mmc/core/sdio_uart.c +1
-3@@ -354,12 +354,11 @@ static void sdio_uart_stop_rx(struct sdio_uart_port *port) static void sdio_uart_receive_chars(struct sdio_uart_port *port, u8 *status) { - unsigned int flag; int max_count = 256; do { u8 ch = sdio_in(port, UART_RX); - flag = TTY_NORMAL; + u8 flag = TTY_NORMAL; port->icount.rx++; if (unlikely(*status & (UART_LSR_BI | UART_LSR_PE | --2.43.0
Re: [PATCH 08/27] tty: con3215: convert to u8 and size_t
In reply to Jiri Slaby (SUSE)Quoted 80 lines · Jiri Slaby (SUSE)
Switch character types to u8 and sizes to
size_t. To conform to characters/sizes in the rest of the tty layer.Signed-off-by Jiri Slaby (SUSE) <[email protected]>Cc Heiko Carstens <[email protected]>Cc Vasily Gorbik <[email protected]>Cc Alexander Gordeev <[email protected]>Cc Christian Borntraeger <[email protected]>Cc Sven Schnelle <[email protected]>--- drivers/s390/char/con3215.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)drivers/s390/char/con3215.c +10
-9@@ -79,8 +79,8 @@ struct raw3215_info {struct ccw_device *cdev;/* device for tty driver */ spinlock_t *lock;/* pointer to irq lock */ int flags;/* state flags */ -char *buffer;/* pointer to output buffer */ -char *inbuf;/* pointer to input buffer */ +u8 *buffer;/* pointer to output buffer */ +u8 *inbuf;/* pointer to input buffer */ int head;/* first free byte in output buffer */ int count;/* number of bytes in output buffer */ int written;/* number of bytes in write requests */ @@ -522,12 +522,14 @@ static unsigned int raw3215_make_room(struct raw3215_info *raw,* string without blocking. * Return value is the number of bytes copied. */ -static unsigned int raw3215_addtext (const char *str,unsigned int length, +static unsigned int raw3215_addtext (const u8 *str,size_t length,struct raw3215_info *raw,int opmode,unsigned int todrop) { -unsigned int c, ch, i, blanks, expanded_size =0 ; +unsigned int i, blanks, expanded_size =0 ;unsigned int column = raw->line_pos; +size_t c; +u8 ch;if (opmode ==RAW3215_COUNT ) todrop =0 ;@@ -558,7 +560,7 @@ static unsigned int raw3215_addtext(const char *str, unsigned int length,if (todrop && expanded_size < todrop)/* Drop head data */ continue ;for (i =0 ; i < blanks; i++) { - raw->buffer[raw->head] = (char )_ascebc[(int )ch]; + raw->buffer[raw->head] = _ascebc[ch]; raw->head = (raw->head +1 ) & (RAW3215_BUFFER_SIZE -1 ); raw->count++; }@@ -570,8 +572,8 @@ static unsigned int raw3215_addtext(const char *str, unsigned int length,/* * String write routine for 3215 devices */ -static void raw3215_write (struct raw3215_info *raw,const char *str, -unsigned int length) +static void raw3215_write (struct raw3215_info *raw,const u8 *str, +size_t length) {unsigned int count, avail;unsigned long flags;@@ -596,7 +598,7 @@ static void raw3215_write(struct raw3215_info *raw, const char *str,/* * Put character routine for 3215 devices */ -static void raw3215_putchar (struct raw3215_info *raw,unsigned char ch) +static void raw3215_putchar (struct raw3215_info *raw,u8 ch) {raw3215_write (raw, &ch,1 ); }@@ -823,12 +825,10 @@ static struct ccw_driver raw3215_ccw_driver = { .int_class = IRQIO_C15, }; -static void handle_write (struct raw3215_info *raw,const char *str,int count)
drivers/s390/char/con3215.c static struct ccw_driver raw3215_ccw_driver = { · line 834
Quoted 10 lines
drivers/s390/char/con3215.c +2
-3+static void handle_write (struct raw3215_info *raw,const u8 *str,size_t count) { -int i; -while (count >0 ) { - i =min_t (int, count,RAW3215_BUFFER_SIZE -1 ); +size_t i =min_t (size_t, count,RAW3215_BUFFER_SIZE -1 );raw3215_write (raw, str, i); count -= i; str += i;
Re: [PATCH 09/27] tty: con3270: convert to u8 and size_t
In reply to Jiri Slaby (SUSE)Quoted 64 lines · Jiri Slaby (SUSE)
Switch character types to u8 and sizes to
size_t. To conform to characters/sizes in the rest of the tty layer.Signed-off-by Jiri Slaby (SUSE) <[email protected]>Cc Heiko Carstens <[email protected]>Cc Vasily Gorbik <[email protected]>Cc Alexander Gordeev <[email protected]>Cc Christian Borntraeger <[email protected]>Cc Sven Schnelle <[email protected]>--- drivers/s390/char/con3270.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/s390/char/con3270.c +5
-5@@ -54,7 +54,7 @@ struct tty3270_attribute { };struct tty3270_cell { -unsigned char character; +u8 character;struct tty3270_attribute attributes; };@@ -123,7 +123,7 @@ struct tty3270 {/* Character array for put_char/flush_chars. */ unsigned int char_count; -char char_buf[TTY3270_CHAR_BUF_SIZE ]; +u8 char_buf[TTY3270_CHAR_BUF_SIZE ]; };/* tty3270->update_flags. See tty3270_update for details. */ @@ -1255,7 +1255,7 @@ static unsigned int tty3270_write_room(struct tty_struct *tty)* Insert character into the screen at the current position with the * current color and highlight. This function does NOT do cursor movement. */ -static void tty3270_put_character (struct tty3270 *tp,char ch) +static void tty3270_put_character (struct tty3270 *tp,u8 ch) {struct tty3270_line *line;struct tty3270_cell *cell;@@ -1561,7 +1561,7 @@ static void tty3270_goto_xy(struct tty3270 *tp, int cx, int cy)* Pn is a numeric parameter, a string of zero or more decimal digits. * Ps is a selective parameter. */ -static void tty3270_escape_sequence (struct tty3270 *tp,char ch) +static void tty3270_escape_sequence (struct tty3270 *tp,u8 ch) {enum {ES_NORMAL ,ES_ESC ,ES_SQUARE ,ES_PAREN ,ES_GETPARS };@@ -1726,7 +1726,7 @@ static void tty3270_escape_sequence(struct tty3270 *tp, char ch)* String write routine for 3270 ttys */ static void tty3270_do_write (struct tty3270 *tp,struct tty_struct *tty, -const unsigned char *buf,int count) +const u8 *buf,size_t count) {int i_msg, i;
drivers/s390/char/con3270.c con3270_write(struct console *co, const char *str, unsigned int count) · line 2058
Quoted 8 lines
drivers/s390/char/con3270.c +1
-1@@ -2052,7 +2052,7 @@ con3270_write(struct console *co, const char *str, unsigned int count) {struct tty3270 *tp = co->data;unsigned long flags; -char c; +u8 c;spin_lock_irqsave (&tp->view.lock, flags);while (count--) {