TTY patches for 5.18
Subsystems (34)
cover TTY patches for 5.18
These are small random cleanups and improvements I came across while doing larger cleanups which are not finished yet. So flushing only these from my queue at this very moment for 5.18.
Jiri Slaby (11):
serial: core: clean up EXPORT_SYMBOLs
serial: atmel_serial: include circ_buf.h
tty: add kfifo to tty_port
tty: tty_port_open, document shutdown vs failed activate
mxser: fix xmit_buf leak in activate when LSR == 0xff
mxser: use tty_port xmit_buf helpers
mxser: switch from xmit_buf to kfifo
serial: fsl_linflexuart: deduplicate character sending
serial: fsl_linflexuart: don't call uart_write_wakeup() twice
serial: make uart_console_write->putchar()'s character a char
serial: mcf: use helpers in mcf_tx_chars()
drivers/tty/goldfish.c | 2 +- drivers/tty/hvc/hvc_dcc.c | 2 +- drivers/tty/mxser.c | 109 +++++++++------------ drivers/tty/serial/21285.c | 2 +- drivers/tty/serial/8250/8250_early.c | 2 +- drivers/tty/serial/8250/8250_ingenic.c | 2 +- drivers/tty/serial/8250/8250_port.c | 2 +- drivers/tty/serial/altera_jtaguart.c | 4 +- drivers/tty/serial/altera_uart.c | 2 +- drivers/tty/serial/amba-pl010.c | 2 +- drivers/tty/serial/amba-pl011.c | 6 +- drivers/tty/serial/apbuart.c | 2 +- drivers/tty/serial/ar933x_uart.c | 2 +- drivers/tty/serial/arc_uart.c | 2 +- drivers/tty/serial/atmel_serial.c | 3 +- drivers/tty/serial/bcm63xx_uart.c | 2 +- drivers/tty/serial/clps711x.c | 2 +- drivers/tty/serial/digicolor-usart.c | 2 +- drivers/tty/serial/dz.c | 2 +- drivers/tty/serial/earlycon-arm-semihost.c | 2 +- drivers/tty/serial/earlycon-riscv-sbi.c | 2 +- drivers/tty/serial/fsl_linflexuart.c | 50 ++++------ drivers/tty/serial/fsl_lpuart.c | 4 +- drivers/tty/serial/imx.c | 2 +- drivers/tty/serial/imx_earlycon.c | 2 +- drivers/tty/serial/ip22zilog.c | 2 +- drivers/tty/serial/lantiq.c | 2 +- drivers/tty/serial/liteuart.c | 2 +- drivers/tty/serial/lpc32xx_hs.c | 2 +- drivers/tty/serial/mcf.c | 7 +- drivers/tty/serial/meson_uart.c | 2 +- drivers/tty/serial/milbeaut_usio.c | 2 +- drivers/tty/serial/mps2-uart.c | 4 +- drivers/tty/serial/mvebu-uart.c | 4 +- drivers/tty/serial/mxs-auart.c | 2 +- drivers/tty/serial/omap-serial.c | 2 +- drivers/tty/serial/owl-uart.c | 2 +- drivers/tty/serial/pch_uart.c | 2 +- drivers/tty/serial/pic32_uart.c | 2 +- drivers/tty/serial/pmac_zilog.c | 2 +- drivers/tty/serial/pxa.c | 2 +- drivers/tty/serial/qcom_geni_serial.c | 2 +- drivers/tty/serial/rda-uart.c | 2 +- drivers/tty/serial/sa1100.c | 2 +- drivers/tty/serial/samsung_tty.c | 4 +- drivers/tty/serial/sb1250-duart.c | 2 +- drivers/tty/serial/sccnxp.c | 2 +- drivers/tty/serial/serial_core.c | 20 ++-- drivers/tty/serial/serial_txx9.c | 2 +- drivers/tty/serial/sh-sci.c | 2 +- drivers/tty/serial/sifive.c | 4 +- drivers/tty/serial/sprd_serial.c | 2 +- drivers/tty/serial/st-asc.c | 2 +- drivers/tty/serial/stm32-usart.c | 2 +- drivers/tty/serial/sunsu.c | 2 +- drivers/tty/serial/sunzilog.c | 4 +- drivers/tty/serial/uartlite.c | 4 +- drivers/tty/serial/vr41xx_siu.c | 2 +- drivers/tty/serial/vt8500_serial.c | 2 +- drivers/tty/serial/xilinx_uartps.c | 2 +- drivers/tty/serial/zs.c | 2 +- drivers/tty/tty_port.c | 9 +- include/linux/serial_core.h | 2 +- include/linux/tty_port.h | 3 + 64 files changed, 155 insertions(+), 180 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/11 serial: core: clean up EXPORT_SYMBOLs
Some EXPORT_SYMBOLs are grouped at one location. Some follow functions they export, but a newline is present before them. Fix all these and move them where they belong.
--- drivers/tty/serial/serial_core.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-)
drivers/tty/serial/serial_core.c +7 -11
@@ -105,6 +105,7 @@ void uart_write_wakeup(struct uart_port *port)BUG_ON (!state);tty_port_tty_wakeup (&state->port); } +EXPORT_SYMBOL (uart_write_wakeup);static void uart_stop (struct tty_struct *tty) {
@@ -351,7 +352,6 @@ uart_update_timeout(struct uart_port *port, unsigned int cflag,*/ port->timeout = (HZ * size) / baud +HZ /50 ; } -EXPORT_SYMBOL (uart_update_timeout);/**
@@ -453,7 +453,6 @@ uart_get_baud_rate(struct uart_port *port, struct ktermios *termios,WARN_ON (1 );return 0 ; } -EXPORT_SYMBOL (uart_get_baud_rate);/**
@@ -478,7 +477,6 @@ uart_get_divisor(struct uart_port *port, unsigned int baud)return quot; } -EXPORT_SYMBOL (uart_get_divisor);/* Caller holds port mutex */
@@ -2220,6 +2218,7 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *uport)return 0 ; } +EXPORT_SYMBOL (uart_suspend_port);int uart_resume_port (struct uart_driver *drv,struct uart_port *uport) {
@@ -2305,6 +2304,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport)return 0 ; } +EXPORT_SYMBOL (uart_resume_port);static inline void uart_report_port (struct uart_driver *drv,struct uart_port *port)
@@ -2599,6 +2599,7 @@ int uart_register_driver(struct uart_driver *drv) out:return retval; } +EXPORT_SYMBOL (uart_register_driver);/** * uart_unregister_driver - remove a driver from the uart core layer
@@ -2622,6 +2623,7 @@ void uart_unregister_driver(struct uart_driver *drv) drv->state =NULL ; drv->tty_driver =NULL ; } +EXPORT_SYMBOL (uart_unregister_driver);struct tty_driver *uart_console_device (struct console *co,int *index) {
@@ -2956,6 +2958,7 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *uport)return ret; } +EXPORT_SYMBOL (uart_add_one_port);/** * uart_remove_one_port - detach a driver defined port structure
@@ -3036,6 +3039,7 @@ int uart_remove_one_port(struct uart_driver *drv, struct uart_port *uport)return ret; } +EXPORT_SYMBOL (uart_remove_one_port);/* * Are the two ports equivalent?
@@ -3212,14 +3216,6 @@ bool uart_try_toggle_sysrq(struct uart_port *port, unsigned int ch)EXPORT_SYMBOL_GPL (uart_try_toggle_sysrq);#endif -EXPORT_SYMBOL (uart_write_wakeup); -EXPORT_SYMBOL (uart_register_driver); -EXPORT_SYMBOL (uart_unregister_driver); -EXPORT_SYMBOL (uart_suspend_port); -EXPORT_SYMBOL (uart_resume_port); -EXPORT_SYMBOL (uart_add_one_port); -EXPORT_SYMBOL (uart_remove_one_port); -/** * uart_get_rs485_mode() - retrieve rs485 properties for given uart * @port: uart device's target port
Signature · 1 line
2.34.1
PATCH 2/11 serial: atmel_serial: include circ_buf.h
In reply to Jiri Slabyatmel_uart_port::rx_ring is defined as struct circ_buf, but circ_buf.h is not included explicitly in atmel_serial.c. It is included only implicitly via serial_core.h. Fix this as serial_core.h might not include that header in the future.
--- drivers/tty/serial/atmel_serial.c | 1 + 1 file changed, 1 insertion(+)
drivers/tty/serial/atmel_serial.c +1 -0
@@ -8,6 +8,7 @@* * DMA support added by Chip Coldwell. */ +#include <linux/circ_buf.h> #include <linux/tty.h> #include <linux/ioport.h> #include <linux/slab.h>
Signature · 1 line
2.34.1
Re: [PATCH 02/11] serial: atmel_serial: include circ_buf.h
Le 24/01/2022 à 08:14, Jiri Slaby a écrit :
Quoted 10 lines
atmel_uart_port::rx_ringis defined as structcirc_buf, butcirc_buf.his not included explicitly inatmel_serial.c. It is included only implicitly viaserial_core.h. Fix this asserial_core.hmight not include that header in the future.Signed-off-by Jiri Slaby <[email protected]>Cc Richard Genoud <[email protected]>Cc Nicolas Ferre <[email protected]>Cc Alexandre Belloni <[email protected]>Cc Ludovic Desroches <[email protected]>
Quoted 9 lines
--- drivers/tty/serial/atmel_serial.c | 1 + 1 file changed, 1 insertion(+)drivers/tty/serial/atmel_serial.c +0
-0
drivers/tty/serial/atmel_serial.c line 14
Quoted 7 lines
drivers/tty/serial/atmel_serial.c +1
-0@@ -8,6 +8,7 @@* * DMA support added by Chip Coldwell. */ +#include <linux/circ_buf.h> #include <linux/tty.h> #include <linux/ioport.h> #include <linux/slab.h>
Thanks !
Richard Genoud
Acked-byRe: [PATCH 02/11] serial: atmel_serial: include circ_buf.h
Le 24/01/2022 à 09:46, Richard Genoud a écrit :
Quoted 12 lines
Le 24/01/2022 à 08:14, Jiri Slaby a écrit :
Quoted 10 lines
atmel_uart_port::rx_ringis defined as structcirc_buf, butcirc_buf.his not included explicitly inatmel_serial.c. It is included only implicitly viaserial_core.h. Fix this asserial_core.hmight not include that header in the future.Signed-off-by Jiri Slaby <[email protected]>Cc Richard Genoud <[email protected]>Cc Nicolas Ferre <[email protected]>Cc Alexandre Belloni <[email protected]>Cc Ludovic Desroches <[email protected]>
Sorry, I really meant acked-by, not Signed-off-by :
Quoted 4 lines
Quoted 4 lines
---
drivers/tty/serial/atmel_serial.c| 1 +1 file changed, 1 insertion(+)
Quoted 12 lines
drivers/tty/serial/atmel_serial.c line 14
Quoted 12 lines
drivers/tty/serial/atmel_serial.c +1
-0@@ -8,6 +8,7 @@* * DMA support added by Chip Coldwell. */ +#include <linux/circ_buf.h> #include <linux/tty.h> #include <linux/ioport.h> #include <linux/slab.h>
Thanks !
PATCH 3/11 tty: add kfifo to tty_port
In reply to Jiri SlabyDefine a kfifo inside struct tty_port. We use DECLARE_KFIFO_PTR and let the preexisting tty_port::xmit_buf be also the buffer for the kfifo. And handle the initialization/decomissioning along with xmit_buf, i.e. in tty_port_alloc_xmit_buf() and tty_port_free_xmit_buf(), respectively.
This allows for kfifo use in drivers which opt-in, while others still may use the old xmit_buf. mxser will be the first user in the next few patches.
--- drivers/tty/tty_port.c | 6 +++++- include/linux/tty_port.h | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-)
drivers/tty/tty_port.c +5 -1
@@ -225,8 +225,11 @@ 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 ) +if (port->xmit_buf ==NULL ) { port->xmit_buf = (unsigned char *)get_zeroed_page (GFP_KERNEL ); +if (port->xmit_buf) +kfifo_init (&port->xmit_fifo, port->xmit_buf,PAGE_SIZE ); + }mutex_unlock (&port->buf_mutex);if (port->xmit_buf ==NULL )return -ENOMEM ;
@@ -240,6 +243,7 @@ void tty_port_free_xmit_buf(struct tty_port *port)if (port->xmit_buf !=NULL ) {free_page ((unsigned long )port->xmit_buf); port->xmit_buf =NULL ; +INIT_KFIFO (port->xmit_fifo); }mutex_unlock (&port->buf_mutex); }
include/linux/tty_port.h +3 -0
@@ -2,6 +2,7 @@#ifndef _LINUX_TTY_PORT_H#define _LINUX_TTY_PORT_H +#include <linux/kfifo.h> #include <linux/kref.h> #include <linux/mutex.h> #include <linux/tty_buffer.h>
@@ -67,6 +68,7 @@ extern const struct tty_port_client_operations tty_port_default_client_ops;* @mutex: locking, for open, shutdown and other port operations * @buf_mutex: @xmit_buf alloc lock * @xmit_buf: optional xmit buffer used by some drivers +* @xmit_fifo: optional xmit buffer used by some drivers * @close_delay: delay in jiffies to wait when closing the port * @closing_wait: delay in jiffies for output to be sent before closing * @drain_delay: set to zero if no pure time based drain is needed else set to
@@ -110,6 +112,7 @@ struct tty_port {struct mutex mutex;struct mutex buf_mutex;unsigned char *xmit_buf; + DECLARE_KFIFO_PTR(xmit_fifo, unsigned char);unsigned int close_delay;unsigned int closing_wait;int drain_delay;
Signature · 1 line
2.34.1
PATCH 4/11 tty: tty_port_open, document shutdown vs failed activate
In reply to Jiri SlabyAdd a note that ->shutdown is not called when ->activate fails. Just so we are clear.
--- drivers/tty/tty_port.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/tty/tty_port.c +3 -0
@@ -736,6 +736,9 @@ EXPORT_SYMBOL_GPL(tty_port_install);* the device to be ready using tty_port_block_til_ready() (e.g. raises * DTR/CTS and waits for carrier). * +* Note that @port->ops->shutdown is not called when @port->ops->activate +* returns an error (on the contrary, @tty->ops->close is). +* * Locking: Caller holds tty lock. * * Note: may drop and reacquire tty lock (in tty_port_block_til_ready()) so
Signature · 1 line
2.34.1
PATCH 5/11 mxser: fix xmit_buf leak in activate when LSR == 0xff
In reply to Jiri SlabyWhen LSR is 0xff in ->activate() (rather unlike), we return an error. Provided ->shutdown() is not called when ->activate() fails, nothing actually frees the buffer in this case.
Fix this by properly freeing the buffer in a designated label. We jump there also from the "!info->type" if now too.
--- drivers/tty/mxser.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/tty/mxser.c +11 -4
@@ -744,6 +744,7 @@ static int mxser_activate(struct tty_port *port, struct tty_struct *tty) struct mxser_port *info = container_of(port, struct mxser_port, port);unsigned long page;unsigned long flags; +int ret; page =__get_free_page (GFP_KERNEL );if (!page)
@@ -753,9 +754,9 @@ static int mxser_activate(struct tty_port *port, struct tty_struct *tty)if (!info->type) {set_bit (TTY_IO_ERROR , &tty->flags); -free_page (page);spin_unlock_irqrestore (&info->slock, flags); -return 0 ; + ret =0 ; + goto err_free_xmit; } info->port.xmit_buf = (unsigned char *) page;
@@ -775,8 +776,10 @@ static int mxser_activate(struct tty_port *port, struct tty_struct *tty)if (capable (CAP_SYS_ADMIN )) {set_bit (TTY_IO_ERROR , &tty->flags);return 0 ; - }else -return -ENODEV ; + } + + ret = -ENODEV ; + goto err_free_xmit; }/*
@@ -821,6 +824,10 @@ static int mxser_activate(struct tty_port *port, struct tty_struct *tty)spin_unlock_irqrestore (&info->slock, flags);return 0 ; +err_free_xmit: +free_page (page); + info->port.xmit_buf =NULL ; +return ret; }/*
Signature · 1 line
2.34.1
PATCH 6/11 mxser: use tty_port xmit_buf helpers
In reply to Jiri SlabyFor the mxser driver to use kfifo, use tty_port_alloc_xmit_buf() and tty_port_free_xmit_buf() helpers in activate/shutdown, respectively.
As these calls have to be done in a non-atomic context, we have to move them outside spinlock and make sure irq is really stopped after we write to the ISR register.
--- drivers/tty/mxser.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-)
drivers/tty/mxser.c +9 -15
@@ -742,13 +742,12 @@ static void mxser_disable_and_clear_FIFO(struct mxser_port *info)static int mxser_activate (struct tty_port *port,struct tty_struct *tty) { struct mxser_port *info = container_of(port, struct mxser_port, port); -unsigned long page;unsigned long flags;int ret; - page =__get_free_page (GFP_KERNEL ); -if (!page) -return -ENOMEM ; + ret =tty_port_alloc_xmit_buf (port); +if (ret <0 ) +return ret;spin_lock_irqsave (&info->slock, flags);
@@ -758,7 +757,6 @@ static int mxser_activate(struct tty_port *port, struct tty_struct *tty) ret =0 ; goto err_free_xmit; } - info->port.xmit_buf = (unsigned char *) page;/* * Clear the FIFO buffers and disable them
@@ -825,8 +823,7 @@ static int mxser_activate(struct tty_port *port, struct tty_struct *tty)return 0 ; err_free_xmit: -free_page (page); - info->port.xmit_buf =NULL ; +tty_port_free_xmit_buf (port);return ret; }
@@ -862,14 +859,6 @@ static void mxser_shutdown_port(struct tty_port *port)*/ wake_up_interruptible (&info->port.delta_msr_wait); -/* -* Free the xmit buffer, if necessary -*/ -if (info->port.xmit_buf) { -free_page ((unsigned long ) info->port.xmit_buf); - info->port.xmit_buf =NULL ; - } - info->IER =0 ;outb (0x00 , info->ioaddr +UART_IER );
@@ -884,6 +873,11 @@ static void mxser_shutdown_port(struct tty_port *port)mxser_must_no_sw_flow_control (info->ioaddr);spin_unlock_irqrestore (&info->slock, flags); + +/* make sure ISR is not running while we free the buffer */ +synchronize_irq (info->board->irq); + +tty_port_free_xmit_buf (port); }/*
Signature · 1 line
2.34.1
PATCH 7/11 mxser: switch from xmit_buf to kfifo
In reply to Jiri SlabyUse kfifo for xmit buffer handling. The change is mostly straightforward. It saves complexity both on the stuffing side (mxser_write() and mxser_put_char()) and pulling side (mxser_transmit_chars()). In fact, the loop in mxser_write() can be completely deleted as the wrap of the buffer is taken care of in the kfifo code now.
--- drivers/tty/mxser.c | 74 +++++++++++++++++---------------------------- 1 file changed, 27 insertions(+), 47 deletions(-)
drivers/tty/mxser.c +27 -47
@@ -275,9 +275,6 @@ struct mxser_port {u8 read_status_mask;u8 ignore_status_mask;u8 xmit_fifo_size; -unsigned int xmit_head; -unsigned int xmit_tail; -unsigned int xmit_cnt;spinlock_t slock; };
@@ -813,7 +810,7 @@ static int mxser_activate(struct tty_port *port, struct tty_struct *tty) (void )inb (info->ioaddr +UART_MSR );clear_bit (TTY_IO_ERROR , &tty->flags); - info->xmit_cnt = info->xmit_head = info->xmit_tail =0 ; +kfifo_reset (&port->xmit_fifo);/* * and set the speed of the serial port
@@ -901,9 +898,8 @@ static void mxser_flush_buffer(struct tty_struct *tty)struct mxser_port *info = tty->driver_data;unsigned long flags; -spin_lock_irqsave (&info->slock, flags); - info->xmit_cnt = info->xmit_head = info->xmit_tail =0 ; +kfifo_reset (&info->port.xmit_fifo);outb (info->FCR |UART_FCR_CLEAR_RCVR |UART_FCR_CLEAR_XMIT , info->ioaddr +UART_FCR );
@@ -920,50 +916,34 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)static int mxser_write (struct tty_struct *tty,const unsigned char *buf,int count) { -int c, total =0 ;struct mxser_port *info = tty->driver_data;unsigned long flags; +int written; +bool is_empty; -while (1 ) { - c =min_t (int, count,min (SERIAL_XMIT_SIZE - info->xmit_cnt -1 , -SERIAL_XMIT_SIZE - info->xmit_head)); -if (c <=0 ) -break ; - -memcpy (info->port.xmit_buf + info->xmit_head, buf, c); -spin_lock_irqsave (&info->slock, flags); - info->xmit_head = (info->xmit_head + c) & - (SERIAL_XMIT_SIZE -1 ); - info->xmit_cnt += c; -spin_unlock_irqrestore (&info->slock, flags); - - buf += c; - count -= c; - total += c; - } +spin_lock_irqsave (&info->slock, flags); + written =kfifo_in (&info->port.xmit_fifo, buf, count); + is_empty =kfifo_is_empty (&info->port.xmit_fifo); +spin_unlock_irqrestore (&info->slock, flags); -if (info->xmit_cnt && !tty->flow.stopped) +if (!is_empty && !tty->flow.stopped)if (!tty->hw_stopped ||mxser_16550A_or_MUST (info))mxser_start_tx (info); -return total; +return written; }static int mxser_put_char (struct tty_struct *tty,unsigned char ch) {struct mxser_port *info = tty->driver_data;unsigned long flags; - -if (info->xmit_cnt >=SERIAL_XMIT_SIZE -1 ) -return 0 ; +int ret;spin_lock_irqsave (&info->slock, flags); - info->port.xmit_buf[info->xmit_head++] = ch; - info->xmit_head &=SERIAL_XMIT_SIZE -1 ; - info->xmit_cnt++; + ret =kfifo_put (&info->port.xmit_fifo, ch);spin_unlock_irqrestore (&info->slock, flags); -return 1 ; +return ret; }
@@ -971,7 +951,7 @@ static void mxser_flush_chars(struct tty_struct *tty) {struct mxser_port *info = tty->driver_data; -if (!info->xmit_cnt || tty->flow.stopped || +if (kfifo_is_empty (&info->port.xmit_fifo) || tty->flow.stopped || (tty->hw_stopped && !mxser_16550A_or_MUST (info)))return ;
@@ -981,16 +961,15 @@ static void mxser_flush_chars(struct tty_struct *tty)static unsigned int mxser_write_room (struct tty_struct *tty) {struct mxser_port *info = tty->driver_data; -int ret; - ret =SERIAL_XMIT_SIZE - info->xmit_cnt -1 ; -return ret <0 ?0 : ret; +return kfifo_avail (&info->port.xmit_fifo); }static unsigned int mxser_chars_in_buffer (struct tty_struct *tty) {struct mxser_port *info = tty->driver_data; -return info->xmit_cnt; + +return kfifo_len (&info->port.xmit_fifo); }/*
@@ -1379,7 +1358,7 @@ static void mxser_start(struct tty_struct *tty)unsigned long flags;spin_lock_irqsave (&info->slock, flags); -if (info->xmit_cnt) +if (!kfifo_is_empty (&info->port.xmit_fifo))__mxser_start_tx (info);spin_unlock_irqrestore (&info->slock, flags); }
@@ -1610,7 +1589,7 @@ static void mxser_transmit_chars(struct tty_struct *tty, struct mxser_port *portreturn ; } -if (!port->xmit_cnt || tty->flow.stopped || +if (kfifo_is_empty (&port->port.xmit_fifo) || tty->flow.stopped || (tty->hw_stopped && !mxser_16550A_or_MUST (port))) {__mxser_stop_tx (port);return ;
@@ -1618,18 +1597,19 @@ static void mxser_transmit_chars(struct tty_struct *tty, struct mxser_port *port count = port->xmit_fifo_size;do { -outb (port->port.xmit_buf[port->xmit_tail++], - port->ioaddr +UART_TX ); - port->xmit_tail &=SERIAL_XMIT_SIZE -1 ; - port->icount.tx++; -if (!--port->xmit_cnt) +unsigned char c; + +if (!kfifo_get (&port->port.xmit_fifo, &c))break ; + +outb (c, port->ioaddr +UART_TX ); + port->icount.tx++; }while (--count >0 ); -if (port->xmit_cnt <WAKEUP_CHARS ) +if (kfifo_len (&port->port.xmit_fifo) <WAKEUP_CHARS )tty_wakeup (tty); -if (!port->xmit_cnt) +if (kfifo_is_empty (&port->port.xmit_fifo))__mxser_stop_tx (port); }
Signature · 1 line
2.34.1
PATCH 8/11 serial: fsl_linflexuart: deduplicate character sending
In reply to Jiri SlabyIntroduce a new linflex_put_char() helper to send a character. And use it on both places this code was duplicated.
--- drivers/tty/serial/fsl_linflexuart.c | 42 +++++++++++----------------- 1 file changed, 17 insertions(+), 25 deletions(-)
drivers/tty/serial/fsl_linflexuart.c +17 -25
@@ -157,27 +157,29 @@ static void linflex_stop_rx(struct uart_port *port)writel (ier & ~LINFLEXD_LINIER_DRIE , port->membase +LINIER ); } -static inline void linflex_transmit_buffer (struct uart_port *sport) +static void linflex_put_char (struct uart_port *sport,unsigned char c) { -struct circ_buf *xmit = &sport->state->xmit; -unsigned char c;unsigned long status; -while (!uart_circ_empty (xmit)) { - c = xmit->buf[xmit->tail]; -writeb (c, sport->membase +BDRL ); +writeb (c, sport->membase +BDRL ); -/* Waiting for data transmission completed. */ -while (((status =readl (sport->membase +UARTSR )) & -LINFLEXD_UARTSR_DTFTFF ) != -LINFLEXD_UARTSR_DTFTFF ) - ; +/* Waiting for data transmission completed. */ +while (((status =readl (sport->membase +UARTSR )) & +LINFLEXD_UARTSR_DTFTFF ) != +LINFLEXD_UARTSR_DTFTFF ) + ; + +writel (status |LINFLEXD_UARTSR_DTFTFF , sport->membase +UARTSR ); +} +static inline void linflex_transmit_buffer (struct uart_port *sport) +{ +struct circ_buf *xmit = &sport->state->xmit; + +while (!uart_circ_empty (xmit)) { +linflex_put_char (sport, xmit->buf[xmit->tail]); xmit->tail = (xmit->tail +1 ) & (UART_XMIT_SIZE -1 ); sport->icount.tx++; - -writel (status |LINFLEXD_UARTSR_DTFTFF , - sport->membase +UARTSR ); }if (uart_circ_chars_pending (xmit) <WAKEUP_CHARS )
@@ -201,21 +203,11 @@ static irqreturn_t linflex_txint(int irq, void *dev_id)struct uart_port *sport = dev_id;struct circ_buf *xmit = &sport->state->xmit;unsigned long flags; -unsigned long status;spin_lock_irqsave (&sport->lock, flags);if (sport->x_char) { -writeb (sport->x_char, sport->membase +BDRL ); - -/* waiting for data transmission completed */ -while (((status =readl (sport->membase +UARTSR )) & -LINFLEXD_UARTSR_DTFTFF ) !=LINFLEXD_UARTSR_DTFTFF ) - ; - -writel (status |LINFLEXD_UARTSR_DTFTFF , - sport->membase +UARTSR ); - +linflex_put_char (sport, sport->x_char); goto out; }
Signature · 1 line
2.34.1
PATCH 9/11 serial: fsl_linflexuart: don't call uart_write_wakeup() twice
In reply to Jiri Slabylinflex_txint() calls linflex_transmit_buffer() which calls uart_write_wakeup(). So there is no point to repeat it in linflex_txint() again -- remove it.
--- drivers/tty/serial/fsl_linflexuart.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/tty/serial/fsl_linflexuart.c +0 -4
@@ -217,10 +217,6 @@ static irqreturn_t linflex_txint(int irq, void *dev_id) }linflex_transmit_buffer (sport); - -if (uart_circ_chars_pending (xmit) <WAKEUP_CHARS ) -uart_write_wakeup (sport); - out:spin_unlock_irqrestore (&sport->lock, flags);return IRQ_HANDLED ;
Signature · 1 line
2.34.1
PATCH 10/11 serial: make uart_console_write->putchar()'s character a char
In reply to Jiri SlabyCurrently, uart_console_write->putchar's second parameter (the character) is of type int. It makes little sense, provided uart_console_write() accepts the input string as "const char *s" and passes its content -- the characters -- to putchar(). So switch the character's type also to char.
This makes the types consistent.
--- drivers/tty/goldfish.c | 2 +- drivers/tty/hvc/hvc_dcc.c | 2 +- drivers/tty/serial/21285.c | 2 +- drivers/tty/serial/8250/8250_early.c | 2 +- drivers/tty/serial/8250/8250_ingenic.c | 2 +- drivers/tty/serial/8250/8250_port.c | 2 +- drivers/tty/serial/altera_jtaguart.c | 4 ++-- drivers/tty/serial/altera_uart.c | 2 +- drivers/tty/serial/amba-pl010.c | 2 +- drivers/tty/serial/amba-pl011.c | 6 +++--- drivers/tty/serial/apbuart.c | 2 +- drivers/tty/serial/ar933x_uart.c | 2 +- drivers/tty/serial/arc_uart.c | 2 +- drivers/tty/serial/atmel_serial.c | 2 +- drivers/tty/serial/bcm63xx_uart.c | 2 +- drivers/tty/serial/clps711x.c | 2 +- drivers/tty/serial/digicolor-usart.c | 2 +- drivers/tty/serial/dz.c | 2 +- drivers/tty/serial/earlycon-arm-semihost.c | 2 +- drivers/tty/serial/earlycon-riscv-sbi.c | 2 +- drivers/tty/serial/fsl_linflexuart.c | 4 ++-- drivers/tty/serial/fsl_lpuart.c | 4 ++-- drivers/tty/serial/imx.c | 2 +- drivers/tty/serial/imx_earlycon.c | 2 +- drivers/tty/serial/ip22zilog.c | 2 +- drivers/tty/serial/lantiq.c | 2 +- drivers/tty/serial/liteuart.c | 2 +- drivers/tty/serial/lpc32xx_hs.c | 2 +- drivers/tty/serial/meson_uart.c | 2 +- drivers/tty/serial/milbeaut_usio.c | 2 +- drivers/tty/serial/mps2-uart.c | 4 ++-- drivers/tty/serial/mvebu-uart.c | 4 ++-- drivers/tty/serial/mxs-auart.c | 2 +- drivers/tty/serial/omap-serial.c | 2 +- drivers/tty/serial/owl-uart.c | 2 +- drivers/tty/serial/pch_uart.c | 2 +- drivers/tty/serial/pic32_uart.c | 2 +- drivers/tty/serial/pmac_zilog.c | 2 +- drivers/tty/serial/pxa.c | 2 +- drivers/tty/serial/qcom_geni_serial.c | 2 +- drivers/tty/serial/rda-uart.c | 2 +- drivers/tty/serial/sa1100.c | 2 +- drivers/tty/serial/samsung_tty.c | 4 ++-- drivers/tty/serial/sb1250-duart.c | 2 +- drivers/tty/serial/sccnxp.c | 2 +- drivers/tty/serial/serial_core.c | 2 +- drivers/tty/serial/serial_txx9.c | 2 +- drivers/tty/serial/sh-sci.c | 2 +- drivers/tty/serial/sifive.c | 4 ++-- drivers/tty/serial/sprd_serial.c | 2 +- drivers/tty/serial/st-asc.c | 2 +- drivers/tty/serial/stm32-usart.c | 2 +- drivers/tty/serial/sunsu.c | 2 +- drivers/tty/serial/sunzilog.c | 4 ++-- drivers/tty/serial/uartlite.c | 4 ++-- drivers/tty/serial/vr41xx_siu.c | 2 +- drivers/tty/serial/vt8500_serial.c | 2 +- drivers/tty/serial/xilinx_uartps.c | 2 +- drivers/tty/serial/zs.c | 2 +- include/linux/serial_core.h | 2 +- 60 files changed, 71 insertions(+), 71 deletions(-)
drivers/tty/goldfish.c +1 -1
@@ -434,7 +434,7 @@ static int goldfish_tty_remove(struct platform_device *pdev) }#ifdef CONFIG_GOLDFISH_TTY_EARLY_CONSOLE -static void gf_early_console_putchar (struct uart_port *port,int ch) +static void gf_early_console_putchar (struct uart_port *port,char ch) {__raw_writel (ch, port->membase); }
drivers/tty/hvc/hvc_dcc.c +1 -1
@@ -15,7 +15,7 @@#define DCC_STATUS_RX (1 << 30)#define DCC_STATUS_TX (1 << 29) -static void dcc_uart_console_putchar (struct uart_port *port,int ch) +static void dcc_uart_console_putchar (struct uart_port *port,char ch) {while (__dcc_getstatus () &DCC_STATUS_TX )cpu_relax ();
drivers/tty/serial/21285.c +1 -1
@@ -403,7 +403,7 @@ static void serial21285_setup_ports(void) }#ifdef CONFIG_SERIAL_21285_CONSOLE -static void serial21285_console_putchar (struct uart_port *port,int ch) +static void serial21285_console_putchar (struct uart_port *port,char ch) {while (*CSR_UARTFLG &0x20 )barrier ();
drivers/tty/serial/8250/8250_early.c +1 -1
@@ -86,7 +86,7 @@ static void serial8250_early_out(struct uart_port *port, int offset, int value)#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE) -static void serial_putc (struct uart_port *port,int c) +static void serial_putc (struct uart_port *port,char c) {unsigned int status;
drivers/tty/serial/8250/8250_ingenic.c +1 -1
@@ -52,7 +52,7 @@ static void early_out(struct uart_port *port, int offset, uint8_t value)writel (value, port->membase + (offset <<2 )); } -static void ingenic_early_console_putc (struct uart_port *port,int c) +static void ingenic_early_console_putc (struct uart_port *port,char c) {uint8_t lsr;
drivers/tty/serial/8250/8250_port.c +1 -1
@@ -3303,7 +3303,7 @@ EXPORT_SYMBOL_GPL(serial8250_set_defaults);#ifdef CONFIG_SERIAL_8250_CONSOLE -static void serial8250_console_putchar (struct uart_port *port,int ch) +static void serial8250_console_putchar (struct uart_port *port,char ch) {struct uart_8250_port *up =up_to_u8250p (port);
drivers/tty/serial/altera_jtaguart.c +2 -2
@@ -298,7 +298,7 @@ static struct altera_jtaguart altera_jtaguart_ports[ALTERA_JTAGUART_MAXPORTS]; #if defined(CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE) #if defined(CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE_BYPASS) -static void altera_jtaguart_console_putc(struct uart_port *port, int c) +static void altera_jtaguart_console_putc(struct uart_port *port, char c) { unsigned long status; unsigned long flags;
@@ -318,7 +318,7 @@ static void altera_jtaguart_console_putc(struct uart_port *port, int c) spin_unlock_irqrestore(&port->lock, flags); }#else -static void altera_jtaguart_console_putc (struct uart_port *port,int c) +static void altera_jtaguart_console_putc (struct uart_port *port,char c) {unsigned long flags;
drivers/tty/serial/altera_uart.c +1 -1
@@ -438,7 +438,7 @@ static struct altera_uart altera_uart_ports[CONFIG_SERIAL_ALTERA_UART_MAXPORTS];#if defined(CONFIG_SERIAL_ALTERA_UART_CONSOLE ) -static void altera_uart_console_putc (struct uart_port *port,int c) +static void altera_uart_console_putc (struct uart_port *port,char c) {while (!(altera_uart_readl (port,ALTERA_UART_STATUS_REG ) &ALTERA_UART_STATUS_TRDY_MSK ))
drivers/tty/serial/amba-pl010.c +1 -1
@@ -556,7 +556,7 @@ static struct uart_amba_port *amba_ports[UART_NR];#ifdef CONFIG_SERIAL_AMBA_PL010_CONSOLE -static void pl010_console_putchar (struct uart_port *port,int ch) +static void pl010_console_putchar (struct uart_port *port,char ch) {struct uart_amba_port *uap = container_of(port, struct uart_amba_port, port);
drivers/tty/serial/amba-pl011.c +3 -3
@@ -2264,7 +2264,7 @@ static struct uart_amba_port *amba_ports[UART_NR];#ifdef CONFIG_SERIAL_AMBA_PL011_CONSOLE -static void pl011_console_putchar (struct uart_port *port,int ch) +static void pl011_console_putchar (struct uart_port *port,char ch) {struct uart_amba_port *uap = container_of(port, struct uart_amba_port, port);
@@ -2480,7 +2480,7 @@ static struct console amba_console = {#define AMBA_CONSOLE (&amba_console) -static void qdf2400_e44_putc (struct uart_port *port,int c) +static void qdf2400_e44_putc (struct uart_port *port,char c) {while (readl (port->membase + UART01x_FR) & UART01x_FR_TXFF)cpu_relax ();
@@ -2496,7 +2496,7 @@ static void qdf2400_e44_early_write(struct console *con, const char *s, unsigneduart_console_write (&dev->port, s, n, qdf2400_e44_putc); } -static void pl011_putc (struct uart_port *port,int c) +static void pl011_putc (struct uart_port *port,char c) {while (readl (port->membase + UART01x_FR) & UART01x_FR_TXFF)cpu_relax ();
drivers/tty/serial/apbuart.c +1 -1
@@ -413,7 +413,7 @@ static void apbuart_flush_fifo(struct uart_port *port)#ifdef CONFIG_SERIAL_GRLIB_GAISLER_APBUART_CONSOLE -static void apbuart_console_putchar (struct uart_port *port,int ch) +static void apbuart_console_putchar (struct uart_port *port,char ch) {unsigned int status; do {
drivers/tty/serial/ar933x_uart.c +1 -1
@@ -613,7 +613,7 @@ static void ar933x_uart_wait_xmitr(struct ar933x_uart_port *up) }while ((status &AR933X_UART_DATA_TX_CSR ) ==0 ); } -static void ar933x_uart_console_putchar (struct uart_port *port,int ch) +static void ar933x_uart_console_putchar (struct uart_port *port,char ch) {struct ar933x_uart_port *up = container_of(port, struct ar933x_uart_port, port);
drivers/tty/serial/arc_uart.c +1 -1
@@ -508,7 +508,7 @@ static int arc_serial_console_setup(struct console *co, char *options)return uart_set_options (port, co, baud, parity, bits, flow); } -static void arc_serial_console_putchar (struct uart_port *port,int ch) +static void arc_serial_console_putchar (struct uart_port *port,char ch) {while (!(UART_GET_STATUS (port) &TXEMPTY ))cpu_relax ();
drivers/tty/serial/atmel_serial.c +1 -1
@@ -2541,7 +2541,7 @@ static int atmel_init_port(struct atmel_uart_port *atmel_port, }#ifdef CONFIG_SERIAL_ATMEL_CONSOLE -static void atmel_console_putchar (struct uart_port *port,int ch) +static void atmel_console_putchar (struct uart_port *port,char ch) {while (!(atmel_uart_readl (port,ATMEL_US_CSR ) &ATMEL_US_TXRDY ))cpu_relax ();
drivers/tty/serial/bcm63xx_uart.c +1 -1
@@ -681,7 +681,7 @@ static void wait_for_xmitr(struct uart_port *port)/* * output given char */ -static void bcm_console_putchar (struct uart_port *port,int ch) +static void bcm_console_putchar (struct uart_port *port,char ch) {wait_for_xmitr (port);bcm_uart_writel (port, ch,UART_FIFO_REG );
drivers/tty/serial/clps711x.c +1 -1
@@ -348,7 +348,7 @@ static const struct uart_ops uart_clps711x_ops = { };#ifdef CONFIG_SERIAL_CLPS711X_CONSOLE -static void uart_clps711x_console_putchar (struct uart_port *port,int ch) +static void uart_clps711x_console_putchar (struct uart_port *port,char ch) {struct clps711x_port *s =dev_get_drvdata (port->dev);u32 sysflg =0 ;
drivers/tty/serial/digicolor-usart.c +1 -1
@@ -381,7 +381,7 @@ static const struct uart_ops digicolor_uart_ops = { .request_port = digicolor_uart_request_port, }; -static void digicolor_uart_console_putchar (struct uart_port *port,int ch) +static void digicolor_uart_console_putchar (struct uart_port *port,char ch) {while (digicolor_uart_tx_full (port))cpu_relax ();
drivers/tty/serial/dz.c +1 -1
@@ -802,7 +802,7 @@ static void __init dz_init_ports(void)* restored. Welcome to the world of PDP-11! * ------------------------------------------------------------------- */ -static void dz_console_putchar (struct uart_port *uport,int ch) +static void dz_console_putchar (struct uart_port *uport,char ch) {struct dz_port *dport =to_dport (uport);unsigned long flags;
drivers/tty/serial/earlycon-arm-semihost.c +1 -1
@@ -21,7 +21,7 @@/* * Semihosting-based debug console */ -static void smh_putc (struct uart_port *port,int c) +static void smh_putc (struct uart_port *port,char c) {#ifdef CONFIG_ARM64 asm volatile("mov x1, %0\n"
drivers/tty/serial/earlycon-riscv-sbi.c +1 -1
@@ -10,7 +10,7 @@#include <linux/serial_core.h> #include <asm/sbi.h> -static void sbi_putc (struct uart_port *port,int c) +static void sbi_putc (struct uart_port *port,char c) {sbi_console_putchar (c); }
drivers/tty/serial/fsl_linflexuart.c +2 -2
@@ -553,7 +553,7 @@ static const struct uart_ops linflex_pops = {static struct uart_port *linflex_ports[UART_NR ];#ifdef CONFIG_SERIAL_FSL_LINFLEXUART_CONSOLE -static void linflex_console_putchar (struct uart_port *port,int ch) +static void linflex_console_putchar (struct uart_port *port,char ch) {unsigned long cr;
@@ -578,7 +578,7 @@ static void linflex_console_putchar(struct uart_port *port, int ch) } } -static void linflex_earlycon_putchar (struct uart_port *port,int ch) +static void linflex_earlycon_putchar (struct uart_port *port,char ch) {unsigned long flags;char *ret;
drivers/tty/serial/fsl_lpuart.c +2 -2
@@ -2327,13 +2327,13 @@ static const struct uart_ops lpuart32_pops = {static struct lpuart_port *lpuart_ports[UART_NR ];#ifdef CONFIG_SERIAL_FSL_LPUART_CONSOLE -static void lpuart_console_putchar (struct uart_port *port,int ch) +static void lpuart_console_putchar (struct uart_port *port,char ch) {lpuart_wait_bit_set (port,UARTSR1 ,UARTSR1_TDRE );writeb (ch, port->membase +UARTDR ); } -static void lpuart32_console_putchar (struct uart_port *port,int ch) +static void lpuart32_console_putchar (struct uart_port *port,char ch) {lpuart32_wait_bit_set (port,UARTSTAT ,UARTSTAT_TDRE );lpuart32_write (port, ch,UARTDATA );
drivers/tty/serial/imx.c +1 -1
@@ -1958,7 +1958,7 @@ static const struct uart_ops imx_uart_pops = {static struct imx_port *imx_uart_ports[UART_NR ];#if IS_ENABLED (CONFIG_SERIAL_IMX_CONSOLE ) -static void imx_uart_console_putchar (struct uart_port *port,int ch) +static void imx_uart_console_putchar (struct uart_port *port,char ch) {struct imx_port *sport = (struct imx_port *)port;
drivers/tty/serial/imx_earlycon.c +1 -1
@@ -16,7 +16,7 @@#define UTS_TXFULL (1<<4)/* TxFIFO full */ #define IMX21_UTS 0xb4/* UART Test Register on all other i.mx*/ -static void imx_uart_console_early_putchar (struct uart_port *port,int ch) +static void imx_uart_console_early_putchar (struct uart_port *port,char ch) {while (readl_relaxed (port->membase +IMX21_UTS ) &UTS_TXFULL )cpu_relax ();
drivers/tty/serial/ip22zilog.c +1 -1
@@ -990,7 +990,7 @@ static struct zilog_layout * __init get_zs(int chip)#define ZS_PUT_CHAR_MAX_DELAY 2000/* 10 ms */ #ifdef CONFIG_SERIAL_IP22_ZILOG_CONSOLE -static void ip22zilog_put_char (struct uart_port *port,int ch) +static void ip22zilog_put_char (struct uart_port *port,char ch) {struct zilog_channel *channel =ZILOG_CHANNEL_FROM_PORT (port);int loops =ZS_PUT_CHAR_MAX_DELAY ;
drivers/tty/serial/lantiq.c +1 -1
@@ -598,7 +598,7 @@ static const struct uart_ops lqasc_pops = {#ifdef CONFIG_SERIAL_LANTIQ_CONSOLE static void -lqasc_console_putchar (struct uart_port *port,int ch) +lqasc_console_putchar (struct uart_port *port,char ch) {int fifofree;
drivers/tty/serial/liteuart.c +1 -1
@@ -93,7 +93,7 @@ static void liteuart_timer(struct timer_list *t)mod_timer (&uart->timer, jiffies +uart_poll_timeout (port)); } -static void liteuart_putchar (struct uart_port *port,int ch) +static void liteuart_putchar (struct uart_port *port,char ch) {while (litex_read8 (port->membase +OFF_TXFULL ))cpu_relax ();
drivers/tty/serial/lpc32xx_hs.c +1 -1
@@ -122,7 +122,7 @@ static void wait_for_xmit_ready(struct uart_port *port) } } -static void lpc32xx_hsuart_console_putchar (struct uart_port *port,int ch) +static void lpc32xx_hsuart_console_putchar (struct uart_port *port,char ch) {wait_for_xmit_ready (port);writel ((u32 )ch,LPC32XX_HSUART_FIFO (port->membase));
drivers/tty/serial/meson_uart.c +1 -1
@@ -513,7 +513,7 @@ static void meson_uart_enable_tx_engine(struct uart_port *port)writel (val, port->membase +AML_UART_CONTROL ); } -static void meson_console_putchar (struct uart_port *port,int ch) +static void meson_console_putchar (struct uart_port *port,char ch) {if (!port->membase)return ;
drivers/tty/serial/milbeaut_usio.c +1 -1
@@ -400,7 +400,7 @@ static const struct uart_ops mlb_usio_ops = {#ifdef CONFIG_SERIAL_MILBEAUT_USIO_CONSOLE -static void mlb_usio_console_putchar (struct uart_port *port,int c) +static void mlb_usio_console_putchar (struct uart_port *port,char c) {while (!(readb (port->membase +MLB_USIO_REG_SSR ) &MLB_USIO_SSR_TDRE ))cpu_relax ();
drivers/tty/serial/mps2-uart.c +2 -2
@@ -432,7 +432,7 @@ static const struct uart_ops mps2_uart_pops = {static DEFINE_IDR (ports_idr);#ifdef CONFIG_SERIAL_MPS2_UART_CONSOLE -static void mps2_uart_console_putchar (struct uart_port *port,int ch) +static void mps2_uart_console_putchar (struct uart_port *port,char ch) {while (mps2_uart_read8 (port, UARTn_STATE) & UARTn_STATE_TX_FULL)cpu_relax ();
@@ -484,7 +484,7 @@ static struct console mps2_uart_console = {#define MPS2_SERIAL_CONSOLE (&mps2_uart_console) -static void mps2_early_putchar (struct uart_port *port,int ch) +static void mps2_early_putchar (struct uart_port *port,char ch) {while (readb (port->membase + UARTn_STATE) & UARTn_STATE_TX_FULL)cpu_relax ();
drivers/tty/serial/mvebu-uart.c +2 -2
@@ -598,7 +598,7 @@ static const struct uart_ops mvebu_uart_ops = {#ifdef CONFIG_SERIAL_MVEBU_CONSOLE /* Early Console */ -static void mvebu_uart_putc (struct uart_port *port,int c) +static void mvebu_uart_putc (struct uart_port *port,char c) {unsigned int st;
@@ -659,7 +659,7 @@ static void wait_for_xmite(struct uart_port *port) (val & STAT_TX_EMP), 1, 10000); } -static void mvebu_uart_console_putchar (struct uart_port *port,int ch) +static void mvebu_uart_console_putchar (struct uart_port *port,char ch) {wait_for_xmitr (port);writel (ch, port->membase +UART_TSH (port));
drivers/tty/serial/mxs-auart.c +1 -1
@@ -1305,7 +1305,7 @@ static const struct uart_ops mxs_auart_ops = {static struct mxs_auart_port *auart_port[MXS_AUART_PORTS ];#ifdef CONFIG_SERIAL_MXS_AUART_CONSOLE -static void mxs_auart_console_putchar (struct uart_port *port,int ch) +static void mxs_auart_console_putchar (struct uart_port *port,char ch) {struct mxs_auart_port *s =to_auart_port (port);unsigned int to =1000 ;
drivers/tty/serial/omap-serial.c +1 -1
@@ -1194,7 +1194,7 @@ static void omap_serial_early_out(struct uart_port *port, int offset,writew (value, port->membase + offset); } -static void omap_serial_early_putc (struct uart_port *port,int c) +static void omap_serial_early_putc (struct uart_port *port,char c) {unsigned int status;
drivers/tty/serial/owl-uart.c +1 -1
@@ -516,7 +516,7 @@ static const struct uart_ops owl_uart_ops = {#ifdef CONFIG_SERIAL_OWL_CONSOLE -static void owl_console_putchar (struct uart_port *port,int ch) +static void owl_console_putchar (struct uart_port *port,char ch) {if (!port->membase)return ;
drivers/tty/serial/pch_uart.c +1 -1
@@ -1600,7 +1600,7 @@ static const struct uart_ops pch_uart_ops = {#ifdef CONFIG_SERIAL_PCH_UART_CONSOLE -static void pch_console_putchar (struct uart_port *port,int ch) +static void pch_console_putchar (struct uart_port *port,char ch) {struct eg20t_port *priv = container_of(port, struct eg20t_port, port);
drivers/tty/serial/pic32_uart.c +1 -1
@@ -691,7 +691,7 @@ static const struct uart_ops pic32_uart_ops = {#ifdef CONFIG_SERIAL_PIC32_CONSOLE /* output given char */ -static void pic32_console_putchar (struct uart_port *port,int ch) +static void pic32_console_putchar (struct uart_port *port,char ch) {struct pic32_sport *sport =to_pic32_sport (port);
drivers/tty/serial/pmac_zilog.c +1 -1
@@ -1944,7 +1944,7 @@ static void __exit exit_pmz(void)#ifdef CONFIG_SERIAL_PMACZILOG_CONSOLE -static void pmz_console_putchar (struct uart_port *port,int ch) +static void pmz_console_putchar (struct uart_port *port,char ch) {struct uart_pmac_port *uap = container_of(port, struct uart_pmac_port, port);
drivers/tty/serial/pxa.c +1 -1
@@ -619,7 +619,7 @@ static void wait_for_xmitr(struct uart_pxa_port *up) } } -static void serial_pxa_console_putchar (struct uart_port *port,int ch) +static void serial_pxa_console_putchar (struct uart_port *port,char ch) {struct uart_pxa_port *up = (struct uart_pxa_port *)port;
drivers/tty/serial/qcom_geni_serial.c +1 -1
@@ -397,7 +397,7 @@ static void qcom_geni_serial_poll_put_char(struct uart_port *uport,#endif #ifdef CONFIG_SERIAL_QCOM_GENI_CONSOLE -static void qcom_geni_serial_wr_char (struct uart_port *uport,int ch) +static void qcom_geni_serial_wr_char (struct uart_port *uport,char ch) {struct qcom_geni_private_data *private_data = uport->private_data;
drivers/tty/serial/rda-uart.c +1 -1
@@ -573,7 +573,7 @@ static const struct uart_ops rda_uart_ops = {#ifdef CONFIG_SERIAL_RDA_CONSOLE -static void rda_console_putchar (struct uart_port *port,int ch) +static void rda_console_putchar (struct uart_port *port,char ch) {if (!port->membase)return ;
drivers/tty/serial/sa1100.c +1 -1
@@ -695,7 +695,7 @@ void __init sa1100_register_uart(int idx, int port)#ifdef CONFIG_SERIAL_SA1100_CONSOLE -static void sa1100_console_putchar (struct uart_port *port,int ch) +static void sa1100_console_putchar (struct uart_port *port,char ch) {struct sa1100_port *sport = container_of(port, struct sa1100_port, port);
drivers/tty/serial/samsung_tty.c +2 -2
@@ -2478,7 +2478,7 @@ static void s3c24xx_serial_put_poll_char(struct uart_port *port,#endif /* CONFIG_CONSOLE_POLL */ static void -s3c24xx_serial_console_putchar (struct uart_port *port,int ch) +s3c24xx_serial_console_putchar (struct uart_port *port,char ch) {unsigned int ufcon =rd_regl (port,S3C2410_UFCON );
@@ -2965,7 +2965,7 @@ static void samsung_early_busyuart_fifo(struct uart_port *port) ; } -static void samsung_early_putc (struct uart_port *port,int c) +static void samsung_early_putc (struct uart_port *port,char c) {if (readl (port->membase +S3C2410_UFCON ) &S3C2410_UFCON_FIFOMODE )samsung_early_busyuart_fifo (port);
drivers/tty/serial/sb1250-duart.c +1 -1
@@ -820,7 +820,7 @@ static void __init sbd_probe_duarts(void)* console output. The console_lock is held by the caller, so we * shouldn't be interrupted for more console activity. */ -static void sbd_console_putchar (struct uart_port *uport,int ch) +static void sbd_console_putchar (struct uart_port *uport,char ch) {struct sbd_port *sport =to_sport (uport);
drivers/tty/serial/sccnxp.c +1 -1
@@ -828,7 +828,7 @@ static const struct uart_ops sccnxp_ops = { };#ifdef CONFIG_SERIAL_SCCNXP_CONSOLE -static void sccnxp_console_putchar (struct uart_port *port,int c) +static void sccnxp_console_putchar (struct uart_port *port,char c) {int tryes =100000 ;
drivers/tty/serial/serial_core.c +1 -1
@@ -1926,7 +1926,7 @@ static void uart_port_spin_lock_init(struct uart_port *port)*/ void uart_console_write (struct uart_port *port,const char *s,unsigned int count, -void (*putchar)(struct uart_port *,int )) +void (*putchar)(struct uart_port *,char )) {unsigned int i;
drivers/tty/serial/serial_txx9.c +1 -1
@@ -879,7 +879,7 @@ static void __init serial_txx9_register_ports(struct uart_driver *drv,#ifdef CONFIG_SERIAL_TXX9_CONSOLE -static void serial_txx9_console_putchar (struct uart_port *port,int ch) +static void serial_txx9_console_putchar (struct uart_port *port,char ch) {struct uart_txx9_port *up =to_uart_txx9_port (port);
drivers/tty/serial/sh-sci.c +1 -1
@@ -2957,7 +2957,7 @@ static void sci_cleanup_single(struct sci_port *port)#if defined(CONFIG_SERIAL_SH_SCI_CONSOLE ) || \ defined(CONFIG_SERIAL_SH_SCI_EARLYCON ) -static void serial_console_putchar (struct uart_port *port,int ch) +static void serial_console_putchar (struct uart_port *port,char ch) {sci_poll_put_char (port, ch); }
drivers/tty/serial/sifive.c +2 -2
@@ -756,7 +756,7 @@ static void sifive_serial_poll_put_char(struct uart_port *port,*/ #ifdef CONFIG_SERIAL_EARLYCON -static void early_sifive_serial_putc (struct uart_port *port,int c) +static void early_sifive_serial_putc (struct uart_port *port,char c) {while (__ssp_early_readl (port,SIFIVE_SERIAL_TXDATA_OFFS ) &SIFIVE_SERIAL_TXDATA_FULL_MASK )
@@ -800,7 +800,7 @@ OF_EARLYCON_DECLARE(sifive, "sifive,fu540-c000-uart0",static struct sifive_serial_port *sifive_serial_console_ports[SIFIVE_SERIAL_MAX_PORTS ]; -static void sifive_serial_console_putchar (struct uart_port *port,int ch) +static void sifive_serial_console_putchar (struct uart_port *port,char ch) {struct sifive_serial_port *ssp =port_to_sifive_serial_port (port);
drivers/tty/serial/sprd_serial.c +1 -1
@@ -1058,7 +1058,7 @@ console_initcall(sprd_serial_console_init);#define SPRD_CONSOLE (&sprd_console)/* Support for earlycon */ -static void sprd_putc (struct uart_port *port,int c) +static void sprd_putc (struct uart_port *port,char c) {unsigned int timeout =SPRD_TIMEOUT ;
drivers/tty/serial/st-asc.c +1 -1
@@ -854,7 +854,7 @@ static int asc_serial_resume(struct device *dev)/*----------------------------------------------------------------------*/ #ifdef CONFIG_SERIAL_ST_ASC_CONSOLE -static void asc_console_putchar (struct uart_port *port,int ch) +static void asc_console_putchar (struct uart_port *port,char ch) {unsigned int timeout =1000000 ;
drivers/tty/serial/stm32-usart.c +1 -1
@@ -1629,7 +1629,7 @@ static int stm32_usart_serial_remove(struct platform_device *pdev) }#ifdef CONFIG_SERIAL_STM32_CONSOLE -static void stm32_usart_console_putchar (struct uart_port *port,int ch) +static void stm32_usart_console_putchar (struct uart_port *port,char ch) {struct stm32_port *stm32_port =to_stm32_port (port);const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
drivers/tty/serial/sunsu.c +1 -1
@@ -1281,7 +1281,7 @@ static void wait_for_xmitr(struct uart_sunsu_port *up) } } -static void sunsu_console_putchar (struct uart_port *port,int ch) +static void sunsu_console_putchar (struct uart_port *port,char ch) {struct uart_sunsu_port *up = container_of(port, struct uart_sunsu_port, port);
drivers/tty/serial/sunzilog.c +2 -2
@@ -100,7 +100,7 @@ struct uart_sunzilog_port {#endif }; -static void sunzilog_putchar (struct uart_port *port,int ch); +static void sunzilog_putchar (struct uart_port *port,char ch);#define ZILOG_CHANNEL_FROM_PORT (PORT ) ((struct zilog_channel __iomem *)((PORT)->membase))#define UART_ZILOG (PORT ) ((struct uart_sunzilog_port *)(PORT))
@@ -1125,7 +1125,7 @@ static void sunzilog_free_tables(void)#define ZS_PUT_CHAR_MAX_DELAY 2000/* 10 ms */ -static void __maybe_unused sunzilog_putchar (struct uart_port *port,int ch) +static void __maybe_unused sunzilog_putchar (struct uart_port *port,char ch) {struct zilog_channel __iomem *channel =ZILOG_CHANNEL_FROM_PORT (port);int loops =ZS_PUT_CHAR_MAX_DELAY ;
drivers/tty/serial/uartlite.c +2 -2
@@ -482,7 +482,7 @@ static void ulite_console_wait_tx(struct uart_port *port) "timeout waiting for TX buffer empty\n"); } -static void ulite_console_putchar (struct uart_port *port,int ch) +static void ulite_console_putchar (struct uart_port *port,char ch) {ulite_console_wait_tx (port);uart_out32 (ch,ULITE_TX , port);
@@ -558,7 +558,7 @@ static struct console ulite_console = { .data = &ulite_uart_driver, }; -static void early_uartlite_putc (struct uart_port *port,int c) +static void early_uartlite_putc (struct uart_port *port,char c) {/* * Limit how many times we'll spin waiting for TX FIFO status.
drivers/tty/serial/vr41xx_siu.c +1 -1
@@ -743,7 +743,7 @@ static void wait_for_xmitr(struct uart_port *port) } } -static void siu_console_putchar (struct uart_port *port,int ch) +static void siu_console_putchar (struct uart_port *port,char ch) {wait_for_xmitr (port);siu_write (port,UART_TX , ch);
drivers/tty/serial/vt8500_serial.c +1 -1
@@ -484,7 +484,7 @@ static void wait_for_xmitr(struct uart_port *port) }while (status &0x10 ); } -static void vt8500_console_putchar (struct uart_port *port,int c) +static void vt8500_console_putchar (struct uart_port *port,char c) {wait_for_xmitr (port);writeb (c, port->membase +VT8500_TXFIFO );
drivers/tty/serial/xilinx_uartps.c +1 -1
@@ -1142,7 +1142,7 @@ static struct uart_driver cdns_uart_uart_driver;* @port: Handle to the uart port structure * @ch: Character to be written */ -static void cdns_uart_console_putchar (struct uart_port *port,int ch) +static void cdns_uart_console_putchar (struct uart_port *port,char ch) {while (readl (port->membase +CDNS_UART_SR ) &CDNS_UART_SR_TXFULL )cpu_relax ();
drivers/tty/serial/zs.c +1 -1
@@ -1124,7 +1124,7 @@ static int __init zs_probe_sccs(void)#ifdef CONFIG_SERIAL_ZS_CONSOLE -static void zs_console_putchar (struct uart_port *uport,int ch) +static void zs_console_putchar (struct uart_port *uport,char ch) {struct zs_port *zport =to_zport (uport);struct zs_scc *scc = zport->scc;
include/linux/serial_core.h +1 -1
@@ -399,7 +399,7 @@ int uart_set_options(struct uart_port *port, struct console *co, int baud,struct tty_driver *uart_console_device (struct console *co,int *index);void uart_console_write (struct uart_port *port,const char *s,unsigned int count, -void (*putchar)(struct uart_port *,int )); +void (*putchar)(struct uart_port *,char ));/* * Port/driver registration/removal
Signature · 1 line
2.34.1
Re: [PATCH 10/11] serial: make uart_console_write->putchar()'s character a char
Le 24/01/2022 à 08:14, Jiri Slaby a écrit :
Quoted 49 lines
Currently, uart_console_write->putchar's second parameter (the character) is of type int. It makes little sense, provided
uart_console_write()accepts the input string as "const char *s" and passes its content -- the characters -- toputchar(). So switch the character's type also to char.This makes the types consistent.
Signed-off-by Jiri Slaby <[email protected]>Cc Paul Cercueil <[email protected]>Cc Tobias Klauser <[email protected]>Cc Russell King <[email protected]>Cc Vineet Gupta <[email protected]>Cc Richard Genoud <[email protected]>Cc Nicolas Ferre <[email protected]>Cc Alexandre Belloni <[email protected]>Cc Ludovic Desroches <[email protected]>Cc Florian Fainelli <[email protected]>Cc Alexander Shiyan <[email protected]>Cc Baruch Siach <[email protected]>Cc "Maciej W. Rozycki" <[email protected]>Cc Paul Walmsley <[email protected]>Cc Palmer Dabbelt <[email protected]>Cc Albert Ou <[email protected]>Cc Shawn Guo <[email protected]>Cc Sascha Hauer <[email protected]>Cc Pengutronix Kernel Team <[email protected]>Cc Fabio Estevam <[email protected]>Cc NXP Linux Team <[email protected]>Cc Karol Gugala <[email protected]>Cc Mateusz Holenko <[email protected]>Cc Vladimir Zapolskiy <[email protected]>Cc Neil Armstrong <[email protected]>Cc Kevin Hilman <[email protected]>Cc Jerome Brunet <[email protected]>Cc Martin Blumenstingl <[email protected]>Cc Taichi Sugaya <[email protected]>Cc Takao Orito <[email protected]>Cc Liviu Dudau <[email protected]>Cc Sudeep Holla <[email protected]>Cc Lorenzo Pieralisi <[email protected]>Cc "Andreas Färber" <[email protected]>Cc Manivannan Sadhasivam <[email protected]>Cc Michael Ellerman <[email protected]>Cc Benjamin Herrenschmidt <[email protected]>Cc Paul Mackerras <[email protected]>Cc Andy Gross <[email protected]>Cc Bjorn Andersson <[email protected]>Cc Krzysztof Kozlowski <[email protected]>Cc Orson Zhai <[email protected]>
Quoted 8 lines
Cc Baolin Wang <[email protected]>Cc Chunyan Zhang <[email protected]>Cc Patrice Chotard <[email protected]>Cc Maxime Coquelin <[email protected]>Cc Alexandre Torgue <[email protected]>Cc "David S. Miller" <[email protected]>Cc Peter Korsgaard <[email protected]>Cc Michal Simek <[email protected]>
For drivers/tty/serial/atmel_serial.c:
Quoted 54 lines
--- drivers/tty/goldfish.c | 2 +- drivers/tty/hvc/hvc_dcc.c | 2 +- drivers/tty/serial/21285.c | 2 +- drivers/tty/serial/8250/8250_early.c | 2 +- drivers/tty/serial/8250/8250_ingenic.c | 2 +- drivers/tty/serial/8250/8250_port.c | 2 +- drivers/tty/serial/altera_jtaguart.c | 4 ++-- drivers/tty/serial/altera_uart.c | 2 +- drivers/tty/serial/amba-pl010.c | 2 +- drivers/tty/serial/amba-pl011.c | 6 +++--- drivers/tty/serial/apbuart.c | 2 +- drivers/tty/serial/ar933x_uart.c | 2 +- drivers/tty/serial/arc_uart.c | 2 +- drivers/tty/serial/atmel_serial.c | 2 +- drivers/tty/serial/bcm63xx_uart.c | 2 +- drivers/tty/serial/clps711x.c | 2 +- drivers/tty/serial/digicolor-usart.c | 2 +- drivers/tty/serial/dz.c | 2 +- drivers/tty/serial/earlycon-arm-semihost.c | 2 +- drivers/tty/serial/earlycon-riscv-sbi.c | 2 +- drivers/tty/serial/fsl_linflexuart.c | 4 ++-- drivers/tty/serial/fsl_lpuart.c | 4 ++-- drivers/tty/serial/imx.c | 2 +- drivers/tty/serial/imx_earlycon.c | 2 +- drivers/tty/serial/ip22zilog.c | 2 +- drivers/tty/serial/lantiq.c | 2 +- drivers/tty/serial/liteuart.c | 2 +- drivers/tty/serial/lpc32xx_hs.c | 2 +- drivers/tty/serial/meson_uart.c | 2 +- drivers/tty/serial/milbeaut_usio.c | 2 +- drivers/tty/serial/mps2-uart.c | 4 ++-- drivers/tty/serial/mvebu-uart.c | 4 ++-- drivers/tty/serial/mxs-auart.c | 2 +- drivers/tty/serial/omap-serial.c | 2 +- drivers/tty/serial/owl-uart.c | 2 +- drivers/tty/serial/pch_uart.c | 2 +- drivers/tty/serial/pic32_uart.c | 2 +- drivers/tty/serial/pmac_zilog.c | 2 +- drivers/tty/serial/pxa.c | 2 +- drivers/tty/serial/qcom_geni_serial.c | 2 +- drivers/tty/serial/rda-uart.c | 2 +- drivers/tty/serial/sa1100.c | 2 +- drivers/tty/serial/samsung_tty.c | 4 ++-- drivers/tty/serial/sb1250-duart.c | 2 +- drivers/tty/serial/sccnxp.c | 2 +- drivers/tty/serial/serial_core.c | 2 +- drivers/tty/serial/serial_txx9.c | 2 +- drivers/tty/serial/sh-sci.c | 2 +- drivers/tty/serial/sifive.c | 4 ++-- drivers/tty/serial/sprd_serial.c | 2 +- drivers/tty/serial/st-asc.c | 2 +- drivers/tty/serial/stm32-usart.c | 2 +- drivers/tty/serial/sunsu.c | 2 +-
Quoted 9 lines
drivers/tty/serial/sunzilog.c | 4 ++-- drivers/tty/serial/uartlite.c | 4 ++-- drivers/tty/serial/vr41xx_siu.c | 2 +- drivers/tty/serial/vt8500_serial.c | 2 +- drivers/tty/serial/xilinx_uartps.c | 2 +- drivers/tty/serial/zs.c | 2 +- include/linux/serial_core.h | 2 +- 60 files changed, 71 insertions(+), 71 deletions(-)
Thanks!
kernel test robot
build botRe: [PATCH 10/11] serial: make uart_console_write->putchar()'s character a char
In reply to Jiri SlabyI love your patch! Yet something to improve:
Hi Jiri,
I love your patch! Yet something to improve:
[auto build test ERROR on tty/tty-testing]
[also build test ERROR on v5.17-rc1 next-20220124]
[cannot apply to shawnguo/for-next davem-sparc/master]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Jiri-Slaby/TTY-patches-for-5-18/20220124-151758 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing config: microblaze-randconfig-r006-20220124 (https://download.01.org/0day-ci/archive/20220124/202201242255.WTSwb6EN-lkp(a)intel.com/config) compiler: microblaze-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/45520d4f6db241db0b77f41162adba4a9977956c
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Jiri-Slaby/TTY-patches-for-5-18/20220124-151758
git checkout 45520d4f6db241db0b77f41162adba4a9977956c
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=microblaze SHELL=/bin/bash drivers/tty/serial/
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
drivers/tty/serial/sprd_serial.c: In function 'sprd_console_write':
>> drivers/tty/serial/sprd_serial.c:1007:44: error: passing argument 4 of 'uart_console_write' from incompatible pointer type [-Werror=incompatible-pointer-types]
1007 | uart_console_write(port, s, count, sprd_console_putchar);
| ^~~~~~~~~~~~~~~~~~~~
| |
| void (*)(struct uart_port *, int)
In file included from drivers/tty/serial/sprd_serial.c:18:
include/linux/serial_core.h:402:32: note: expected 'void (*)(struct uart_port *, char)' but argument is of type 'void (*)(struct uart_port *, int)'
402 | void (*putchar)(struct uart_port *, char));
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~cc1: some warnings being treated as errors
vim +/uart_console_write +1007 drivers/tty/serial/sprd_serial.c
b7396a38fb28db Chunyan Zhang 2015-01-28 992
b7396a38fb28db Chunyan Zhang 2015-01-28 993 static void sprd_console_write(struct console *co, const char *s,
b7396a38fb28db Chunyan Zhang 2015-01-28 994 unsigned int count)
b7396a38fb28db Chunyan Zhang 2015-01-28 995 {
b7396a38fb28db Chunyan Zhang 2015-01-28 996 struct uart_port *port = &sprd_port[co->index]->port;
b7396a38fb28db Chunyan Zhang 2015-01-28 997 int locked = 1;
b7396a38fb28db Chunyan Zhang 2015-01-28 998 unsigned long flags;
b7396a38fb28db Chunyan Zhang 2015-01-28 999
b7396a38fb28db Chunyan Zhang 2015-01-28 1000 if (port->sysrq)
b7396a38fb28db Chunyan Zhang 2015-01-28 1001 locked = 0;
b7396a38fb28db Chunyan Zhang 2015-01-28 1002 else if (oops_in_progress)
b7396a38fb28db Chunyan Zhang 2015-01-28 1003 locked = spin_trylock_irqsave(&port->lock, flags);
b7396a38fb28db Chunyan Zhang 2015-01-28 1004 else
b7396a38fb28db Chunyan Zhang 2015-01-28 1005 spin_lock_irqsave(&port->lock, flags);
b7396a38fb28db Chunyan Zhang 2015-01-28 1006
b7396a38fb28db Chunyan Zhang 2015-01-28 @1007 uart_console_write(port, s, count, sprd_console_putchar);
b7396a38fb28db Chunyan Zhang 2015-01-28 1008
b7396a38fb28db Chunyan Zhang 2015-01-28 1009 /* wait for transmitter to become empty */
b7396a38fb28db Chunyan Zhang 2015-01-28 1010 wait_for_xmitr(port);
b7396a38fb28db Chunyan Zhang 2015-01-28 1011
b7396a38fb28db Chunyan Zhang 2015-01-28 1012 if (locked)
b7396a38fb28db Chunyan Zhang 2015-01-28 1013 spin_unlock_irqrestore(&port->lock, flags);
b7396a38fb28db Chunyan Zhang 2015-01-28 1014 }
b7396a38fb28db Chunyan Zhang 2015-01-28 1015 ---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Jiri Slaby
maintainerRe: [PATCH 10/11] serial: make uart_console_write->putchar()'s character a char
Quoted 3 lines · kernel test robot
Hi Jiri,
I love your patch! Yet something to improve:
Please skip this patch. I wonder why the bot didn't catch it in my queue already.
Quoted 70 lines
[auto build test ERROR on tty/tty-testing]
[also build test ERROR on v5.17-rc1 next-20220124]
[cannot apply to shawnguo/for-next davem-sparc/master]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]url: https://github.com/0day-ci/linux/commits/Jiri-Slaby/TTY-patches-for-5-18/20220124-151758 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing config: microblaze-randconfig-r006-20220124 (https://download.01.org/0day-ci/archive/20220124/202201242255.WTSwb6EN-lkp(a)intel.com/config) compiler: microblaze-linux-gcc (GCC) 11.2.0reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/45520d4f6db241db0b77f41162adba4a9977956c
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Jiri-Slaby/TTY-patches-for-5-18/20220124-151758
git checkout45520d4f6db241db0b77f41162adba4a9977956c
# save the config file to linux build tree
mkdirbuild_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=microblaze SHELL=/bin/bashdrivers/tty/serial/If you fix the issue, kindly add following tag as appropriate
Reported-by kernel test robot <[email protected]>All errors (new ones prefixed by >>):
drivers/tty/serial/sprd_serial.c: In function 'sprd_console_write':Quoted 1 line
Quoted 1 line
drivers/tty/serial/sprd_serial.c:1007:44: error: passing argument 4 of 'uart_console_write' from incompatible pointer type [-Werror=incompatible-pointer-types]1007 | uart_console_write(port, s, count, sprd_console_putchar); | ^~~~~~~~~~~~~~~~~~~~ | | | void (*)(struct uart_port *, int)In file included from
drivers/tty/serial/sprd_serial.c:18:
include/linux/serial_core.h:402:32: note: expected 'void (*)(structuart_port*, char)' but argument is of type 'void (*)(structuart_port*, int)'
402 | void (*putchar)(structuart_port*, char));
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errorsvim +/uart_console_write +1007
drivers/tty/serial/sprd_serial.cb7396a38fb28db Chunyan Zhang 2015-01-28 992 b7396a38fb28db Chunyan Zhang 2015-01-28 993 static void sprd_console_write(struct console *co, const char *s, b7396a38fb28db Chunyan Zhang 2015-01-28 994 unsigned int count) b7396a38fb28db Chunyan Zhang 2015-01-28 995 { b7396a38fb28db Chunyan Zhang 2015-01-28 996 struct uart_port *port = &sprd_port[co->index]->port; b7396a38fb28db Chunyan Zhang 2015-01-28 997 int locked = 1; b7396a38fb28db Chunyan Zhang 2015-01-28 998 unsigned long flags; b7396a38fb28db Chunyan Zhang 2015-01-28 999 b7396a38fb28db Chunyan Zhang 2015-01-28 1000 if (port->sysrq) b7396a38fb28db Chunyan Zhang 2015-01-28 1001 locked = 0; b7396a38fb28db Chunyan Zhang 2015-01-28 1002 else if (oops_in_progress) b7396a38fb28db Chunyan Zhang 2015-01-28 1003 locked = spin_trylock_irqsave(&port->lock, flags); b7396a38fb28db Chunyan Zhang 2015-01-28 1004 else b7396a38fb28db Chunyan Zhang 2015-01-28 1005 spin_lock_irqsave(&port->lock, flags); b7396a38fb28db Chunyan Zhang 2015-01-28 1006 b7396a38fb28db Chunyan Zhang 2015-01-28 @1007 uart_console_write(port, s, count, sprd_console_putchar); b7396a38fb28db Chunyan Zhang 2015-01-28 1008 b7396a38fb28db Chunyan Zhang 2015-01-28 1009 /* wait for transmitter to become empty */ b7396a38fb28db Chunyan Zhang 2015-01-28 1010 wait_for_xmitr(port); b7396a38fb28db Chunyan Zhang 2015-01-28 1011 b7396a38fb28db Chunyan Zhang 2015-01-28 1012 if (locked) b7396a38fb28db Chunyan Zhang 2015-01-28 1013 spin_unlock_irqrestore(&port->lock, flags); b7396a38fb28db Chunyan Zhang 2015-01-28 1014 } b7396a38fb28db Chunyan Zhang 2015-01-28 1015---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Signature · 2 lines
js suse labs
Greg KH
maintainerRe: [PATCH 10/11] serial: make uart_console_write->putchar()'s character a char
Quoted 7 lines · Jiri Slaby
Quoted 3 lines · kernel test robot
Hi Jiri,
I love your patch! Yet something to improve:
Please skip this patch. I wonder why the bot didn't catch it in my queue already.
Now skipped. Thanks for all of the other patches, now queued up.
greg k-h
kernel test robot
build botRe: [PATCH 10/11] serial: make uart_console_write->putchar()'s character a char
In reply to Jiri SlabyI love your patch! Yet something to improve:
Hi Jiri,
I love your patch! Yet something to improve:
[auto build test ERROR on tty/tty-testing]
[also build test ERROR on v5.17-rc1 next-20220124]
[cannot apply to shawnguo/for-next davem-sparc/master]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Jiri-Slaby/TTY-patches-for-5-18/20220124-151758 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing config: arc-randconfig-r043-20220124 (https://download.01.org/0day-ci/archive/20220125/202201250004.SHBbOjs3-lkp(a)intel.com/config) compiler: arc-elf-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/45520d4f6db241db0b77f41162adba4a9977956c
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Jiri-Slaby/TTY-patches-for-5-18/20220124-151758
git checkout 45520d4f6db241db0b77f41162adba4a9977956c
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arc SHELL=/bin/bash drivers/tty/serial/
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
drivers/tty/serial/omap-serial.c: In function 'serial_omap_console_write':
>> drivers/tty/serial/omap-serial.c:1272:49: error: passing argument 4 of 'uart_console_write' from incompatible pointer type [-Werror=incompatible-pointer-types]
1272 | uart_console_write(&up->port, s, count, serial_omap_console_putchar);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| void (*)(struct uart_port *, int)
In file included from drivers/tty/serial/omap-serial.c:30:
include/linux/serial_core.h:402:32: note: expected 'void (*)(struct uart_port *, char)' but argument is of type 'void (*)(struct uart_port *, int)'
402 | void (*putchar)(struct uart_port *, char));
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~cc1: some warnings being treated as errors
vim +/uart_console_write +1272 drivers/tty/serial/omap-serial.c
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1248
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1249 static void
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1250 serial_omap_console_write(struct console *co, const char *s,
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1251 unsigned int count)
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1252 {
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1253 struct uart_omap_port *up = serial_omap_console_ports[co->index];
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1254 unsigned long flags;
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1255 unsigned int ier;
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1256 int locked = 1;
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1257
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1258 local_irq_save(flags);
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1259 if (up->port.sysrq)
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1260 locked = 0;
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1261 else if (oops_in_progress)
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1262 locked = spin_trylock(&up->port.lock);
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1263 else
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1264 spin_lock(&up->port.lock);
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1265
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1266 /*
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1267 * First save the IER then disable the interrupts
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1268 */
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1269 ier = serial_in(up, UART_IER);
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1270 serial_out(up, UART_IER, 0);
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1271
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 @1272 uart_console_write(&up->port, s, count, serial_omap_console_putchar);
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1273
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1274 /*
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1275 * Finally, wait for transmitter to become empty
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1276 * and restore the IER
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1277 */
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1278 wait_for_xmitr(up);
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1279 serial_out(up, UART_IER, ier);
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1280 /*
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1281 * The receive handling will happen properly because the
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1282 * receive ready bit will still be set; it is not cleared
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1283 * on read. However, modem control will not, we must
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1284 * call it if we have saved something in the saved flags
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1285 * while processing with interrupts off.
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1286 */
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1287 if (up->msr_saved_flags)
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1288 check_modem_status(up);
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1289
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1290 if (locked)
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1291 spin_unlock(&up->port.lock);
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1292 local_irq_restore(flags);
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1293 }
b612633b592807 drivers/serial/omap-serial.c Govindraj.R 2010-09-27 1294 ---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Maciej W. Rozycki
maintainerRe: [PATCH 10/11] serial: make uart_console_write->putchar()'s character a char
In reply to Jiri Slabydrivers/tty/serial/dz.c static void __init dz_init_ports(void) · line 808
Quoted 13 lines · Jiri Slaby
drivers/tty/serial/dz.c +1
-1@@ -802,7 +802,7 @@ static void __init dz_init_ports(void)* restored. Welcome to the world of PDP-11! * ------------------------------------------------------------------- */ -static void dz_console_putchar (struct uart_port *uport,int ch) +static void dz_console_putchar (struct uart_port *uport,char ch) {struct dz_port *dport =to_dport (uport);unsigned long flags;
Hmm, this is unsafe, because on the MIPS target the lone `char' type is
signed and therefore a call to ->putchar' will see ch' sign-extended from bit #7 to the width of the argument register used. Which means that if a character is sent to the console that has its bit #7 set, then the call to:
dz_out(dport, DZ_TDR, ch);
i.e.:
static void dz_out(struct dz_port *dport, unsigned offset, u16 value)
will send a value to DZ_TDR with bits #15:8 set to all-ones. And bits #11:8 there are the BREAK control bits, active high, for serial lines #3:0 respectively.
We could handle this with a preparatory change by calling:
dz_out(dport, DZ_TDR, ch & 0xffu);
instead, but perhaps ->putchar' should simply take unsigned char' or maybe even `u8' as its third argument?
Quoted 13 lines
include/linux/serial_core.h +1
-1@@ -399,7 +399,7 @@ int uart_set_options(struct uart_port *port, struct console *co, int baud, struct tty_driver *uart_console_device(struct console *co, int *index);void uart_console_write (struct uart_port *port,const char *s,unsigned int count, -void (*putchar)(struct uart_port *,int )); +void (*putchar)(struct uart_port *,char ));/*
Quoted 1 line
* Port/driver registration/removal
I.e.:
void (*putchar)(struct uart_port *, unsigned char));
I can see we get it right already with:
unsigned char x_char; /* xon/xoff char */
and for `dz_transmit_chars' we have:
unsigned char tmp; [...] tmp = xmit->buf[xmit->tail]; xmit->tail = (xmit->tail + 1) & (DZ_XMIT_SIZE - 1); dz_out(dport, DZ_TDR, tmp);
(because `struct circ_buf' is generic and not limited to unsigned buffer contents interpretation; it's not clear to me if that has been intended though).
Maciej
Jiri Slaby
maintainerRe: [PATCH 10/11] serial: make uart_console_write->putchar()'s character a char
Quoted 70 lines · Maciej W. Rozycki
drivers/tty/serial/dz.c static void __init dz_init_ports(void) · line 808
Quoted 13 lines · Jiri Slaby
drivers/tty/serial/dz.c +1
-1@@ -802,7 +802,7 @@ static void __init dz_init_ports(void)* restored. Welcome to the world of PDP-11! * ------------------------------------------------------------------- */ -static void dz_console_putchar (struct uart_port *uport,int ch) +static void dz_console_putchar (struct uart_port *uport,char ch) {struct dz_port *dport =to_dport (uport);unsigned long flags;Hmm, this is unsafe, because on the MIPS target the lone `char' type is
signed and therefore a call to->putchar' will seech' sign-extended from bit #7 to the width of the argument register used. Which means that if a character is sent to the console that has its bit #7 set, then the call to:dz_out(dport, DZ_TDR, ch);i.e.:
static void
dz_out(struct dz_port *dport, unsigned offset, u16 value)will send a value to
DZ_TDRwith bits #15:8 set to all-ones. And bits #11:8 there are the BREAK control bits, active high, for serial lines #3:0 respectively.We could handle this with a preparatory change by calling:
dz_out(dport, DZ_TDR, ch & 0xffu);instead, but perhaps
->putchar' should simply takeunsigned char' or maybe even `u8' as its third argument?Quoted 13 lines
include/linux/serial_core.h +1
-1@@ -399,7 +399,7 @@ int uart_set_options(struct uart_port *port, struct console *co, int baud, struct tty_driver *uart_console_device(struct console *co, int *index);void uart_console_write (struct uart_port *port,const char *s,unsigned int count, -void (*putchar)(struct uart_port *,int )); +void (*putchar)(struct uart_port *,char ));/* Quoted 1 line
* Port/driver registration/removal
I.e.:
void (*putchar)(struct uart_port *, unsigned char));I can see we get it right already with:
unsigned char x_char; /* xon/xoff char */and for `dz_transmit_chars' we have:
unsigned char tmp; [...] tmp = xmit->buf[xmit->tail]; xmit->tail = (xmit->tail + 1) & (DZ_XMIT_SIZE - 1); dz_out(dport, DZ_TDR, tmp);
Quoted 3 lines
(because `struct
circ_buf' is generic and not limited to unsigned buffer contents interpretation; it's not clear to me if that has been intended though).
Thanks, good point. I was considering unsigned char and concluded not go that path right now as the rest of the console world uses char -- starting from the printk code. OTOH the whole uart world uses 'unsigned char' except that circ_buf. But I am phasing circ_buf out in favor of kfifo+unsigned-char anyway.
So let me switch the whole uart (the console code in particular) to an unsigned world. Meaning printk will pass char, uart will receive it as unsigned char and will keep it unsigned in all cases.
thanks,
Signature · 2 lines
js suse labs
PATCH 11/11 serial: mcf: use helpers in mcf_tx_chars()
In reply to Jiri SlabyUse uart_circ_empty() instead of open-coding it via xmit->head & tail. Use preexisting mcf_stop_tx() to avoid stop-tx code duplication.
--- drivers/tty/serial/mcf.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/tty/serial/mcf.c +3 -4
@@ -338,7 +338,7 @@ static void mcf_tx_chars(struct mcf_uart *pp) }while (readb (port->membase +MCFUART_USR ) &MCFUART_USR_TXREADY ) { -if (xmit->head == xmit->tail) +if (uart_circ_empty (xmit))break ;writeb (xmit->buf[xmit->tail], port->membase +MCFUART_UTB ); xmit->tail = (xmit->tail +1 ) & (UART_XMIT_SIZE -1 );
@@ -348,9 +348,8 @@ static void mcf_tx_chars(struct mcf_uart *pp)if (uart_circ_chars_pending (xmit) <WAKEUP_CHARS )uart_write_wakeup (port); -if (xmit->head == xmit->tail) { - pp->imr &= ~MCFUART_UIR_TXREADY ; -writeb (pp->imr, port->membase +MCFUART_UIMR ); +if (uart_circ_empty (xmit)) { +mcf_stop_tx (port);/* Disable TX to negate RTS automatically */ if (port->rs485.flags &SER_RS485_ENABLED ) writeb(MCFUART_UCR_TXDISABLE,
Signature · 1 line
2.34.1