From nobody Tue Jun 30 06:33:12 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 851DFC433EF for ; Mon, 24 Jan 2022 07:14:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241715AbiAXHOf (ORCPT ); Mon, 24 Jan 2022 02:14:35 -0500 Received: from smtp-out2.suse.de ([195.135.220.29]:58038 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230390AbiAXHOd (ORCPT ); Mon, 24 Jan 2022 02:14:33 -0500 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id E00FA1F38F; Mon, 24 Jan 2022 07:14:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1643008471; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MSk7hKrcCNXUhWO61RD0aeiO4YU6KlDqpYa7y+nvyoo=; b=wWaXyPQapUwKn6BQoIJ4MZnU9W7o6063JvCs15lx84B/6ttYsyS9ricCi0RlNEQkWlIVxd SatQM91YlIM4B/iB2PepbmuD1CKvoYpnEmsB9XBNYtnKgYyQ6+USQaz7ijv1ymdQAkhS/W IgKjPpz/V+7GMfHrajh/fp0GL6bdZYg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1643008471; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MSk7hKrcCNXUhWO61RD0aeiO4YU6KlDqpYa7y+nvyoo=; b=0RW8RAtCfXpHVnJwz5czHIc6b7WZxaPLSv1cYOHKlLBesoXpwWZRVX1bSKcrrftChz8glH J2tFBKNy282zfcAw== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id A62D1A3B81; Mon, 24 Jan 2022 07:14:31 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, johan@kernel.org, Jiri Slaby Subject: [PATCH 01/11] serial: core: clean up EXPORT_SYMBOLs Date: Mon, 24 Jan 2022 08:14:20 +0100 Message-Id: <20220124071430.14907-2-jslaby@suse.cz> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124071430.14907-1-jslaby@suse.cz> References: <20220124071430.14907-1-jslaby@suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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. Signed-off-by: Jiri Slaby --- drivers/tty/serial/serial_core.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_c= ore.c index dc40c4155356..1f6df577c75b 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -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); =20 static void uart_stop(struct tty_struct *tty) { @@ -351,7 +352,6 @@ uart_update_timeout(struct uart_port *port, unsigned in= t cflag, */ port->timeout =3D (HZ * size) / baud + HZ/50; } - EXPORT_SYMBOL(uart_update_timeout); =20 /** @@ -453,7 +453,6 @@ uart_get_baud_rate(struct uart_port *port, struct kterm= ios *termios, WARN_ON(1); return 0; } - EXPORT_SYMBOL(uart_get_baud_rate); =20 /** @@ -478,7 +477,6 @@ uart_get_divisor(struct uart_port *port, unsigned int b= aud) =20 return quot; } - EXPORT_SYMBOL(uart_get_divisor); =20 /* Caller holds port mutex */ @@ -2220,6 +2218,7 @@ int uart_suspend_port(struct uart_driver *drv, struct= uart_port *uport) =20 return 0; } +EXPORT_SYMBOL(uart_suspend_port); =20 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) =20 return 0; } +EXPORT_SYMBOL(uart_resume_port); =20 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); =20 /** * 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 =3D NULL; drv->tty_driver =3D NULL; } +EXPORT_SYMBOL(uart_unregister_driver); =20 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) =20 return ret; } +EXPORT_SYMBOL(uart_add_one_port); =20 /** * uart_remove_one_port - detach a driver defined port structure @@ -3036,6 +3039,7 @@ int uart_remove_one_port(struct uart_driver *drv, str= uct uart_port *uport) =20 return ret; } +EXPORT_SYMBOL(uart_remove_one_port); =20 /* * Are the two ports equivalent? @@ -3212,14 +3216,6 @@ bool uart_try_toggle_sysrq(struct uart_port *port, u= nsigned int ch) EXPORT_SYMBOL_GPL(uart_try_toggle_sysrq); #endif =20 -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 --=20 2.34.1 From nobody Tue Jun 30 06:33:12 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9DC5C433EF for ; Mon, 24 Jan 2022 07:16:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241737AbiAXHQj (ORCPT ); Mon, 24 Jan 2022 02:16:39 -0500 Received: from smtp-out2.suse.de ([195.135.220.29]:58050 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232267AbiAXHOd (ORCPT ); Mon, 24 Jan 2022 02:14:33 -0500 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 87C851F3A0; Mon, 24 Jan 2022 07:14:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1643008472; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6+J5pYRJpicKY3hxUjqS2LyMm6N9PtKdlkpBO1kMAA0=; b=Bq36DpPCsDV3lc13PK+mNj4UGH7zACOLCz7Mxd/a11pjDKxPMXLJ50cxQbTdg8SQjb45TN IJkPiSY03jP9s7PfjvaFltMPmIEPWjqKjiI9xioHHrcGLVCXMxPcNDTI6/X3XJam4xtreK HXX7WQBa/ZH2lyG4petofXDJoq6MvHA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1643008472; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6+J5pYRJpicKY3hxUjqS2LyMm6N9PtKdlkpBO1kMAA0=; b=uxvSuvG6mfBfN0cRYTOdIdYcb2UofHC3Tb/8P9eKOeKYtZnQKp1LExO1MQdctskpkZpKjY 0f8udhq20mZaPcCw== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 006EEA3B84; Mon, 24 Jan 2022 07:14:31 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, johan@kernel.org, Jiri Slaby , Richard Genoud , Nicolas Ferre , Alexandre Belloni , Ludovic Desroches Subject: [PATCH 02/11] serial: atmel_serial: include circ_buf.h Date: Mon, 24 Jan 2022 08:14:21 +0100 Message-Id: <20220124071430.14907-3-jslaby@suse.cz> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124071430.14907-1-jslaby@suse.cz> References: <20220124071430.14907-1-jslaby@suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" atmel_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. Signed-off-by:Jiri Slaby Cc: Richard Genoud Cc: Nicolas Ferre Cc: Alexandre Belloni Cc: Ludovic Desroches Acked-by: Richard Genoud --- drivers/tty/serial/atmel_serial.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_s= erial.c index c370eddc651b..2d09a89974a2 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c @@ -8,6 +8,7 @@ * * DMA support added by Chip Coldwell. */ +#include #include #include #include --=20 2.34.1 From nobody Tue Jun 30 06:33:12 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9074C433EF for ; Mon, 24 Jan 2022 07:14:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241850AbiAXHOw (ORCPT ); Mon, 24 Jan 2022 02:14:52 -0500 Received: from smtp-out2.suse.de ([195.135.220.29]:58064 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235952AbiAXHOe (ORCPT ); Mon, 24 Jan 2022 02:14:34 -0500 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id D24F71F3A5; Mon, 24 Jan 2022 07:14:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1643008472; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=g2jHGQhYb1bp/hVAQP7G6GbfFvC58/zmtrgJPJDZ7Y0=; b=RRRuWmCgWoOTrdrqZd5V23PAlIts8VKuOmWrvd1JiSj6I3IpibVyDF2dbsnoViKGI4q0TY xTq5clbe15lqSUJtdZaHJMvfWR3aOq3H1seaKzaiqozQCD80I6572s/CX83Y9X1pM5kjcD ja2ViHsMsiAXPsI1TtQ3TS0UI4tHVoE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1643008472; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=g2jHGQhYb1bp/hVAQP7G6GbfFvC58/zmtrgJPJDZ7Y0=; b=vJCiy5y8/EVbh2YC6pvUlVTbyjvkTZJJ9zVCDb8U6QXFlB2jFbTV+liJelTzlwP/Nxdw39 uRHhSZub2aXjRGAA== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 9AC33A3B81; Mon, 24 Jan 2022 07:14:32 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, johan@kernel.org, Jiri Slaby Subject: [PATCH 03/11] tty: add kfifo to tty_port Date: Mon, 24 Jan 2022 08:14:22 +0100 Message-Id: <20220124071430.14907-4-jslaby@suse.cz> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124071430.14907-1-jslaby@suse.cz> References: <20220124071430.14907-1-jslaby@suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Define 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. Signed-off-by: Jiri Slaby --- drivers/tty/tty_port.c | 6 +++++- include/linux/tty_port.h | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c index 7709ce655f44..7644834640f1 100644 --- a/drivers/tty/tty_port.c +++ b/drivers/tty/tty_port.c @@ -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 =3D=3D NULL) + if (port->xmit_buf =3D=3D NULL) { port->xmit_buf =3D (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 =3D=3D NULL) return -ENOMEM; @@ -240,6 +243,7 @@ void tty_port_free_xmit_buf(struct tty_port *port) if (port->xmit_buf !=3D NULL) { free_page((unsigned long)port->xmit_buf); port->xmit_buf =3D NULL; + INIT_KFIFO(port->xmit_fifo); } mutex_unlock(&port->buf_mutex); } diff --git a/include/linux/tty_port.h b/include/linux/tty_port.h index d3ea9ed0b98e..58e9619116b7 100644 --- a/include/linux/tty_port.h +++ b/include/linux/tty_port.h @@ -2,6 +2,7 @@ #ifndef _LINUX_TTY_PORT_H #define _LINUX_TTY_PORT_H =20 +#include #include #include #include @@ -67,6 +68,7 @@ extern const struct tty_port_client_operations tty_port_d= efault_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 se= t 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; --=20 2.34.1 From nobody Tue Jun 30 06:33:12 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB0A0C433FE for ; Mon, 24 Jan 2022 07:14:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241773AbiAXHOk (ORCPT ); Mon, 24 Jan 2022 02:14:40 -0500 Received: from smtp-out2.suse.de ([195.135.220.29]:58072 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235995AbiAXHOe (ORCPT ); Mon, 24 Jan 2022 02:14:34 -0500 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 30C231F3B1; Mon, 24 Jan 2022 07:14:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1643008473; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NuFLtxRTZL+pX7slRT+76aLI4pj2eN835rL2gxEVyNc=; b=1vuZeHBxeugR58gp3v3yE6fTC0JJS7f5aj7+jm7YwtHitujDJ77QYawVEPNlDpGLpQEvu3 iF6pnKt9MKEHhnWOgsW8oNzVpJ8nsbYbcGK849hgZIJ6YFXzmoH3lCqIyk19yqPxcd6F35 2YFl7ZzVjgsU+VzqzAJR7qopDNA75Jk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1643008473; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NuFLtxRTZL+pX7slRT+76aLI4pj2eN835rL2gxEVyNc=; b=5UaXFxKv1tZhQGFjZkseNB3psORNFKkNSpekwvopYFk5NZoxHbuhhjS76zVN+sDuLILq8+ vuqx+8OaaQH/sOCg== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id E5A6FA3B84; Mon, 24 Jan 2022 07:14:32 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, johan@kernel.org, Jiri Slaby Subject: [PATCH 04/11] tty: tty_port_open, document shutdown vs failed activate Date: Mon, 24 Jan 2022 08:14:23 +0100 Message-Id: <20220124071430.14907-5-jslaby@suse.cz> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124071430.14907-1-jslaby@suse.cz> References: <20220124071430.14907-1-jslaby@suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add a note that ->shutdown is not called when ->activate fails. Just so we are clear. Signed-off-by: Jiri Slaby --- drivers/tty/tty_port.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c index 7644834640f1..4282895ede9e 100644 --- a/drivers/tty/tty_port.c +++ b/drivers/tty/tty_port.c @@ -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 --=20 2.34.1 From nobody Tue Jun 30 06:33:12 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1CD8DC433EF for ; Mon, 24 Jan 2022 07:16:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241725AbiAXHQl (ORCPT ); Mon, 24 Jan 2022 02:16:41 -0500 Received: from smtp-out1.suse.de ([195.135.220.28]:41092 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241520AbiAXHOe (ORCPT ); Mon, 24 Jan 2022 02:14:34 -0500 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 79AE3210FA; Mon, 24 Jan 2022 07:14:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1643008473; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Mf6nIP41/uJ9yepSpLj+gZVMmwKjnorJahuQqH8Cd5Q=; b=sVeWmLG3S4A/3K25MUljMW2v9qlS+T/9AAoT0pP1h0Flzo+dXdEtlBV0rTrLvyCoPbHI0t 7PC2Duuy454TvkOiTsXWyTpVYhMj56l8x27PVk1ZJxpHGPCwhcsZwXT1I+rheLWXaH9Tuh 8C0N6CO+3ggN1APxo6UBnH5xlpejmEg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1643008473; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Mf6nIP41/uJ9yepSpLj+gZVMmwKjnorJahuQqH8Cd5Q=; b=mrooSUMtcZsTOm0HhfY6iDMd1s9uuzuj6X5HYHJh7eK/LEF7wUyvR0z+h968zHs+v8BhIs xk+q084pOqLfz4Bg== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 443AAA3B81; Mon, 24 Jan 2022 07:14:33 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, johan@kernel.org, Jiri Slaby Subject: [PATCH 05/11] mxser: fix xmit_buf leak in activate when LSR == 0xff Date: Mon, 24 Jan 2022 08:14:24 +0100 Message-Id: <20220124071430.14907-6-jslaby@suse.cz> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124071430.14907-1-jslaby@suse.cz> References: <20220124071430.14907-1-jslaby@suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" When 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. Fixes: 6769140d3047 ("tty: mxser: use the tty_port_open method") Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index c858aff721c4..fbb796f83753 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -744,6 +744,7 @@ static int mxser_activate(struct tty_port *port, struct= tty_struct *tty) struct mxser_port *info =3D container_of(port, struct mxser_port, port); unsigned long page; unsigned long flags; + int ret; =20 page =3D __get_free_page(GFP_KERNEL); if (!page) @@ -753,9 +754,9 @@ static int mxser_activate(struct tty_port *port, struct= tty_struct *tty) =20 if (!info->type) { set_bit(TTY_IO_ERROR, &tty->flags); - free_page(page); spin_unlock_irqrestore(&info->slock, flags); - return 0; + ret =3D 0; + goto err_free_xmit; } info->port.xmit_buf =3D (unsigned char *) page; =20 @@ -775,8 +776,10 @@ static int mxser_activate(struct tty_port *port, struc= t tty_struct *tty) if (capable(CAP_SYS_ADMIN)) { set_bit(TTY_IO_ERROR, &tty->flags); return 0; - } else - return -ENODEV; + } + + ret =3D -ENODEV; + goto err_free_xmit; } =20 /* @@ -821,6 +824,10 @@ static int mxser_activate(struct tty_port *port, struc= t tty_struct *tty) spin_unlock_irqrestore(&info->slock, flags); =20 return 0; +err_free_xmit: + free_page(page); + info->port.xmit_buf =3D NULL; + return ret; } =20 /* --=20 2.34.1 From nobody Tue Jun 30 06:33:12 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8294C433EF for ; Mon, 24 Jan 2022 07:14:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241791AbiAXHOt (ORCPT ); Mon, 24 Jan 2022 02:14:49 -0500 Received: from smtp-out2.suse.de ([195.135.220.29]:58082 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241696AbiAXHOe (ORCPT ); Mon, 24 Jan 2022 02:14:34 -0500 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id C583C1F3B6; Mon, 24 Jan 2022 07:14:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1643008473; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=L9a5B5RGVmJ6PZ7we55uVKingQ30djeTUqYcDv5kgvY=; b=0sjKwF5c8FiS2KpPZTRL9Si8lqNFI5zSHu6Z24Mw/l75IrqwfVJqmIhzDTPbN4v327hKtw R8BG1X4P3b3dwUP6huhppJTAJXQL404gKteW5Day/nOWR4zEbAzjpYStr4CzsSxoaDJc3M 4owRPASDfA+SAOaIW56YIEXTllVujvo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1643008473; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=L9a5B5RGVmJ6PZ7we55uVKingQ30djeTUqYcDv5kgvY=; b=LgXxeYj1hXPl+LT5X5nZ0LRWQujhs/Y6iHgB2TtHYl4C4nGGvjajDVXjOZOCkbOhW68XJw q01kz5BNuBWoqEAg== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 90E84A3B84; Mon, 24 Jan 2022 07:14:33 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, johan@kernel.org, Jiri Slaby Subject: [PATCH 06/11] mxser: use tty_port xmit_buf helpers Date: Mon, 24 Jan 2022 08:14:25 +0100 Message-Id: <20220124071430.14907-7-jslaby@suse.cz> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124071430.14907-1-jslaby@suse.cz> References: <20220124071430.14907-1-jslaby@suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" For 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. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index fbb796f83753..4ddc12a63666 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -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 =3D container_of(port, struct mxser_port, port); - unsigned long page; unsigned long flags; int ret; =20 - page =3D __get_free_page(GFP_KERNEL); - if (!page) - return -ENOMEM; + ret =3D tty_port_alloc_xmit_buf(port); + if (ret < 0) + return ret; =20 spin_lock_irqsave(&info->slock, flags); =20 @@ -758,7 +757,6 @@ static int mxser_activate(struct tty_port *port, struct= tty_struct *tty) ret =3D 0; goto err_free_xmit; } - info->port.xmit_buf =3D (unsigned char *) page; =20 /* * Clear the FIFO buffers and disable them @@ -825,8 +823,7 @@ static int mxser_activate(struct tty_port *port, struct= tty_struct *tty) =20 return 0; err_free_xmit: - free_page(page); - info->port.xmit_buf =3D NULL; + tty_port_free_xmit_buf(port); return ret; } =20 @@ -862,14 +859,6 @@ static void mxser_shutdown_port(struct tty_port *port) */ wake_up_interruptible(&info->port.delta_msr_wait); =20 - /* - * Free the xmit buffer, if necessary - */ - if (info->port.xmit_buf) { - free_page((unsigned long) info->port.xmit_buf); - info->port.xmit_buf =3D NULL; - } - info->IER =3D 0; outb(0x00, info->ioaddr + UART_IER); =20 @@ -884,6 +873,11 @@ static void mxser_shutdown_port(struct tty_port *port) mxser_must_no_sw_flow_control(info->ioaddr); =20 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); } =20 /* --=20 2.34.1 From nobody Tue Jun 30 06:33:12 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3867C4332F for ; Mon, 24 Jan 2022 07:16:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241716AbiAXHQg (ORCPT ); Mon, 24 Jan 2022 02:16:36 -0500 Received: from smtp-out2.suse.de ([195.135.220.29]:58092 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233178AbiAXHOf (ORCPT ); Mon, 24 Jan 2022 02:14:35 -0500 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 280871F3B8; Mon, 24 Jan 2022 07:14:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1643008474; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vqmPmdOQqxIy+RmLUMMFIm6zUExbIA52ZsUr3TrP9ZY=; b=H0O9WYGBqfQX1AO6Gwvu+U3X4yE18KTuJCiy22/yPBfsC6JXHHGvQqyxay/PQtxQc0/Pj7 bEmt0fapGm31hmJ9Ru4pu0zELNu0vdF8B3chmK2XIQY7+UI4SKhulBaMpmU53hCjqJEerg qNlljR1cDrWxG+Qml6wGKS7Ax1rhvBI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1643008474; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vqmPmdOQqxIy+RmLUMMFIm6zUExbIA52ZsUr3TrP9ZY=; b=MAJA+/wdDjO3kqC+GJYOv8tOLkV0tgUacI9zMEFX9krugYcEAv2TcJbBlY9wK5V07lf8PB m1Fbg6ZhjLfxTtCA== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id D9C9BA3B81; Mon, 24 Jan 2022 07:14:33 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, johan@kernel.org, Jiri Slaby Subject: [PATCH 07/11] mxser: switch from xmit_buf to kfifo Date: Mon, 24 Jan 2022 08:14:26 +0100 Message-Id: <20220124071430.14907-8-jslaby@suse.cz> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124071430.14907-1-jslaby@suse.cz> References: <20220124071430.14907-1-jslaby@suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use 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. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 74 +++++++++++++++++---------------------------- 1 file changed, 27 insertions(+), 47 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 4ddc12a63666..836c9eca2946 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -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; =20 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); =20 clear_bit(TTY_IO_ERROR, &tty->flags); - info->xmit_cnt =3D info->xmit_head =3D info->xmit_tail =3D 0; + kfifo_reset(&port->xmit_fifo); =20 /* * 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 =3D tty->driver_data; unsigned long flags; =20 - spin_lock_irqsave(&info->slock, flags); - info->xmit_cnt =3D info->xmit_head =3D info->xmit_tail =3D 0; + kfifo_reset(&info->port.xmit_fifo); =20 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, struc= t file *filp) =20 static int mxser_write(struct tty_struct *tty, const unsigned char *buf, i= nt count) { - int c, total =3D 0; struct mxser_port *info =3D tty->driver_data; unsigned long flags; + int written; + bool is_empty; =20 - while (1) { - c =3D min_t(int, count, min(SERIAL_XMIT_SIZE - info->xmit_cnt - 1, - SERIAL_XMIT_SIZE - info->xmit_head)); - if (c <=3D 0) - break; - - memcpy(info->port.xmit_buf + info->xmit_head, buf, c); - spin_lock_irqsave(&info->slock, flags); - info->xmit_head =3D (info->xmit_head + c) & - (SERIAL_XMIT_SIZE - 1); - info->xmit_cnt +=3D c; - spin_unlock_irqrestore(&info->slock, flags); - - buf +=3D c; - count -=3D c; - total +=3D c; - } + spin_lock_irqsave(&info->slock, flags); + written =3D kfifo_in(&info->port.xmit_fifo, buf, count); + is_empty =3D kfifo_is_empty(&info->port.xmit_fifo); + spin_unlock_irqrestore(&info->slock, flags); =20 - 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); =20 - return total; + return written; } =20 static int mxser_put_char(struct tty_struct *tty, unsigned char ch) { struct mxser_port *info =3D tty->driver_data; unsigned long flags; - - if (info->xmit_cnt >=3D SERIAL_XMIT_SIZE - 1) - return 0; + int ret; =20 spin_lock_irqsave(&info->slock, flags); - info->port.xmit_buf[info->xmit_head++] =3D ch; - info->xmit_head &=3D SERIAL_XMIT_SIZE - 1; - info->xmit_cnt++; + ret =3D kfifo_put(&info->port.xmit_fifo, ch); spin_unlock_irqrestore(&info->slock, flags); =20 - return 1; + return ret; } =20 =20 @@ -971,7 +951,7 @@ static void mxser_flush_chars(struct tty_struct *tty) { struct mxser_port *info =3D tty->driver_data; =20 - 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; =20 @@ -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 =3D tty->driver_data; - int ret; =20 - ret =3D SERIAL_XMIT_SIZE - info->xmit_cnt - 1; - return ret < 0 ? 0 : ret; + return kfifo_avail(&info->port.xmit_fifo); } =20 static unsigned int mxser_chars_in_buffer(struct tty_struct *tty) { struct mxser_port *info =3D tty->driver_data; - return info->xmit_cnt; + + return kfifo_len(&info->port.xmit_fifo); } =20 /* @@ -1379,7 +1358,7 @@ static void mxser_start(struct tty_struct *tty) unsigned long flags; =20 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 *t= ty, struct mxser_port *port return; } =20 - 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 =20 count =3D port->xmit_fifo_size; do { - outb(port->port.xmit_buf[port->xmit_tail++], - port->ioaddr + UART_TX); - port->xmit_tail &=3D 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); =20 - if (port->xmit_cnt < WAKEUP_CHARS) + if (kfifo_len(&port->port.xmit_fifo) < WAKEUP_CHARS) tty_wakeup(tty); =20 - if (!port->xmit_cnt) + if (kfifo_is_empty(&port->port.xmit_fifo)) __mxser_stop_tx(port); } =20 --=20 2.34.1 From nobody Tue Jun 30 06:33:12 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58296C433EF for ; Mon, 24 Jan 2022 07:14:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235874AbiAXHOr (ORCPT ); Mon, 24 Jan 2022 02:14:47 -0500 Received: from smtp-out1.suse.de ([195.135.220.28]:41102 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241701AbiAXHOf (ORCPT ); Mon, 24 Jan 2022 02:14:35 -0500 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 73EBE21901; Mon, 24 Jan 2022 07:14:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1643008474; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5vn8IFil54kOIDOQHFgmEi8qAOxK9uV6kljLIOsoWtc=; b=J0IFt69csqkT1kd8ZxxlwMdo/JX/C//pAFWqEvYuxAi315j6Gmvatsk1gqLdFbz0IbR2Y0 fVMjfa9Dgk17JnEGc5rn5M10Qvuyimsd0Us70n0LYAEqcMsMTD4p8YFvchDXSzLLHjCANG ZUM0cIbyNHAPTxArlN9F9e3e02ke1oA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1643008474; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5vn8IFil54kOIDOQHFgmEi8qAOxK9uV6kljLIOsoWtc=; b=c0OO/LuhsXkJvJovtqOtjjFgSOrqApYIeKeQC2SGu/sT2OlGRqY/LQe1zFT5BKfL9FLyRs 6huaDl0VnWLr3lAQ== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 34A8AA3B84; Mon, 24 Jan 2022 07:14:34 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, johan@kernel.org, Jiri Slaby , Stefan-gabriel Mirea Subject: [PATCH 08/11] serial: fsl_linflexuart: deduplicate character sending Date: Mon, 24 Jan 2022 08:14:27 +0100 Message-Id: <20220124071430.14907-9-jslaby@suse.cz> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124071430.14907-1-jslaby@suse.cz> References: <20220124071430.14907-1-jslaby@suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Introduce a new linflex_put_char() helper to send a character. And use it on both places this code was duplicated. Signed-off-by: Jiri Slaby Cc: Stefan-gabriel Mirea --- drivers/tty/serial/fsl_linflexuart.c | 42 +++++++++++----------------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/drivers/tty/serial/fsl_linflexuart.c b/drivers/tty/serial/fsl_= linflexuart.c index 283757264608..81a04039b6c1 100644 --- a/drivers/tty/serial/fsl_linflexuart.c +++ b/drivers/tty/serial/fsl_linflexuart.c @@ -157,27 +157,29 @@ static void linflex_stop_rx(struct uart_port *port) writel(ier & ~LINFLEXD_LINIER_DRIE, port->membase + LINIER); } =20 -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 =3D &sport->state->xmit; - unsigned char c; unsigned long status; =20 - while (!uart_circ_empty(xmit)) { - c =3D xmit->buf[xmit->tail]; - writeb(c, sport->membase + BDRL); + writeb(c, sport->membase + BDRL); =20 - /* Waiting for data transmission completed. */ - while (((status =3D readl(sport->membase + UARTSR)) & - LINFLEXD_UARTSR_DTFTFF) !=3D - LINFLEXD_UARTSR_DTFTFF) - ; + /* Waiting for data transmission completed. */ + while (((status =3D readl(sport->membase + UARTSR)) & + LINFLEXD_UARTSR_DTFTFF) !=3D + LINFLEXD_UARTSR_DTFTFF) + ; + + writel(status | LINFLEXD_UARTSR_DTFTFF, sport->membase + UARTSR); +} =20 +static inline void linflex_transmit_buffer(struct uart_port *sport) +{ + struct circ_buf *xmit =3D &sport->state->xmit; + + while (!uart_circ_empty(xmit)) { + linflex_put_char(sport, xmit->buf[xmit->tail]); xmit->tail =3D (xmit->tail + 1) & (UART_XMIT_SIZE - 1); sport->icount.tx++; - - writel(status | LINFLEXD_UARTSR_DTFTFF, - sport->membase + UARTSR); } =20 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) @@ -201,21 +203,11 @@ static irqreturn_t linflex_txint(int irq, void *dev_i= d) struct uart_port *sport =3D dev_id; struct circ_buf *xmit =3D &sport->state->xmit; unsigned long flags; - unsigned long status; =20 spin_lock_irqsave(&sport->lock, flags); =20 if (sport->x_char) { - writeb(sport->x_char, sport->membase + BDRL); - - /* waiting for data transmission completed */ - while (((status =3D readl(sport->membase + UARTSR)) & - LINFLEXD_UARTSR_DTFTFF) !=3D LINFLEXD_UARTSR_DTFTFF) - ; - - writel(status | LINFLEXD_UARTSR_DTFTFF, - sport->membase + UARTSR); - + linflex_put_char(sport, sport->x_char); goto out; } =20 --=20 2.34.1 From nobody Tue Jun 30 06:33:12 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6830C433F5 for ; Mon, 24 Jan 2022 07:14:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241792AbiAXHOo (ORCPT ); Mon, 24 Jan 2022 02:14:44 -0500 Received: from smtp-out1.suse.de ([195.135.220.28]:41114 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241713AbiAXHOg (ORCPT ); Mon, 24 Jan 2022 02:14:36 -0500 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id CD5CE21902; Mon, 24 Jan 2022 07:14:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1643008474; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XV46mzSFv8kv8sW667zWAvqoI5/aaUPrjGx3ycspT9I=; b=LnArH9YVgLUePBhEZ7D2MpDGNGRl1mADe9cRNVwpNKaUsCebjqQnOYfKMj6CtqyyLyhc4S 203VydnMQIgnVj3DgvkzX8FZv0lJmhv+Ot1bSA2vzJkIv7GWKCaJuTgonOnMlvLaMU3MaF W1KZQpmHl9Y0bP/8ZfDMQnhMjb5TboU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1643008474; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XV46mzSFv8kv8sW667zWAvqoI5/aaUPrjGx3ycspT9I=; b=yQhwMBpYouWrHMRaskqFjlnJI9PsZ2Gr1nwaBjsxtM7MCcLssC2OmO+4l8naWrbPUgJsLR +63dkfvhOvussjCQ== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 86DB9A3B88; Mon, 24 Jan 2022 07:14:34 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, johan@kernel.org, Jiri Slaby , Stefan-gabriel Mirea Subject: [PATCH 09/11] serial: fsl_linflexuart: don't call uart_write_wakeup() twice Date: Mon, 24 Jan 2022 08:14:28 +0100 Message-Id: <20220124071430.14907-10-jslaby@suse.cz> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124071430.14907-1-jslaby@suse.cz> References: <20220124071430.14907-1-jslaby@suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" linflex_txint() calls linflex_transmit_buffer() which calls uart_write_wakeup(). So there is no point to repeat it in linflex_txint() again -- remove it. Signed-off-by: Jiri Slaby Cc: Stefan-gabriel Mirea --- drivers/tty/serial/fsl_linflexuart.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/tty/serial/fsl_linflexuart.c b/drivers/tty/serial/fsl_= linflexuart.c index 81a04039b6c1..e72cba085743 100644 --- a/drivers/tty/serial/fsl_linflexuart.c +++ b/drivers/tty/serial/fsl_linflexuart.c @@ -217,10 +217,6 @@ static irqreturn_t linflex_txint(int irq, void *dev_id) } =20 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; --=20 2.34.1 From nobody Tue Jun 30 06:33:12 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6862C433F5 for ; Mon, 24 Jan 2022 07:15:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241875AbiAXHO4 (ORCPT ); Mon, 24 Jan 2022 02:14:56 -0500 Received: from smtp-out1.suse.de ([195.135.220.28]:41186 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241770AbiAXHOl (ORCPT ); Mon, 24 Jan 2022 02:14:41 -0500 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id B979D21901; Mon, 24 Jan 2022 07:14:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1643008479; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XInksKZ/PHCh49uOtBkdX3ihu5qQlXEfU7MuiKltpQw=; b=x2PjdFExGg+xf+Xui7pCUr2WAc1pctqH4AeFEMSUBVs98yUGiV/XYW1m99nXwlq3B4eVWP zHWdb7n600eUZ3QAEJDCPfIhYCN82nTY5elTklYC/XHeBDzDySwXELzqrRJYmsq6/hMpr4 BayIVwP/x8VM+Xeqa/qpzF49GemZkEk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1643008479; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XInksKZ/PHCh49uOtBkdX3ihu5qQlXEfU7MuiKltpQw=; b=r4cewObGZTQW0Bu35bjO7JNIc22E7xc7812JRUY8fpMEa8+m5y8LWXuh0I1JLj+TBokg+3 Am+H82bVyYmbBHDA== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 069D7A3B84; Mon, 24 Jan 2022 07:14:34 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, johan@kernel.org, Jiri Slaby , Paul Cercueil , Tobias Klauser , Russell King , Vineet Gupta , Richard Genoud , Nicolas Ferre , Alexandre Belloni , Ludovic Desroches , Florian Fainelli , Alexander Shiyan , Baruch Siach , "Maciej W. Rozycki" , Paul Walmsley , Palmer Dabbelt , Albert Ou , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Karol Gugala , Mateusz Holenko , Vladimir Zapolskiy , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Taichi Sugaya , Takao Orito , Liviu Dudau , Sudeep Holla , Lorenzo Pieralisi , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Manivannan Sadhasivam , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Andy Gross , Bjorn Andersson , Krzysztof Kozlowski , Orson Zhai , Baolin Wang , Chunyan Zhang , Patrice Chotard , Maxime Coquelin , Alexandre Torgue , "David S. Miller" , Peter Korsgaard , Michal Simek Subject: [PATCH 10/11] serial: make uart_console_write->putchar()'s character a char Date: Mon, 24 Jan 2022 08:14:29 +0100 Message-Id: <20220124071430.14907-11-jslaby@suse.cz> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124071430.14907-1-jslaby@suse.cz> References: <20220124071430.14907-1-jslaby@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, uart_console_write->putchar's second parameter (the character) is of type int. It makes little sense, provided uart_console_wri= te() 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. Signed-off-by: Jiri Slaby Cc: Paul Cercueil Cc: Tobias Klauser Cc: Russell King Cc: Vineet Gupta Cc: Richard Genoud Cc: Nicolas Ferre Cc: Alexandre Belloni Cc: Ludovic Desroches Cc: Florian Fainelli Cc: Alexander Shiyan Cc: Baruch Siach Cc: "Maciej W. Rozycki" Cc: Paul Walmsley Cc: Palmer Dabbelt Cc: Albert Ou Cc: Shawn Guo Cc: Sascha Hauer Cc: Pengutronix Kernel Team Cc: Fabio Estevam Cc: NXP Linux Team Cc: Karol Gugala Cc: Mateusz Holenko Cc: Vladimir Zapolskiy Cc: Neil Armstrong Cc: Kevin Hilman Cc: Jerome Brunet Cc: Martin Blumenstingl Cc: Taichi Sugaya Cc: Takao Orito Cc: Liviu Dudau Cc: Sudeep Holla Cc: Lorenzo Pieralisi Cc: "Andreas F=C3=A4rber" Cc: Manivannan Sadhasivam Cc: Michael Ellerman Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Andy Gross Cc: Bjorn Andersson Cc: Krzysztof Kozlowski Cc: Orson Zhai Cc: Baolin Wang Cc: Chunyan Zhang Cc: Patrice Chotard Cc: Maxime Coquelin Cc: Alexandre Torgue Cc: "David S. Miller" Cc: Peter Korsgaard Cc: Michal Simek Acked-by: Richard Genoud Reported-by: kernel test robot --- 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(-) diff --git a/drivers/tty/goldfish.c b/drivers/tty/goldfish.c index 5ed19a9857ad..bf51559c0ad3 100644 --- a/drivers/tty/goldfish.c +++ b/drivers/tty/goldfish.c @@ -434,7 +434,7 @@ static int goldfish_tty_remove(struct platform_device *= pdev) } =20 #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); } diff --git a/drivers/tty/hvc/hvc_dcc.c b/drivers/tty/hvc/hvc_dcc.c index 8e0edb7d93fd..5fa5e3144011 100644 --- a/drivers/tty/hvc/hvc_dcc.c +++ b/drivers/tty/hvc/hvc_dcc.c @@ -15,7 +15,7 @@ #define DCC_STATUS_RX (1 << 30) #define DCC_STATUS_TX (1 << 29) =20 -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(); diff --git a/drivers/tty/serial/21285.c b/drivers/tty/serial/21285.c index 09baef4ccc39..2d32b151191f 100644 --- a/drivers/tty/serial/21285.c +++ b/drivers/tty/serial/21285.c @@ -403,7 +403,7 @@ static void serial21285_setup_ports(void) } =20 #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(); diff --git a/drivers/tty/serial/8250/8250_early.c b/drivers/tty/serial/8250= /8250_early.c index c171ce6db691..4dedab072922 100644 --- a/drivers/tty/serial/8250/8250_early.c +++ b/drivers/tty/serial/8250/8250_early.c @@ -86,7 +86,7 @@ static void serial8250_early_out(struct uart_port *port, = int offset, int value) =20 #define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE) =20 -static void serial_putc(struct uart_port *port, int c) +static void serial_putc(struct uart_port *port, char c) { unsigned int status; =20 diff --git a/drivers/tty/serial/8250/8250_ingenic.c b/drivers/tty/serial/82= 50/8250_ingenic.c index 65402d05eff9..269c544113d3 100644 --- a/drivers/tty/serial/8250/8250_ingenic.c +++ b/drivers/tty/serial/8250/8250_ingenic.c @@ -52,7 +52,7 @@ static void early_out(struct uart_port *port, int offset,= uint8_t value) writel(value, port->membase + (offset << 2)); } =20 -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; =20 diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/= 8250_port.c index 2abb3de11a48..5becb36f40fc 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -3303,7 +3303,7 @@ EXPORT_SYMBOL_GPL(serial8250_set_defaults); =20 #ifdef CONFIG_SERIAL_8250_CONSOLE =20 -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 =3D up_to_u8250p(port); =20 diff --git a/drivers/tty/serial/altera_jtaguart.c b/drivers/tty/serial/alte= ra_jtaguart.c index 37bffe406b18..9b22ce8b69f5 100644 --- a/drivers/tty/serial/altera_jtaguart.c +++ b/drivers/tty/serial/altera_jtaguart.c @@ -298,7 +298,7 @@ static struct altera_jtaguart altera_jtaguart_ports[ALT= ERA_JTAGUART_MAXPORTS]; #if defined(CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE) =20 #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_po= rt *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; =20 diff --git a/drivers/tty/serial/altera_uart.c b/drivers/tty/serial/altera_u= art.c index 64a352b40197..243c30a7c700 100644 --- a/drivers/tty/serial/altera_uart.c +++ b/drivers/tty/serial/altera_uart.c @@ -438,7 +438,7 @@ static struct altera_uart altera_uart_ports[CONFIG_SERI= AL_ALTERA_UART_MAXPORTS]; =20 #if defined(CONFIG_SERIAL_ALTERA_UART_CONSOLE) =20 -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)) diff --git a/drivers/tty/serial/amba-pl010.c b/drivers/tty/serial/amba-pl01= 0.c index 47654073123d..5f6e50348cdd 100644 --- a/drivers/tty/serial/amba-pl010.c +++ b/drivers/tty/serial/amba-pl010.c @@ -556,7 +556,7 @@ static struct uart_amba_port *amba_ports[UART_NR]; =20 #ifdef CONFIG_SERIAL_AMBA_PL010_CONSOLE =20 -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 =3D container_of(port, struct uart_amba_port, port); diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl01= 1.c index 1f1df46242f9..ff94edbcd791 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -2264,7 +2264,7 @@ static struct uart_amba_port *amba_ports[UART_NR]; =20 #ifdef CONFIG_SERIAL_AMBA_PL011_CONSOLE =20 -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 =3D container_of(port, struct uart_amba_port, port); @@ -2480,7 +2480,7 @@ static struct console amba_console =3D { =20 #define AMBA_CONSOLE (&amba_console) =20 -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 *c= on, const char *s, unsigned uart_console_write(&dev->port, s, n, qdf2400_e44_putc); } =20 -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(); diff --git a/drivers/tty/serial/apbuart.c b/drivers/tty/serial/apbuart.c index d8c937bdf3f9..1dd08c1a7685 100644 --- a/drivers/tty/serial/apbuart.c +++ b/drivers/tty/serial/apbuart.c @@ -413,7 +413,7 @@ static void apbuart_flush_fifo(struct uart_port *port) =20 #ifdef CONFIG_SERIAL_GRLIB_GAISLER_APBUART_CONSOLE =20 -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 { diff --git a/drivers/tty/serial/ar933x_uart.c b/drivers/tty/serial/ar933x_u= art.c index 8cabe50c4a33..92dea51ff2ec 100644 --- a/drivers/tty/serial/ar933x_uart.c +++ b/drivers/tty/serial/ar933x_uart.c @@ -613,7 +613,7 @@ static void ar933x_uart_wait_xmitr(struct ar933x_uart_p= ort *up) } while ((status & AR933X_UART_DATA_TX_CSR) =3D=3D 0); } =20 -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 =3D container_of(port, struct ar933x_uart_port, port); diff --git a/drivers/tty/serial/arc_uart.c b/drivers/tty/serial/arc_uart.c index 596217d10d5c..e07950ed00b0 100644 --- a/drivers/tty/serial/arc_uart.c +++ b/drivers/tty/serial/arc_uart.c @@ -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); } =20 -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(); diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_s= erial.c index 2d09a89974a2..e86513227894 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c @@ -2541,7 +2541,7 @@ static int atmel_init_port(struct atmel_uart_port *at= mel_port, } =20 #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(); diff --git a/drivers/tty/serial/bcm63xx_uart.c b/drivers/tty/serial/bcm63xx= _uart.c index 6471a54b616b..50943281b599 100644 --- a/drivers/tty/serial/bcm63xx_uart.c +++ b/drivers/tty/serial/bcm63xx_uart.c @@ -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); diff --git a/drivers/tty/serial/clps711x.c b/drivers/tty/serial/clps711x.c index 95abc6faa3d5..36bc82ef7951 100644 --- a/drivers/tty/serial/clps711x.c +++ b/drivers/tty/serial/clps711x.c @@ -348,7 +348,7 @@ static const struct uart_ops uart_clps711x_ops =3D { }; =20 #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 =3D dev_get_drvdata(port->dev); u32 sysflg =3D 0; diff --git a/drivers/tty/serial/digicolor-usart.c b/drivers/tty/serial/digi= color-usart.c index 13ac36e2da4f..0641b1c6d1c3 100644 --- a/drivers/tty/serial/digicolor-usart.c +++ b/drivers/tty/serial/digicolor-usart.c @@ -381,7 +381,7 @@ static const struct uart_ops digicolor_uart_ops =3D { .request_port =3D digicolor_uart_request_port, }; =20 -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(); diff --git a/drivers/tty/serial/dz.c b/drivers/tty/serial/dz.c index e9edabc5a211..3493e201d67f 100644 --- a/drivers/tty/serial/dz.c +++ b/drivers/tty/serial/dz.c @@ -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 =3D to_dport(uport); unsigned long flags; diff --git a/drivers/tty/serial/earlycon-arm-semihost.c b/drivers/tty/seria= l/earlycon-arm-semihost.c index fa096c10b591..01d63aace0d9 100644 --- a/drivers/tty/serial/earlycon-arm-semihost.c +++ b/drivers/tty/serial/earlycon-arm-semihost.c @@ -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" diff --git a/drivers/tty/serial/earlycon-riscv-sbi.c b/drivers/tty/serial/e= arlycon-riscv-sbi.c index ce81523c3113..95dbd1a9a48e 100644 --- a/drivers/tty/serial/earlycon-riscv-sbi.c +++ b/drivers/tty/serial/earlycon-riscv-sbi.c @@ -10,7 +10,7 @@ #include #include =20 -static void sbi_putc(struct uart_port *port, int c) +static void sbi_putc(struct uart_port *port, char c) { sbi_console_putchar(c); } diff --git a/drivers/tty/serial/fsl_linflexuart.c b/drivers/tty/serial/fsl_= linflexuart.c index e72cba085743..cac2b33d2a66 100644 --- a/drivers/tty/serial/fsl_linflexuart.c +++ b/drivers/tty/serial/fsl_linflexuart.c @@ -553,7 +553,7 @@ static const struct uart_ops linflex_pops =3D { static struct uart_port *linflex_ports[UART_NR]; =20 #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; =20 @@ -578,7 +578,7 @@ static void linflex_console_putchar(struct uart_port *p= ort, int ch) } } =20 -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; diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuar= t.c index ce3e26144689..b65f9bea67d4 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -2327,13 +2327,13 @@ static const struct uart_ops lpuart32_pops =3D { static struct lpuart_port *lpuart_ports[UART_NR]; =20 #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); } =20 -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); diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index df8a0c8b8b29..8a5e99c54e5c 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -1958,7 +1958,7 @@ static const struct uart_ops imx_uart_pops =3D { static struct imx_port *imx_uart_ports[UART_NR]; =20 #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 =3D (struct imx_port *)port; =20 diff --git a/drivers/tty/serial/imx_earlycon.c b/drivers/tty/serial/imx_ear= lycon.c index 795606e1a22f..0da84092a063 100644 --- a/drivers/tty/serial/imx_earlycon.c +++ b/drivers/tty/serial/imx_earlycon.c @@ -16,7 +16,7 @@ #define UTS_TXFULL (1<<4) /* TxFIFO full */ #define IMX21_UTS 0xb4 /* UART Test Register on all other i.mx*/ =20 -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(); diff --git a/drivers/tty/serial/ip22zilog.c b/drivers/tty/serial/ip22zilog.c index f4dc5fe4ba92..be133ba61774 100644 --- a/drivers/tty/serial/ip22zilog.c +++ b/drivers/tty/serial/ip22zilog.c @@ -990,7 +990,7 @@ static struct zilog_layout * __init get_zs(int chip) #define ZS_PUT_CHAR_MAX_DELAY 2000 /* 10 ms */ =20 #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 =3D ZILOG_CHANNEL_FROM_PORT(port); int loops =3D ZS_PUT_CHAR_MAX_DELAY; diff --git a/drivers/tty/serial/lantiq.c b/drivers/tty/serial/lantiq.c index 3e324d3f0a6d..a33b73c49813 100644 --- a/drivers/tty/serial/lantiq.c +++ b/drivers/tty/serial/lantiq.c @@ -598,7 +598,7 @@ static const struct uart_ops lqasc_pops =3D { =20 #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; =20 diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c index 7f74bf7bdcff..76ae24199c7f 100644 --- a/drivers/tty/serial/liteuart.c +++ b/drivers/tty/serial/liteuart.c @@ -93,7 +93,7 @@ static void liteuart_timer(struct timer_list *t) mod_timer(&uart->timer, jiffies + uart_poll_timeout(port)); } =20 -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(); diff --git a/drivers/tty/serial/lpc32xx_hs.c b/drivers/tty/serial/lpc32xx_h= s.c index 07c4161eb4cc..1d09e27f727b 100644 --- a/drivers/tty/serial/lpc32xx_hs.c +++ b/drivers/tty/serial/lpc32xx_hs.c @@ -122,7 +122,7 @@ static void wait_for_xmit_ready(struct uart_port *port) } } =20 -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)); diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uar= t.c index 45e00d928253..ca0aab7bf1d0 100644 --- a/drivers/tty/serial/meson_uart.c +++ b/drivers/tty/serial/meson_uart.c @@ -513,7 +513,7 @@ static void meson_uart_enable_tx_engine(struct uart_por= t *port) writel(val, port->membase + AML_UART_CONTROL); } =20 -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; diff --git a/drivers/tty/serial/milbeaut_usio.c b/drivers/tty/serial/milbea= ut_usio.c index 8f2cab7f66ad..60f6529a001a 100644 --- a/drivers/tty/serial/milbeaut_usio.c +++ b/drivers/tty/serial/milbeaut_usio.c @@ -400,7 +400,7 @@ static const struct uart_ops mlb_usio_ops =3D { =20 #ifdef CONFIG_SERIAL_MILBEAUT_USIO_CONSOLE =20 -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(); diff --git a/drivers/tty/serial/mps2-uart.c b/drivers/tty/serial/mps2-uart.c index 587b42f754cb..8af28a73fb25 100644 --- a/drivers/tty/serial/mps2-uart.c +++ b/drivers/tty/serial/mps2-uart.c @@ -432,7 +432,7 @@ static const struct uart_ops mps2_uart_pops =3D { static DEFINE_IDR(ports_idr); =20 #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 =3D { =20 #define MPS2_SERIAL_CONSOLE (&mps2_uart_console) =20 -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(); diff --git a/drivers/tty/serial/mvebu-uart.c b/drivers/tty/serial/mvebu-uar= t.c index ab226da75f7b..924af67f73f5 100644 --- a/drivers/tty/serial/mvebu-uart.c +++ b/drivers/tty/serial/mvebu-uart.c @@ -598,7 +598,7 @@ static const struct uart_ops mvebu_uart_ops =3D { =20 #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; =20 @@ -659,7 +659,7 @@ static void wait_for_xmite(struct uart_port *port) (val & STAT_TX_EMP), 1, 10000); } =20 -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)); diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c index ac45f3386e97..29ccaa0031c8 100644 --- a/drivers/tty/serial/mxs-auart.c +++ b/drivers/tty/serial/mxs-auart.c @@ -1305,7 +1305,7 @@ static const struct uart_ops mxs_auart_ops =3D { static struct mxs_auart_port *auart_port[MXS_AUART_PORTS]; =20 #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 =3D to_auart_port(port); unsigned int to =3D 1000; diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-ser= ial.c index 0862941862c8..464e9b2a4064 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c @@ -1194,7 +1194,7 @@ static void omap_serial_early_out(struct uart_port *p= ort, int offset, writew(value, port->membase + offset); } =20 -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; =20 diff --git a/drivers/tty/serial/owl-uart.c b/drivers/tty/serial/owl-uart.c index 91f1eb0058d7..60eea8e471d8 100644 --- a/drivers/tty/serial/owl-uart.c +++ b/drivers/tty/serial/owl-uart.c @@ -516,7 +516,7 @@ static const struct uart_ops owl_uart_ops =3D { =20 #ifdef CONFIG_SERIAL_OWL_CONSOLE =20 -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; diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c index f0351e6f0ef6..97b76344288e 100644 --- a/drivers/tty/serial/pch_uart.c +++ b/drivers/tty/serial/pch_uart.c @@ -1600,7 +1600,7 @@ static const struct uart_ops pch_uart_ops =3D { =20 #ifdef CONFIG_SERIAL_PCH_UART_CONSOLE =20 -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 =3D container_of(port, struct eg20t_port, port); diff --git a/drivers/tty/serial/pic32_uart.c b/drivers/tty/serial/pic32_uar= t.c index 0a12fb11e698..c5dca0a19dbb 100644 --- a/drivers/tty/serial/pic32_uart.c +++ b/drivers/tty/serial/pic32_uart.c @@ -691,7 +691,7 @@ static const struct uart_ops pic32_uart_ops =3D { =20 #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 =3D to_pic32_sport(port); =20 diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilo= g.c index 5359236b32d6..555f94240098 100644 --- a/drivers/tty/serial/pmac_zilog.c +++ b/drivers/tty/serial/pmac_zilog.c @@ -1944,7 +1944,7 @@ static void __exit exit_pmz(void) =20 #ifdef CONFIG_SERIAL_PMACZILOG_CONSOLE =20 -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 =3D container_of(port, struct uart_pmac_port, port); diff --git a/drivers/tty/serial/pxa.c b/drivers/tty/serial/pxa.c index 30b099746a75..c92502abe6fb 100644 --- a/drivers/tty/serial/pxa.c +++ b/drivers/tty/serial/pxa.c @@ -619,7 +619,7 @@ static void wait_for_xmitr(struct uart_pxa_port *up) } } =20 -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 =3D (struct uart_pxa_port *)port; =20 diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qco= m_geni_serial.c index aedc38893e6c..38c2877881a4 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -397,7 +397,7 @@ static void qcom_geni_serial_poll_put_char(struct uart_= port *uport, #endif =20 #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 =3D uport->private_data; =20 diff --git a/drivers/tty/serial/rda-uart.c b/drivers/tty/serial/rda-uart.c index d550d8fa2fab..95af78d8140b 100644 --- a/drivers/tty/serial/rda-uart.c +++ b/drivers/tty/serial/rda-uart.c @@ -573,7 +573,7 @@ static const struct uart_ops rda_uart_ops =3D { =20 #ifdef CONFIG_SERIAL_RDA_CONSOLE =20 -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; diff --git a/drivers/tty/serial/sa1100.c b/drivers/tty/serial/sa1100.c index 697b6a002a16..bfd37745cc6e 100644 --- a/drivers/tty/serial/sa1100.c +++ b/drivers/tty/serial/sa1100.c @@ -695,7 +695,7 @@ void __init sa1100_register_uart(int idx, int port) =20 =20 #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 =3D container_of(port, struct sa1100_port, port); diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_= tty.c index d002a4e48ed9..6fef292d6e9c 100644 --- a/drivers/tty/serial/samsung_tty.c +++ b/drivers/tty/serial/samsung_tty.c @@ -2478,7 +2478,7 @@ static void s3c24xx_serial_put_poll_char(struct uart_= port *port, #endif /* CONFIG_CONSOLE_POLL */ =20 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 =3D rd_regl(port, S3C2410_UFCON); =20 @@ -2965,7 +2965,7 @@ static void samsung_early_busyuart_fifo(struct uart_p= ort *port) ; } =20 -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); diff --git a/drivers/tty/serial/sb1250-duart.c b/drivers/tty/serial/sb1250-= duart.c index 738df6d9c0d9..bb1913050796 100644 --- a/drivers/tty/serial/sb1250-duart.c +++ b/drivers/tty/serial/sb1250-duart.c @@ -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 =3D to_sport(uport); =20 diff --git a/drivers/tty/serial/sccnxp.c b/drivers/tty/serial/sccnxp.c index 10cc16a71f26..3ee2c942ac22 100644 --- a/drivers/tty/serial/sccnxp.c +++ b/drivers/tty/serial/sccnxp.c @@ -828,7 +828,7 @@ static const struct uart_ops sccnxp_ops =3D { }; =20 #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 =3D 100000; =20 diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_c= ore.c index 1f6df577c75b..33742d86a12e 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -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; =20 diff --git a/drivers/tty/serial/serial_txx9.c b/drivers/tty/serial/serial_t= xx9.c index aaca4fe38486..e1003fd280dd 100644 --- a/drivers/tty/serial/serial_txx9.c +++ b/drivers/tty/serial/serial_txx9.c @@ -879,7 +879,7 @@ static void __init serial_txx9_register_ports(struct ua= rt_driver *drv, =20 #ifdef CONFIG_SERIAL_TXX9_CONSOLE =20 -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 =3D to_uart_txx9_port(port); =20 diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index b610b27893a8..67846605713b 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -2957,7 +2957,7 @@ static void sci_cleanup_single(struct sci_port *port) =20 #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); } diff --git a/drivers/tty/serial/sifive.c b/drivers/tty/serial/sifive.c index b79900d0e91a..9f4923bc3afb 100644 --- a/drivers/tty/serial/sifive.c +++ b/drivers/tty/serial/sifive.c @@ -756,7 +756,7 @@ static void sifive_serial_poll_put_char(struct uart_por= t *port, */ =20 #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", =20 static struct sifive_serial_port *sifive_serial_console_ports[SIFIVE_SERIA= L_MAX_PORTS]; =20 -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 =3D port_to_sifive_serial_port(port); =20 diff --git a/drivers/tty/serial/sprd_serial.c b/drivers/tty/serial/sprd_ser= ial.c index 9a7ae6384edf..45cebfed0378 100644 --- a/drivers/tty/serial/sprd_serial.c +++ b/drivers/tty/serial/sprd_serial.c @@ -1058,7 +1058,7 @@ console_initcall(sprd_serial_console_init); #define SPRD_CONSOLE (&sprd_console) =20 /* 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 =3D SPRD_TIMEOUT; =20 diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c index 87e480cc8206..6418a7f4fdde 100644 --- a/drivers/tty/serial/st-asc.c +++ b/drivers/tty/serial/st-asc.c @@ -854,7 +854,7 @@ static int asc_serial_resume(struct device *dev) /*----------------------------------------------------------------------*/ =20 #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 =3D 1000000; =20 diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-us= art.c index 1f89ab0e49ac..7c7aace2418f 100644 --- a/drivers/tty/serial/stm32-usart.c +++ b/drivers/tty/serial/stm32-usart.c @@ -1629,7 +1629,7 @@ static int stm32_usart_serial_remove(struct platform_= device *pdev) } =20 #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 =3D to_stm32_port(port); const struct stm32_usart_offsets *ofs =3D &stm32_port->info->ofs; diff --git a/drivers/tty/serial/sunsu.c b/drivers/tty/serial/sunsu.c index 98b2f4fb9a99..029a98ead88c 100644 --- a/drivers/tty/serial/sunsu.c +++ b/drivers/tty/serial/sunsu.c @@ -1281,7 +1281,7 @@ static void wait_for_xmitr(struct uart_sunsu_port *up) } } =20 -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 =3D container_of(port, struct uart_sunsu_port, port); diff --git a/drivers/tty/serial/sunzilog.c b/drivers/tty/serial/sunzilog.c index b714b00d2dad..d070e42f1c37 100644 --- a/drivers/tty/serial/sunzilog.c +++ b/drivers/tty/serial/sunzilog.c @@ -100,7 +100,7 @@ struct uart_sunzilog_port { #endif }; =20 -static void sunzilog_putchar(struct uart_port *port, int ch); +static void sunzilog_putchar(struct uart_port *port, char ch); =20 #define ZILOG_CHANNEL_FROM_PORT(PORT) ((struct zilog_channel __iomem *)((P= ORT)->membase)) #define UART_ZILOG(PORT) ((struct uart_sunzilog_port *)(PORT)) @@ -1125,7 +1125,7 @@ static void sunzilog_free_tables(void) =20 #define ZS_PUT_CHAR_MAX_DELAY 2000 /* 10 ms */ =20 -static void __maybe_unused sunzilog_putchar(struct uart_port *port, int ch) +static void __maybe_unused sunzilog_putchar(struct uart_port *port, char c= h) { struct zilog_channel __iomem *channel =3D ZILOG_CHANNEL_FROM_PORT(port); int loops =3D ZS_PUT_CHAR_MAX_DELAY; diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c index e1fa52d31474..f1b342c1e2fb 100644 --- a/drivers/tty/serial/uartlite.c +++ b/drivers/tty/serial/uartlite.c @@ -482,7 +482,7 @@ static void ulite_console_wait_tx(struct uart_port *por= t) "timeout waiting for TX buffer empty\n"); } =20 -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 =3D { .data =3D &ulite_uart_driver, }; =20 -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. diff --git a/drivers/tty/serial/vr41xx_siu.c b/drivers/tty/serial/vr41xx_si= u.c index 647198b1e2b9..8029d2d8e6fb 100644 --- a/drivers/tty/serial/vr41xx_siu.c +++ b/drivers/tty/serial/vr41xx_siu.c @@ -743,7 +743,7 @@ static void wait_for_xmitr(struct uart_port *port) } } =20 -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); diff --git a/drivers/tty/serial/vt8500_serial.c b/drivers/tty/serial/vt8500= _serial.c index 9adfe3dc970f..375a6959439d 100644 --- a/drivers/tty/serial/vt8500_serial.c +++ b/drivers/tty/serial/vt8500_serial.c @@ -484,7 +484,7 @@ static void wait_for_xmitr(struct uart_port *port) } while (status & 0x10); } =20 -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); diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx= _uartps.c index d5e243908d9f..bdcd7dd743ef 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -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(); diff --git a/drivers/tty/serial/zs.c b/drivers/tty/serial/zs.c index 4b4f604646a7..d63aa07653ca 100644 --- a/drivers/tty/serial/zs.c +++ b/drivers/tty/serial/zs.c @@ -1124,7 +1124,7 @@ static int __init zs_probe_sccs(void) =20 =20 #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 =3D to_zport(uport); struct zs_scc *scc =3D zport->scc; diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index c58cc142d23f..68e62703eaa6 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -399,7 +399,7 @@ int uart_set_options(struct uart_port *port, struct con= sole *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)); =20 /* * Port/driver registration/removal --=20 2.34.1 From nobody Tue Jun 30 06:33:12 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96C80C433FE for ; Mon, 24 Jan 2022 07:15:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241881AbiAXHPD (ORCPT ); Mon, 24 Jan 2022 02:15:03 -0500 Received: from smtp-out1.suse.de ([195.135.220.28]:41176 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241769AbiAXHOl (ORCPT ); Mon, 24 Jan 2022 02:14:41 -0500 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 1910821902; Mon, 24 Jan 2022 07:14:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1643008480; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FRMgZ5FDBy6Zkj47m+UUogIIvf9qagcdtK0/L6BvNPA=; b=BtpSyL/z69pXszzVJdDm5iETX2Dd43UIy2dPNP8K7QvIRak2taUAFnz23cy2O1Jiqvr7Vq zil0nXOw0KWWM9FQMst4zn++bwQL+KjI7ZWdNMHZBPUdQBU12QgPCHwcHIRcM2WkEXSQwA 5/hovVM5WaQBUy0sxlIJK8KCXg0l+A0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1643008480; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FRMgZ5FDBy6Zkj47m+UUogIIvf9qagcdtK0/L6BvNPA=; b=+R4sp2+NfSpgTHzh5kh+TUg8nCcTaFu4fBkIOwCLvJ06/BNGATDp0j52dqCFL2jj2to1gA UnN+r9YDm+qW8+AA== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id CB112A3B85; Mon, 24 Jan 2022 07:14:39 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, johan@kernel.org, Jiri Slaby Subject: [PATCH 11/11] serial: mcf: use helpers in mcf_tx_chars() Date: Mon, 24 Jan 2022 08:14:30 +0100 Message-Id: <20220124071430.14907-12-jslaby@suse.cz> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124071430.14907-1-jslaby@suse.cz> References: <20220124071430.14907-1-jslaby@suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use uart_circ_empty() instead of open-coding it via xmit->head & tail. Use preexisting mcf_stop_tx() to avoid stop-tx code duplication. Signed-off-by: Jiri Slaby --- drivers/tty/serial/mcf.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/tty/serial/mcf.c b/drivers/tty/serial/mcf.c index c7cec7d03620..2aec62b5d6c4 100644 --- a/drivers/tty/serial/mcf.c +++ b/drivers/tty/serial/mcf.c @@ -338,7 +338,7 @@ static void mcf_tx_chars(struct mcf_uart *pp) } =20 while (readb(port->membase + MCFUART_USR) & MCFUART_USR_TXREADY) { - if (xmit->head =3D=3D xmit->tail) + if (uart_circ_empty(xmit)) break; writeb(xmit->buf[xmit->tail], port->membase + MCFUART_UTB); xmit->tail =3D (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); =20 - if (xmit->head =3D=3D xmit->tail) { - pp->imr &=3D ~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, --=20 2.34.1