From nobody Tue Jun 23 23:41:51 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 42218C433FE for ; Thu, 24 Feb 2022 11:10:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233873AbiBXLLR (ORCPT ); Thu, 24 Feb 2022 06:11:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232338AbiBXLLL (ORCPT ); Thu, 24 Feb 2022 06:11:11 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 998222819BA; Thu, 24 Feb 2022 03:10:30 -0800 (PST) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 5A34F1F44A; Thu, 24 Feb 2022 11:10:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1645701029; 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=sECtLV2Cqp23vI3UmmE7oa1AoO0Iz0arFPmxPufCiUQ=; b=vqe18UGda1pv8BPtiSiVnVAqI/pjx2cfzpzxsKbnLWQB28mkzXKfvHFaD2/zU+uIM7CWej 2BtC+iBnbwCFZ1B6TCYvFbFQG0Ed8AmftlVOQxq01UoMiJB7T1QTYU4UaS9GMMqgoCWxIX hYUFALWxR1ctt8UOdntpK0dXa6Xzcc4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1645701029; 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=sECtLV2Cqp23vI3UmmE7oa1AoO0Iz0arFPmxPufCiUQ=; b=WS81C5E/gpL3u78HHG15XxA320mODHgx8aWZtIW6GhfmjSfGn0Wy4r0p4bE9/kprwvLJeT Ts1djSzI0SuiN7Aw== 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 30FA8A3B94; Thu, 24 Feb 2022 11:10:29 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 1/5] tty: serial: mpc52xx_uart: make rx/tx hooks return unsigned Date: Thu, 24 Feb 2022 12:10:24 +0100 Message-Id: <20220224111028.20917-2-jslaby@suse.cz> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220224111028.20917-1-jslaby@suse.cz> References: <20220224111028.20917-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" All these return bitmasks, so it makes more sense to return unsigned -- this is what a reader and also all the callers expect. Signed-off-by: Jiri Slaby --- drivers/tty/serial/mpc52xx_uart.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/tty/serial/mpc52xx_uart.c b/drivers/tty/serial/mpc52xx= _uart.c index 2704dc988e4a..8a6958377764 100644 --- a/drivers/tty/serial/mpc52xx_uart.c +++ b/drivers/tty/serial/mpc52xx_uart.c @@ -83,11 +83,11 @@ static irqreturn_t mpc5xxx_uart_process_int(struct uart= _port *port); =20 struct psc_ops { void (*fifo_init)(struct uart_port *port); - int (*raw_rx_rdy)(struct uart_port *port); - int (*raw_tx_rdy)(struct uart_port *port); - int (*rx_rdy)(struct uart_port *port); - int (*tx_rdy)(struct uart_port *port); - int (*tx_empty)(struct uart_port *port); + unsigned int (*raw_rx_rdy)(struct uart_port *port); + unsigned int (*raw_tx_rdy)(struct uart_port *port); + unsigned int (*rx_rdy)(struct uart_port *port); + unsigned int (*tx_rdy)(struct uart_port *port); + unsigned int (*tx_empty)(struct uart_port *port); void (*stop_rx)(struct uart_port *port); void (*start_tx)(struct uart_port *port); void (*stop_tx)(struct uart_port *port); @@ -203,34 +203,34 @@ static void mpc52xx_psc_fifo_init(struct uart_port *p= ort) out_be16(&psc->mpc52xx_psc_imr, port->read_status_mask); } =20 -static int mpc52xx_psc_raw_rx_rdy(struct uart_port *port) +static unsigned int mpc52xx_psc_raw_rx_rdy(struct uart_port *port) { return in_be16(&PSC(port)->mpc52xx_psc_status) & MPC52xx_PSC_SR_RXRDY; } =20 -static int mpc52xx_psc_raw_tx_rdy(struct uart_port *port) +static unsigned int mpc52xx_psc_raw_tx_rdy(struct uart_port *port) { return in_be16(&PSC(port)->mpc52xx_psc_status) & MPC52xx_PSC_SR_TXRDY; } =20 =20 -static int mpc52xx_psc_rx_rdy(struct uart_port *port) +static unsigned int mpc52xx_psc_rx_rdy(struct uart_port *port) { return in_be16(&PSC(port)->mpc52xx_psc_isr) & port->read_status_mask & MPC52xx_PSC_IMR_RXRDY; } =20 -static int mpc52xx_psc_tx_rdy(struct uart_port *port) +static unsigned int mpc52xx_psc_tx_rdy(struct uart_port *port) { return in_be16(&PSC(port)->mpc52xx_psc_isr) & port->read_status_mask & MPC52xx_PSC_IMR_TXRDY; } =20 -static int mpc52xx_psc_tx_empty(struct uart_port *port) +static unsigned int mpc52xx_psc_tx_empty(struct uart_port *port) { u16 sts =3D in_be16(&PSC(port)->mpc52xx_psc_status); =20 @@ -1365,7 +1365,7 @@ static const struct uart_ops mpc52xx_uart_ops =3D { /* Interrupt handling = */ /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */ =20 -static inline int +static inline unsigned int mpc52xx_uart_int_rx_chars(struct uart_port *port) { struct tty_port *tport =3D &port->state->port; --=20 2.35.1 From nobody Tue Jun 23 23:41:51 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 89E4CC433EF for ; Thu, 24 Feb 2022 11:10:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233876AbiBXLLT (ORCPT ); Thu, 24 Feb 2022 06:11:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232173AbiBXLLL (ORCPT ); Thu, 24 Feb 2022 06:11:11 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDDEA29058E; Thu, 24 Feb 2022 03:10:30 -0800 (PST) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 9BBEE21155; Thu, 24 Feb 2022 11:10:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1645701029; 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=2fY/yN/W0QskE8CBmVPerF+fk3nGAkxO+KMLKAo8Lb4=; b=0TtzehgKM190j6/cuq81y9NOEK7nj3IQV5i9fyfKctrznNNWn7d27iZg+bLARMIxTts+hC 6jq16ATsF6SHLjjRFLMEbx/RRBwNm3QO8S4KQfcLwmQlP4tTzvHNYIQ13nEdA15AmI2VDQ t2k5gycx2gqG36AF2nzLXzz1TuDZU2I= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1645701029; 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=2fY/yN/W0QskE8CBmVPerF+fk3nGAkxO+KMLKAo8Lb4=; b=aCY9dLDAlgnN5fa4c8TX72lLH+4vik2RY1PxyfxHeT54gwXwdz6/thyMyB45ptw3GogEDx 8m2mKWccQxCTnlDg== 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 60827A3BAE; Thu, 24 Feb 2022 11:10:29 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 2/5] tty: serial: serial_txx9: remove info print from init Date: Thu, 24 Feb 2022 12:10:25 +0100 Message-Id: <20220224111028.20917-3-jslaby@suse.cz> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220224111028.20917-1-jslaby@suse.cz> References: <20220224111028.20917-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" Remove the hello print among with version and name definitions. Drivers should print nothing if they are successful. Signed-off-by: Jiri Slaby --- drivers/tty/serial/serial_txx9.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/tty/serial/serial_txx9.c b/drivers/tty/serial/serial_t= xx9.c index b4d8c2733317..a695e9c1a06a 100644 --- a/drivers/tty/serial/serial_txx9.c +++ b/drivers/tty/serial/serial_txx9.c @@ -26,9 +26,6 @@ =20 #include =20 -static char *serial_version =3D "1.11"; -static char *serial_name =3D "TX39/49 Serial driver"; - #define PASS_LIMIT 256 =20 #if !defined(CONFIG_SERIAL_TXX9_STDSERIAL) @@ -1255,8 +1252,6 @@ static int __init serial_txx9_init(void) { int ret; =20 - printk(KERN_INFO "%s version %s\n", serial_name, serial_version); - ret =3D uart_register_driver(&serial_txx9_reg); if (ret) goto out; --=20 2.35.1 From nobody Tue Jun 23 23:41:51 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 ABCC1C433EF for ; Thu, 24 Feb 2022 11:10:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233914AbiBXLL0 (ORCPT ); Thu, 24 Feb 2022 06:11:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233864AbiBXLLN (ORCPT ); Thu, 24 Feb 2022 06:11:13 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16A2B2905A0; Thu, 24 Feb 2022 03:10:31 -0800 (PST) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id C81B31F44C; Thu, 24 Feb 2022 11:10:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1645701029; 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=OvzTeJlP3W8b5BoFJdwE3MieXML45hdM/CnxrB5sgPs=; b=xi4gKeGHU72iz7QqkXa+8FCa2sIPek99jwXckQeHwXCgJ/phW1m6aA9uaZGSKpWThRWDIY s35y4an7Y0eB9oDz/R0gi2EA7FvCAaOomPv3lMOU17c1Zc7Vfl+vySEcnBTFVV0C5tbk9n 7nxamO3Iw3CbcmzJmUetTXVdSzs4r64= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1645701029; 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=OvzTeJlP3W8b5BoFJdwE3MieXML45hdM/CnxrB5sgPs=; b=LnNcmSapOZjjhsZx2EFtuYueaVK8XJoAbBBmNdE7wc2nGaTPW0RcMAXfkaTEanSBt+jTIh 8MxrFk4jBGVdSjBw== 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 9BE2DA3B9C; Thu, 24 Feb 2022 11:10:29 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 3/5] tty: serial: serial_txx9: remove struct uart_txx9_port Date: Thu, 24 Feb 2022 12:10:26 +0100 Message-Id: <20220224111028.20917-4-jslaby@suse.cz> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220224111028.20917-1-jslaby@suse.cz> References: <20220224111028.20917-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" It's only a wrapper to struct uart_port, so unwrap the whole code. No change in functionality is intended. Signed-off-by: Jiri Slaby --- drivers/tty/serial/serial_txx9.c | 364 ++++++++++++++----------------- 1 file changed, 167 insertions(+), 197 deletions(-) diff --git a/drivers/tty/serial/serial_txx9.c b/drivers/tty/serial/serial_t= xx9.c index a695e9c1a06a..2213e6b841d3 100644 --- a/drivers/tty/serial/serial_txx9.c +++ b/drivers/tty/serial/serial_txx9.c @@ -54,11 +54,6 @@ */ #define UART_NR CONFIG_SERIAL_TXX9_NR_UARTS =20 -struct uart_txx9_port { - struct uart_port port; - /* No additional info for now */ -}; - #define TXX9_REGION_SIZE 0x24 =20 /* TXX9 Serial Registers */ @@ -160,42 +155,42 @@ struct uart_txx9_port { #define TXX9_SIBGR_BCLK_T6 0x00000300 #define TXX9_SIBGR_BRD_MASK 0x000000ff =20 -static inline unsigned int sio_in(struct uart_txx9_port *up, int offset) +static inline unsigned int sio_in(struct uart_port *up, int offset) { - switch (up->port.iotype) { + switch (up->iotype) { default: - return __raw_readl(up->port.membase + offset); + return __raw_readl(up->membase + offset); case UPIO_PORT: - return inl(up->port.iobase + offset); + return inl(up->iobase + offset); } } =20 static inline void -sio_out(struct uart_txx9_port *up, int offset, int value) +sio_out(struct uart_port *up, int offset, int value) { - switch (up->port.iotype) { + switch (up->iotype) { default: - __raw_writel(value, up->port.membase + offset); + __raw_writel(value, up->membase + offset); break; case UPIO_PORT: - outl(value, up->port.iobase + offset); + outl(value, up->iobase + offset); break; } } =20 static inline void -sio_mask(struct uart_txx9_port *up, int offset, unsigned int value) +sio_mask(struct uart_port *up, int offset, unsigned int value) { sio_out(up, offset, sio_in(up, offset) & ~value); } static inline void -sio_set(struct uart_txx9_port *up, int offset, unsigned int value) +sio_set(struct uart_port *up, int offset, unsigned int value) { sio_out(up, offset, sio_in(up, offset) | value); } =20 static inline void -sio_quot_set(struct uart_txx9_port *up, int quot) +sio_quot_set(struct uart_port *up, int quot) { quot >>=3D 1; if (quot < 256) @@ -210,32 +205,23 @@ sio_quot_set(struct uart_txx9_port *up, int quot) sio_out(up, TXX9_SIBGR, 0xff | TXX9_SIBGR_BCLK_T6); } =20 -static struct uart_txx9_port *to_uart_txx9_port(struct uart_port *port) -{ - return container_of(port, struct uart_txx9_port, port); -} - -static void serial_txx9_stop_tx(struct uart_port *port) +static void serial_txx9_stop_tx(struct uart_port *up) { - struct uart_txx9_port *up =3D to_uart_txx9_port(port); sio_mask(up, TXX9_SIDICR, TXX9_SIDICR_TIE); } =20 -static void serial_txx9_start_tx(struct uart_port *port) +static void serial_txx9_start_tx(struct uart_port *up) { - struct uart_txx9_port *up =3D to_uart_txx9_port(port); sio_set(up, TXX9_SIDICR, TXX9_SIDICR_TIE); } =20 -static void serial_txx9_stop_rx(struct uart_port *port) +static void serial_txx9_stop_rx(struct uart_port *up) { - struct uart_txx9_port *up =3D to_uart_txx9_port(port); - up->port.read_status_mask &=3D ~TXX9_SIDISR_RDIS; + up->read_status_mask &=3D ~TXX9_SIDISR_RDIS; } =20 -static void serial_txx9_initialize(struct uart_port *port) +static void serial_txx9_initialize(struct uart_port *up) { - struct uart_txx9_port *up =3D to_uart_txx9_port(port); unsigned int tmout =3D 10000; =20 sio_out(up, TXX9_SIFCR, TXX9_SIFCR_SWRST); @@ -250,15 +236,15 @@ static void serial_txx9_initialize(struct uart_port *= port) /* initial settings */ sio_out(up, TXX9_SILCR, TXX9_SILCR_UMODE_8BIT | TXX9_SILCR_USBL_1BIT | - ((up->port.flags & UPF_TXX9_USE_SCLK) ? + ((up->flags & UPF_TXX9_USE_SCLK) ? TXX9_SILCR_SCS_SCLK_BG : TXX9_SILCR_SCS_IMCLK_BG)); - sio_quot_set(up, uart_get_divisor(port, 9600)); + sio_quot_set(up, uart_get_divisor(up, 9600)); sio_out(up, TXX9_SIFLCR, TXX9_SIFLCR_RTSTL_MAX /* 15 */); sio_out(up, TXX9_SIDICR, 0); } =20 static inline void -receive_chars(struct uart_txx9_port *up, unsigned int *status) +receive_chars(struct uart_port *up, unsigned int *status) { unsigned char ch; unsigned int disr =3D *status; @@ -269,11 +255,11 @@ receive_chars(struct uart_txx9_port *up, unsigned int= *status) do { ch =3D sio_in(up, TXX9_SIRFIFO); flag =3D TTY_NORMAL; - up->port.icount.rx++; + up->icount.rx++; =20 /* mask out RFDN_MASK bit added by previous overrun */ next_ignore_status_mask =3D - up->port.ignore_status_mask & ~TXX9_SIDISR_RFDN_MASK; + up->ignore_status_mask & ~TXX9_SIDISR_RFDN_MASK; if (unlikely(disr & (TXX9_SIDISR_UBRK | TXX9_SIDISR_UPER | TXX9_SIDISR_UFER | TXX9_SIDISR_UOER))) { /* @@ -281,21 +267,21 @@ receive_chars(struct uart_txx9_port *up, unsigned int= *status) */ if (disr & TXX9_SIDISR_UBRK) { disr &=3D ~(TXX9_SIDISR_UFER | TXX9_SIDISR_UPER); - up->port.icount.brk++; + up->icount.brk++; /* * We do the SysRQ and SAK checking * here because otherwise the break * may get masked by ignore_status_mask * or read_status_mask. */ - if (uart_handle_break(&up->port)) + if (uart_handle_break(up)) goto ignore_char; } else if (disr & TXX9_SIDISR_UPER) - up->port.icount.parity++; + up->icount.parity++; else if (disr & TXX9_SIDISR_UFER) - up->port.icount.frame++; + up->icount.frame++; if (disr & TXX9_SIDISR_UOER) { - up->port.icount.overrun++; + up->icount.overrun++; /* * The receiver read buffer still hold * a char which caused overrun. @@ -309,7 +295,7 @@ receive_chars(struct uart_txx9_port *up, unsigned int *= status) /* * Mask off conditions which should be ingored. */ - disr &=3D up->port.read_status_mask; + disr &=3D up->read_status_mask; =20 if (disr & TXX9_SIDISR_UBRK) { flag =3D TTY_BREAK; @@ -318,34 +304,34 @@ receive_chars(struct uart_txx9_port *up, unsigned int= *status) else if (disr & TXX9_SIDISR_UFER) flag =3D TTY_FRAME; } - if (uart_handle_sysrq_char(&up->port, ch)) + if (uart_handle_sysrq_char(up, ch)) goto ignore_char; =20 - uart_insert_char(&up->port, disr, TXX9_SIDISR_UOER, ch, flag); + uart_insert_char(up, disr, TXX9_SIDISR_UOER, ch, flag); =20 ignore_char: - up->port.ignore_status_mask =3D next_ignore_status_mask; + up->ignore_status_mask =3D next_ignore_status_mask; disr =3D sio_in(up, TXX9_SIDISR); } while (!(disr & TXX9_SIDISR_UVALID) && (max_count-- > 0)); =20 - tty_flip_buffer_push(&up->port.state->port); + tty_flip_buffer_push(&up->state->port); =20 *status =3D disr; } =20 -static inline void transmit_chars(struct uart_txx9_port *up) +static inline void transmit_chars(struct uart_port *up) { - struct circ_buf *xmit =3D &up->port.state->xmit; + struct circ_buf *xmit =3D &up->state->xmit; int count; =20 - if (up->port.x_char) { - sio_out(up, TXX9_SITFIFO, up->port.x_char); - up->port.icount.tx++; - up->port.x_char =3D 0; + if (up->x_char) { + sio_out(up, TXX9_SITFIFO, up->x_char); + up->icount.tx++; + up->x_char =3D 0; return; } - if (uart_circ_empty(xmit) || uart_tx_stopped(&up->port)) { - serial_txx9_stop_tx(&up->port); + if (uart_circ_empty(xmit) || uart_tx_stopped(up)) { + serial_txx9_stop_tx(up); return; } =20 @@ -353,32 +339,32 @@ static inline void transmit_chars(struct uart_txx9_po= rt *up) do { sio_out(up, TXX9_SITFIFO, xmit->buf[xmit->tail]); xmit->tail =3D (xmit->tail + 1) & (UART_XMIT_SIZE - 1); - up->port.icount.tx++; + up->icount.tx++; if (uart_circ_empty(xmit)) break; } while (--count > 0); =20 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) - uart_write_wakeup(&up->port); + uart_write_wakeup(up); =20 if (uart_circ_empty(xmit)) - serial_txx9_stop_tx(&up->port); + serial_txx9_stop_tx(up); } =20 static irqreturn_t serial_txx9_interrupt(int irq, void *dev_id) { int pass_counter =3D 0; - struct uart_txx9_port *up =3D dev_id; + struct uart_port *up =3D dev_id; unsigned int status; =20 while (1) { - spin_lock(&up->port.lock); + spin_lock(&up->lock); status =3D sio_in(up, TXX9_SIDISR); if (!(sio_in(up, TXX9_SIDICR) & TXX9_SIDICR_TIE)) status &=3D ~TXX9_SIDISR_TDIS; if (!(status & (TXX9_SIDISR_TDIS | TXX9_SIDISR_RDIS | TXX9_SIDISR_TOUT))) { - spin_unlock(&up->port.lock); + spin_unlock(&up->lock); break; } =20 @@ -390,7 +376,7 @@ static irqreturn_t serial_txx9_interrupt(int irq, void = *dev_id) sio_mask(up, TXX9_SIDISR, TXX9_SIDISR_TDIS | TXX9_SIDISR_RDIS | TXX9_SIDISR_TOUT); - spin_unlock(&up->port.lock); + spin_unlock(&up->lock); =20 if (pass_counter++ > PASS_LIMIT) break; @@ -399,22 +385,20 @@ static irqreturn_t serial_txx9_interrupt(int irq, voi= d *dev_id) return pass_counter ? IRQ_HANDLED : IRQ_NONE; } =20 -static unsigned int serial_txx9_tx_empty(struct uart_port *port) +static unsigned int serial_txx9_tx_empty(struct uart_port *up) { - struct uart_txx9_port *up =3D to_uart_txx9_port(port); unsigned long flags; unsigned int ret; =20 - spin_lock_irqsave(&up->port.lock, flags); + spin_lock_irqsave(&up->lock, flags); ret =3D (sio_in(up, TXX9_SICISR) & TXX9_SICISR_TXALS) ? TIOCSER_TEMT : 0; - spin_unlock_irqrestore(&up->port.lock, flags); + spin_unlock_irqrestore(&up->lock, flags); =20 return ret; } =20 -static unsigned int serial_txx9_get_mctrl(struct uart_port *port) +static unsigned int serial_txx9_get_mctrl(struct uart_port *up) { - struct uart_txx9_port *up =3D to_uart_txx9_port(port); unsigned int ret; =20 /* no modem control lines */ @@ -425,9 +409,8 @@ static unsigned int serial_txx9_get_mctrl(struct uart_p= ort *port) return ret; } =20 -static void serial_txx9_set_mctrl(struct uart_port *port, unsigned int mct= rl) +static void serial_txx9_set_mctrl(struct uart_port *up, unsigned int mctrl) { - struct uart_txx9_port *up =3D to_uart_txx9_port(port); =20 if (mctrl & TIOCM_RTS) sio_mask(up, TXX9_SIFLCR, TXX9_SIFLCR_RTSSC); @@ -435,24 +418,23 @@ static void serial_txx9_set_mctrl(struct uart_port *p= ort, unsigned int mctrl) sio_set(up, TXX9_SIFLCR, TXX9_SIFLCR_RTSSC); } =20 -static void serial_txx9_break_ctl(struct uart_port *port, int break_state) +static void serial_txx9_break_ctl(struct uart_port *up, int break_state) { - struct uart_txx9_port *up =3D to_uart_txx9_port(port); unsigned long flags; =20 - spin_lock_irqsave(&up->port.lock, flags); + spin_lock_irqsave(&up->lock, flags); if (break_state =3D=3D -1) sio_set(up, TXX9_SIFLCR, TXX9_SIFLCR_TBRK); else sio_mask(up, TXX9_SIFLCR, TXX9_SIFLCR_TBRK); - spin_unlock_irqrestore(&up->port.lock, flags); + spin_unlock_irqrestore(&up->lock, flags); } =20 #if defined(CONFIG_SERIAL_TXX9_CONSOLE) || defined(CONFIG_CONSOLE_POLL) /* * Wait for transmitter & holding register to empty */ -static void wait_for_xmitr(struct uart_txx9_port *up) +static void wait_for_xmitr(struct uart_port *up) { unsigned int tmout =3D 10000; =20 @@ -462,7 +444,7 @@ static void wait_for_xmitr(struct uart_txx9_port *up) udelay(1); =20 /* Wait up to 1s for flow control if necessary */ - if (up->port.flags & UPF_CONS_FLOW) { + if (up->flags & UPF_CONS_FLOW) { tmout =3D 1000000; while (--tmout && (sio_in(up, TXX9_SICISR) & TXX9_SICISR_CTSS)) @@ -477,11 +459,10 @@ static void wait_for_xmitr(struct uart_txx9_port *up) * in an interrupt or debug context. */ =20 -static int serial_txx9_get_poll_char(struct uart_port *port) +static int serial_txx9_get_poll_char(struct uart_port *up) { unsigned int ier; unsigned char c; - struct uart_txx9_port *up =3D to_uart_txx9_port(port); =20 /* * First save the IER then disable the interrupts @@ -504,10 +485,9 @@ static int serial_txx9_get_poll_char(struct uart_port = *port) } =20 =20 -static void serial_txx9_put_poll_char(struct uart_port *port, unsigned cha= r c) +static void serial_txx9_put_poll_char(struct uart_port *up, unsigned char = c) { unsigned int ier; - struct uart_txx9_port *up =3D to_uart_txx9_port(port); =20 /* * First save the IER then disable the interrupts @@ -531,9 +511,8 @@ static void serial_txx9_put_poll_char(struct uart_port = *port, unsigned char c) =20 #endif /* CONFIG_CONSOLE_POLL */ =20 -static int serial_txx9_startup(struct uart_port *port) +static int serial_txx9_startup(struct uart_port *up) { - struct uart_txx9_port *up =3D to_uart_txx9_port(port); unsigned long flags; int retval; =20 @@ -553,7 +532,7 @@ static int serial_txx9_startup(struct uart_port *port) */ sio_out(up, TXX9_SIDISR, 0); =20 - retval =3D request_irq(up->port.irq, serial_txx9_interrupt, + retval =3D request_irq(up->irq, serial_txx9_interrupt, IRQF_SHARED, "serial_txx9", up); if (retval) return retval; @@ -561,9 +540,9 @@ static int serial_txx9_startup(struct uart_port *port) /* * Now, initialize the UART */ - spin_lock_irqsave(&up->port.lock, flags); - serial_txx9_set_mctrl(&up->port, up->port.mctrl); - spin_unlock_irqrestore(&up->port.lock, flags); + spin_lock_irqsave(&up->lock, flags); + serial_txx9_set_mctrl(up, up->mctrl); + spin_unlock_irqrestore(&up->lock, flags); =20 /* Enable RX/TX */ sio_mask(up, TXX9_SIFLCR, TXX9_SIFLCR_RSDE | TXX9_SIFLCR_TSDE); @@ -576,9 +555,8 @@ static int serial_txx9_startup(struct uart_port *port) return 0; } =20 -static void serial_txx9_shutdown(struct uart_port *port) +static void serial_txx9_shutdown(struct uart_port *up) { - struct uart_txx9_port *up =3D to_uart_txx9_port(port); unsigned long flags; =20 /* @@ -586,9 +564,9 @@ static void serial_txx9_shutdown(struct uart_port *port) */ sio_out(up, TXX9_SIDICR, 0); /* disable all intrs */ =20 - spin_lock_irqsave(&up->port.lock, flags); - serial_txx9_set_mctrl(&up->port, up->port.mctrl); - spin_unlock_irqrestore(&up->port.lock, flags); + spin_lock_irqsave(&up->lock, flags); + serial_txx9_set_mctrl(up, up->mctrl); + spin_unlock_irqrestore(&up->lock, flags); =20 /* * Disable break condition @@ -596,8 +574,8 @@ static void serial_txx9_shutdown(struct uart_port *port) sio_mask(up, TXX9_SIFLCR, TXX9_SIFLCR_TBRK); =20 #ifdef CONFIG_SERIAL_TXX9_CONSOLE - if (up->port.cons && up->port.line =3D=3D up->port.cons->index) { - free_irq(up->port.irq, up); + if (up->cons && up->line =3D=3D up->cons->index) { + free_irq(up->irq, up); return; } #endif @@ -611,14 +589,13 @@ static void serial_txx9_shutdown(struct uart_port *po= rt) /* Disable RX/TX */ sio_set(up, TXX9_SIFLCR, TXX9_SIFLCR_RSDE | TXX9_SIFLCR_TSDE); =20 - free_irq(up->port.irq, up); + free_irq(up->irq, up); } =20 static void -serial_txx9_set_termios(struct uart_port *port, struct ktermios *termios, +serial_txx9_set_termios(struct uart_port *up, struct ktermios *termios, struct ktermios *old) { - struct uart_txx9_port *up =3D to_uart_txx9_port(port); unsigned int cval, fcr =3D 0; unsigned long flags; unsigned int baud, quot; @@ -658,8 +635,8 @@ serial_txx9_set_termios(struct uart_port *port, struct = ktermios *termios, /* * Ask the core to calculate the divisor for us. */ - baud =3D uart_get_baud_rate(port, termios, old, 0, port->uartclk/16/2); - quot =3D uart_get_divisor(port, baud); + baud =3D uart_get_baud_rate(up, termios, old, 0, up->uartclk/16/2); + quot =3D uart_get_divisor(up, baud); =20 /* Set up FIFOs */ /* TX Int by FIFO Empty, RX Int by Receiving 1 char. */ @@ -669,45 +646,45 @@ serial_txx9_set_termios(struct uart_port *port, struc= t ktermios *termios, * Ok, we're now changing the port state. Do it with * interrupts disabled. */ - spin_lock_irqsave(&up->port.lock, flags); + spin_lock_irqsave(&up->lock, flags); =20 /* * Update the per-port timeout. */ - uart_update_timeout(port, termios->c_cflag, baud); + uart_update_timeout(up, termios->c_cflag, baud); =20 - up->port.read_status_mask =3D TXX9_SIDISR_UOER | + up->read_status_mask =3D TXX9_SIDISR_UOER | TXX9_SIDISR_TDIS | TXX9_SIDISR_RDIS; if (termios->c_iflag & INPCK) - up->port.read_status_mask |=3D TXX9_SIDISR_UFER | TXX9_SIDISR_UPER; + up->read_status_mask |=3D TXX9_SIDISR_UFER | TXX9_SIDISR_UPER; if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) - up->port.read_status_mask |=3D TXX9_SIDISR_UBRK; + up->read_status_mask |=3D TXX9_SIDISR_UBRK; =20 /* * Characteres to ignore */ - up->port.ignore_status_mask =3D 0; + up->ignore_status_mask =3D 0; if (termios->c_iflag & IGNPAR) - up->port.ignore_status_mask |=3D TXX9_SIDISR_UPER | TXX9_SIDISR_UFER; + up->ignore_status_mask |=3D TXX9_SIDISR_UPER | TXX9_SIDISR_UFER; if (termios->c_iflag & IGNBRK) { - up->port.ignore_status_mask |=3D TXX9_SIDISR_UBRK; + up->ignore_status_mask |=3D TXX9_SIDISR_UBRK; /* * If we're ignoring parity and break indicators, * ignore overruns too (for real raw support). */ if (termios->c_iflag & IGNPAR) - up->port.ignore_status_mask |=3D TXX9_SIDISR_UOER; + up->ignore_status_mask |=3D TXX9_SIDISR_UOER; } =20 /* * ignore all characters if CREAD is not set */ if ((termios->c_cflag & CREAD) =3D=3D 0) - up->port.ignore_status_mask |=3D TXX9_SIDISR_RDIS; + up->ignore_status_mask |=3D TXX9_SIDISR_RDIS; =20 /* CTS flow control flag */ if ((termios->c_cflag & CRTSCTS) && - (up->port.flags & UPF_TXX9_HAVE_CTS_LINE)) { + (up->flags & UPF_TXX9_HAVE_CTS_LINE)) { sio_set(up, TXX9_SIFLCR, TXX9_SIFLCR_RCS | TXX9_SIFLCR_TES); } else { @@ -719,8 +696,8 @@ serial_txx9_set_termios(struct uart_port *port, struct = ktermios *termios, sio_quot_set(up, quot); sio_out(up, TXX9_SIFCR, fcr); =20 - serial_txx9_set_mctrl(&up->port, up->port.mctrl); - spin_unlock_irqrestore(&up->port.lock, flags); + serial_txx9_set_mctrl(up, up->mctrl); + spin_unlock_irqrestore(&up->lock, flags); } =20 static void @@ -739,76 +716,73 @@ serial_txx9_pm(struct uart_port *port, unsigned int s= tate, serial_txx9_initialize(port); } =20 -static int serial_txx9_request_resource(struct uart_txx9_port *up) +static int serial_txx9_request_resource(struct uart_port *up) { unsigned int size =3D TXX9_REGION_SIZE; int ret =3D 0; =20 - switch (up->port.iotype) { + switch (up->iotype) { default: - if (!up->port.mapbase) + if (!up->mapbase) break; =20 - if (!request_mem_region(up->port.mapbase, size, "serial_txx9")) { + if (!request_mem_region(up->mapbase, size, "serial_txx9")) { ret =3D -EBUSY; break; } =20 - if (up->port.flags & UPF_IOREMAP) { - up->port.membase =3D ioremap(up->port.mapbase, size); - if (!up->port.membase) { - release_mem_region(up->port.mapbase, size); + if (up->flags & UPF_IOREMAP) { + up->membase =3D ioremap(up->mapbase, size); + if (!up->membase) { + release_mem_region(up->mapbase, size); ret =3D -ENOMEM; } } break; =20 case UPIO_PORT: - if (!request_region(up->port.iobase, size, "serial_txx9")) + if (!request_region(up->iobase, size, "serial_txx9")) ret =3D -EBUSY; break; } return ret; } =20 -static void serial_txx9_release_resource(struct uart_txx9_port *up) +static void serial_txx9_release_resource(struct uart_port *up) { unsigned int size =3D TXX9_REGION_SIZE; =20 - switch (up->port.iotype) { + switch (up->iotype) { default: - if (!up->port.mapbase) + if (!up->mapbase) break; =20 - if (up->port.flags & UPF_IOREMAP) { - iounmap(up->port.membase); - up->port.membase =3D NULL; + if (up->flags & UPF_IOREMAP) { + iounmap(up->membase); + up->membase =3D NULL; } =20 - release_mem_region(up->port.mapbase, size); + release_mem_region(up->mapbase, size); break; =20 case UPIO_PORT: - release_region(up->port.iobase, size); + release_region(up->iobase, size); break; } } =20 -static void serial_txx9_release_port(struct uart_port *port) +static void serial_txx9_release_port(struct uart_port *up) { - struct uart_txx9_port *up =3D to_uart_txx9_port(port); serial_txx9_release_resource(up); } =20 -static int serial_txx9_request_port(struct uart_port *port) +static int serial_txx9_request_port(struct uart_port *up) { - struct uart_txx9_port *up =3D to_uart_txx9_port(port); return serial_txx9_request_resource(up); } =20 -static void serial_txx9_config_port(struct uart_port *port, int uflags) +static void serial_txx9_config_port(struct uart_port *up, int uflags) { - struct uart_txx9_port *up =3D to_uart_txx9_port(port); int ret; =20 /* @@ -818,14 +792,14 @@ static void serial_txx9_config_port(struct uart_port = *port, int uflags) ret =3D serial_txx9_request_resource(up); if (ret < 0) return; - port->type =3D PORT_TXX9; - up->port.fifosize =3D TXX9_SIO_TX_FIFO; + up->type =3D PORT_TXX9; + up->fifosize =3D TXX9_SIO_TX_FIFO; =20 #ifdef CONFIG_SERIAL_TXX9_CONSOLE - if (up->port.line =3D=3D up->port.cons->index) + if (up->line =3D=3D up->cons->index) return; #endif - serial_txx9_initialize(port); + serial_txx9_initialize(up); } =20 static const char * @@ -856,7 +830,7 @@ static const struct uart_ops serial_txx9_pops =3D { #endif }; =20 -static struct uart_txx9_port serial_txx9_ports[UART_NR]; +static struct uart_port serial_txx9_ports[UART_NR]; =20 static void __init serial_txx9_register_ports(struct uart_driver *drv, struct device *dev) @@ -864,22 +838,20 @@ static void __init serial_txx9_register_ports(struct = uart_driver *drv, int i; =20 for (i =3D 0; i < UART_NR; i++) { - struct uart_txx9_port *up =3D &serial_txx9_ports[i]; + struct uart_port *up =3D &serial_txx9_ports[i]; =20 - up->port.line =3D i; - up->port.ops =3D &serial_txx9_pops; - up->port.dev =3D dev; - if (up->port.iobase || up->port.mapbase) - uart_add_one_port(drv, &up->port); + up->line =3D i; + up->ops =3D &serial_txx9_pops; + up->dev =3D dev; + if (up->iobase || up->mapbase) + uart_add_one_port(drv, up); } } =20 #ifdef CONFIG_SERIAL_TXX9_CONSOLE =20 -static void serial_txx9_console_putchar(struct uart_port *port, unsigned c= har ch) +static void serial_txx9_console_putchar(struct uart_port *up, unsigned cha= r ch) { - struct uart_txx9_port *up =3D to_uart_txx9_port(port); - wait_for_xmitr(up); sio_out(up, TXX9_SITFIFO, ch); } @@ -893,7 +865,7 @@ static void serial_txx9_console_putchar(struct uart_por= t *port, unsigned char ch static void serial_txx9_console_write(struct console *co, const char *s, unsigned int = count) { - struct uart_txx9_port *up =3D &serial_txx9_ports[co->index]; + struct uart_port *up =3D &serial_txx9_ports[co->index]; unsigned int ier, flcr; =20 /* @@ -905,10 +877,10 @@ serial_txx9_console_write(struct console *co, const c= har *s, unsigned int count) * Disable flow-control if enabled (and unnecessary) */ flcr =3D sio_in(up, TXX9_SIFLCR); - if (!(up->port.flags & UPF_CONS_FLOW) && (flcr & TXX9_SIFLCR_TES)) + if (!(up->flags & UPF_CONS_FLOW) && (flcr & TXX9_SIFLCR_TES)) sio_out(up, TXX9_SIFLCR, flcr & ~TXX9_SIFLCR_TES); =20 - uart_console_write(&up->port, s, count, serial_txx9_console_putchar); + uart_console_write(up, s, count, serial_txx9_console_putchar); =20 /* * Finally, wait for transmitter to become empty @@ -921,8 +893,7 @@ serial_txx9_console_write(struct console *co, const cha= r *s, unsigned int count) =20 static int __init serial_txx9_console_setup(struct console *co, char *opti= ons) { - struct uart_port *port; - struct uart_txx9_port *up; + struct uart_port *up; int baud =3D 9600; int bits =3D 8; int parity =3D 'n'; @@ -936,16 +907,15 @@ static int __init serial_txx9_console_setup(struct co= nsole *co, char *options) if (co->index >=3D UART_NR) co->index =3D 0; up =3D &serial_txx9_ports[co->index]; - port =3D &up->port; - if (!port->ops) + if (!up->ops) return -ENODEV; =20 - serial_txx9_initialize(&up->port); + serial_txx9_initialize(up); =20 if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); =20 - return uart_set_options(port, co, baud, parity, bits, flow); + return uart_set_options(up, co, baud, parity, bits, flow); } =20 static struct uart_driver serial_txx9_reg; @@ -986,9 +956,9 @@ int __init early_serial_txx9_setup(struct uart_port *po= rt) if (port->line >=3D ARRAY_SIZE(serial_txx9_ports)) return -ENODEV; =20 - serial_txx9_ports[port->line].port =3D *port; - serial_txx9_ports[port->line].port.ops =3D &serial_txx9_pops; - serial_txx9_ports[port->line].port.flags |=3D + serial_txx9_ports[port->line] =3D *port; + serial_txx9_ports[port->line].ops =3D &serial_txx9_pops; + serial_txx9_ports[port->line].flags |=3D UPF_BOOT_AUTOCONF | UPF_FIXED_PORT; return 0; } @@ -1009,14 +979,14 @@ static DEFINE_MUTEX(serial_txx9_mutex); static int serial_txx9_register_port(struct uart_port *port) { int i; - struct uart_txx9_port *uart; + struct uart_port *uart; int ret =3D -ENOSPC; =20 mutex_lock(&serial_txx9_mutex); for (i =3D 0; i < UART_NR; i++) { uart =3D &serial_txx9_ports[i]; - if (uart_match_port(&uart->port, port)) { - uart_remove_one_port(&serial_txx9_reg, &uart->port); + if (uart_match_port(uart, port)) { + uart_remove_one_port(&serial_txx9_reg, uart); break; } } @@ -1024,24 +994,24 @@ static int serial_txx9_register_port(struct uart_por= t *port) /* Find unused port */ for (i =3D 0; i < UART_NR; i++) { uart =3D &serial_txx9_ports[i]; - if (!(uart->port.iobase || uart->port.mapbase)) + if (!(uart->iobase || uart->mapbase)) break; } } if (i < UART_NR) { - uart->port.iobase =3D port->iobase; - uart->port.membase =3D port->membase; - uart->port.irq =3D port->irq; - uart->port.uartclk =3D port->uartclk; - uart->port.iotype =3D port->iotype; - uart->port.flags =3D port->flags + uart->iobase =3D port->iobase; + uart->membase =3D port->membase; + uart->irq =3D port->irq; + uart->uartclk =3D port->uartclk; + uart->iotype =3D port->iotype; + uart->flags =3D port->flags | UPF_BOOT_AUTOCONF | UPF_FIXED_PORT; - uart->port.mapbase =3D port->mapbase; + uart->mapbase =3D port->mapbase; if (port->dev) - uart->port.dev =3D port->dev; - ret =3D uart_add_one_port(&serial_txx9_reg, &uart->port); + uart->dev =3D port->dev; + ret =3D uart_add_one_port(&serial_txx9_reg, uart); if (ret =3D=3D 0) - ret =3D uart->port.line; + ret =3D uart->line; } mutex_unlock(&serial_txx9_mutex); return ret; @@ -1056,16 +1026,16 @@ static int serial_txx9_register_port(struct uart_po= rt *port) */ static void serial_txx9_unregister_port(int line) { - struct uart_txx9_port *uart =3D &serial_txx9_ports[line]; + struct uart_port *uart =3D &serial_txx9_ports[line]; =20 mutex_lock(&serial_txx9_mutex); - uart_remove_one_port(&serial_txx9_reg, &uart->port); - uart->port.flags =3D 0; - uart->port.type =3D PORT_UNKNOWN; - uart->port.iobase =3D 0; - uart->port.mapbase =3D 0; - uart->port.membase =3D NULL; - uart->port.dev =3D NULL; + uart_remove_one_port(&serial_txx9_reg, uart); + uart->flags =3D 0; + uart->type =3D PORT_UNKNOWN; + uart->iobase =3D 0; + uart->mapbase =3D 0; + uart->membase =3D NULL; + uart->dev =3D NULL; mutex_unlock(&serial_txx9_mutex); } =20 @@ -1108,9 +1078,9 @@ static int serial_txx9_remove(struct platform_device = *dev) int i; =20 for (i =3D 0; i < UART_NR; i++) { - struct uart_txx9_port *up =3D &serial_txx9_ports[i]; + struct uart_port *up =3D &serial_txx9_ports[i]; =20 - if (up->port.dev =3D=3D &dev->dev) + if (up->dev =3D=3D &dev->dev) serial_txx9_unregister_port(i); } return 0; @@ -1122,10 +1092,10 @@ static int serial_txx9_suspend(struct platform_devi= ce *dev, pm_message_t state) int i; =20 for (i =3D 0; i < UART_NR; i++) { - struct uart_txx9_port *up =3D &serial_txx9_ports[i]; + struct uart_port *up =3D &serial_txx9_ports[i]; =20 - if (up->port.type !=3D PORT_UNKNOWN && up->port.dev =3D=3D &dev->dev) - uart_suspend_port(&serial_txx9_reg, &up->port); + if (up->type !=3D PORT_UNKNOWN && up->dev =3D=3D &dev->dev) + uart_suspend_port(&serial_txx9_reg, up); } =20 return 0; @@ -1136,10 +1106,10 @@ static int serial_txx9_resume(struct platform_devic= e *dev) int i; =20 for (i =3D 0; i < UART_NR; i++) { - struct uart_txx9_port *up =3D &serial_txx9_ports[i]; + struct uart_port *up =3D &serial_txx9_ports[i]; =20 - if (up->port.type !=3D PORT_UNKNOWN && up->port.dev =3D=3D &dev->dev) - uart_resume_port(&serial_txx9_reg, &up->port); + if (up->type !=3D PORT_UNKNOWN && up->dev =3D=3D &dev->dev) + uart_resume_port(&serial_txx9_reg, up); } =20 return 0; @@ -1195,10 +1165,10 @@ pciserial_txx9_init_one(struct pci_dev *dev, const = struct pci_device_id *ent) =20 static void pciserial_txx9_remove_one(struct pci_dev *dev) { - struct uart_txx9_port *up =3D pci_get_drvdata(dev); + struct uart_port *up =3D pci_get_drvdata(dev); =20 if (up) { - serial_txx9_unregister_port(up->port.line); + serial_txx9_unregister_port(up->line); pci_disable_device(dev); } } @@ -1206,10 +1176,10 @@ static void pciserial_txx9_remove_one(struct pci_de= v *dev) #ifdef CONFIG_PM static int pciserial_txx9_suspend_one(struct pci_dev *dev, pm_message_t st= ate) { - struct uart_txx9_port *up =3D pci_get_drvdata(dev); + struct uart_port *up =3D pci_get_drvdata(dev); =20 if (up) - uart_suspend_port(&serial_txx9_reg, &up->port); + uart_suspend_port(&serial_txx9_reg, up); pci_save_state(dev); pci_set_power_state(dev, pci_choose_state(dev, state)); return 0; @@ -1217,12 +1187,12 @@ static int pciserial_txx9_suspend_one(struct pci_de= v *dev, pm_message_t state) =20 static int pciserial_txx9_resume_one(struct pci_dev *dev) { - struct uart_txx9_port *up =3D pci_get_drvdata(dev); + struct uart_port *up =3D pci_get_drvdata(dev); =20 pci_set_power_state(dev, PCI_D0); pci_restore_state(dev); if (up) - uart_resume_port(&serial_txx9_reg, &up->port); + uart_resume_port(&serial_txx9_reg, up); return 0; } #endif @@ -1302,9 +1272,9 @@ static void __exit serial_txx9_exit(void) platform_driver_unregister(&serial_txx9_plat_driver); platform_device_unregister(serial_txx9_plat_devs); for (i =3D 0; i < UART_NR; i++) { - struct uart_txx9_port *up =3D &serial_txx9_ports[i]; - if (up->port.iobase || up->port.mapbase) - uart_remove_one_port(&serial_txx9_reg, &up->port); + struct uart_port *up =3D &serial_txx9_ports[i]; + if (up->iobase || up->mapbase) + uart_remove_one_port(&serial_txx9_reg, up); } =20 uart_unregister_driver(&serial_txx9_reg); --=20 2.35.1 From nobody Tue Jun 23 23:41:51 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 EEEB9C433FE for ; Thu, 24 Feb 2022 11:10:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233910AbiBXLLZ (ORCPT ); Thu, 24 Feb 2022 06:11:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233291AbiBXLLM (ORCPT ); Thu, 24 Feb 2022 06:11:12 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 581412905A3; Thu, 24 Feb 2022 03:10:31 -0800 (PST) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 143FB212B6; Thu, 24 Feb 2022 11:10:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1645701030; 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=Pj/WASmNBm2vKpc65J25SbBeZFSQJGul5ARSkIkJDv0=; b=gJKTei/XJeCxWpQ5CTIdU4f5+07KecfrBaV9WWtx8HG+s3KjI3xgF0ojI9ojnls4DHW9fT iwOGGUilr+MZjm2JpcUofv3clOON7el0asK24sA1tAgnT0sohBjRzLgkN0Lt8FHo0RZ1yg 7T3ofkt78rpJXMHzHKzM8Uw76XskCrQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1645701030; 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=Pj/WASmNBm2vKpc65J25SbBeZFSQJGul5ARSkIkJDv0=; b=GODSpm1hsQofHgi/GBOH/hIKi9KS/V8q7aYNaOXJFTepmayUTY4MV5OOl1mYbRihf4Kpk3 pKwFnmEPdrvOJOAg== 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 D56A1A3B85; Thu, 24 Feb 2022 11:10:29 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby , Russell King Subject: [PATCH 4/5] tty: serial: amba-pl010: use more uart_port pointers Date: Thu, 24 Feb 2022 12:10:27 +0100 Message-Id: <20220224111028.20917-5-jslaby@suse.cz> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220224111028.20917-1-jslaby@suse.cz> References: <20220224111028.20917-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" The code uses uart_amba_port::port on many places. Sometimes it even needs not uart_amba_port itself. So simplify the code on many places and remove the need of uart_amba_port on some places completely. No functional changes intended. The objdump -d output shows only a code move in pl010_rx_chars(). Signed-off-by: Jiri Slaby Cc: Russell King --- drivers/tty/serial/amba-pl010.c | 174 +++++++++++++++----------------- 1 file changed, 84 insertions(+), 90 deletions(-) diff --git a/drivers/tty/serial/amba-pl010.c b/drivers/tty/serial/amba-pl01= 0.c index 896f66cacf8b..fae0b581ff42 100644 --- a/drivers/tty/serial/amba-pl010.c +++ b/drivers/tty/serial/amba-pl010.c @@ -110,38 +110,38 @@ static void pl010_enable_ms(struct uart_port *port) writel(cr, uap->port.membase + UART010_CR); } =20 -static void pl010_rx_chars(struct uart_amba_port *uap) +static void pl010_rx_chars(struct uart_port *port) { unsigned int status, ch, flag, rsr, max_count =3D 256; =20 - status =3D readb(uap->port.membase + UART01x_FR); + status =3D readb(port->membase + UART01x_FR); while (UART_RX_DATA(status) && max_count--) { - ch =3D readb(uap->port.membase + UART01x_DR); + ch =3D readb(port->membase + UART01x_DR); flag =3D TTY_NORMAL; =20 - uap->port.icount.rx++; + port->icount.rx++; =20 /* * Note that the error handling code is * out of the main execution path */ - rsr =3D readb(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX; + rsr =3D readb(port->membase + UART01x_RSR) | UART_DUMMY_RSR_RX; if (unlikely(rsr & UART01x_RSR_ANY)) { - writel(0, uap->port.membase + UART01x_ECR); + writel(0, port->membase + UART01x_ECR); =20 if (rsr & UART01x_RSR_BE) { rsr &=3D ~(UART01x_RSR_FE | UART01x_RSR_PE); - uap->port.icount.brk++; - if (uart_handle_break(&uap->port)) + port->icount.brk++; + if (uart_handle_break(port)) goto ignore_char; } else if (rsr & UART01x_RSR_PE) - uap->port.icount.parity++; + port->icount.parity++; else if (rsr & UART01x_RSR_FE) - uap->port.icount.frame++; + port->icount.frame++; if (rsr & UART01x_RSR_OE) - uap->port.icount.overrun++; + port->icount.overrun++; =20 - rsr &=3D uap->port.read_status_mask; + rsr &=3D port->read_status_mask; =20 if (rsr & UART01x_RSR_BE) flag =3D TTY_BREAK; @@ -151,56 +151,57 @@ static void pl010_rx_chars(struct uart_amba_port *uap) flag =3D TTY_FRAME; } =20 - if (uart_handle_sysrq_char(&uap->port, ch)) + if (uart_handle_sysrq_char(port, ch)) goto ignore_char; =20 - uart_insert_char(&uap->port, rsr, UART01x_RSR_OE, ch, flag); + uart_insert_char(port, rsr, UART01x_RSR_OE, ch, flag); =20 ignore_char: - status =3D readb(uap->port.membase + UART01x_FR); + status =3D readb(port->membase + UART01x_FR); } - tty_flip_buffer_push(&uap->port.state->port); + tty_flip_buffer_push(&port->state->port); } =20 -static void pl010_tx_chars(struct uart_amba_port *uap) +static void pl010_tx_chars(struct uart_port *port) { - struct circ_buf *xmit =3D &uap->port.state->xmit; + struct circ_buf *xmit =3D &port->state->xmit; int count; =20 - if (uap->port.x_char) { - writel(uap->port.x_char, uap->port.membase + UART01x_DR); - uap->port.icount.tx++; - uap->port.x_char =3D 0; + if (port->x_char) { + writel(port->x_char, port->membase + UART01x_DR); + port->icount.tx++; + port->x_char =3D 0; return; } - if (uart_circ_empty(xmit) || uart_tx_stopped(&uap->port)) { - pl010_stop_tx(&uap->port); + if (uart_circ_empty(xmit) || uart_tx_stopped(port)) { + pl010_stop_tx(port); return; } =20 - count =3D uap->port.fifosize >> 1; + count =3D port->fifosize >> 1; do { - writel(xmit->buf[xmit->tail], uap->port.membase + UART01x_DR); + writel(xmit->buf[xmit->tail], port->membase + UART01x_DR); xmit->tail =3D (xmit->tail + 1) & (UART_XMIT_SIZE - 1); - uap->port.icount.tx++; + port->icount.tx++; if (uart_circ_empty(xmit)) break; } while (--count > 0); =20 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) - uart_write_wakeup(&uap->port); + uart_write_wakeup(port); =20 if (uart_circ_empty(xmit)) - pl010_stop_tx(&uap->port); + pl010_stop_tx(port); } =20 static void pl010_modem_status(struct uart_amba_port *uap) { + struct uart_port *port =3D &uap->port; unsigned int status, delta; =20 - writel(0, uap->port.membase + UART010_ICR); + writel(0, port->membase + UART010_ICR); =20 - status =3D readb(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY; + status =3D readb(port->membase + UART01x_FR) & UART01x_FR_MODEM_ANY; =20 delta =3D status ^ uap->old_status; uap->old_status =3D status; @@ -209,65 +210,63 @@ static void pl010_modem_status(struct uart_amba_port = *uap) return; =20 if (delta & UART01x_FR_DCD) - uart_handle_dcd_change(&uap->port, status & UART01x_FR_DCD); + uart_handle_dcd_change(port, status & UART01x_FR_DCD); =20 if (delta & UART01x_FR_DSR) - uap->port.icount.dsr++; + port->icount.dsr++; =20 if (delta & UART01x_FR_CTS) - uart_handle_cts_change(&uap->port, status & UART01x_FR_CTS); + uart_handle_cts_change(port, status & UART01x_FR_CTS); =20 - wake_up_interruptible(&uap->port.state->port.delta_msr_wait); + wake_up_interruptible(&port->state->port.delta_msr_wait); } =20 static irqreturn_t pl010_int(int irq, void *dev_id) { struct uart_amba_port *uap =3D dev_id; + struct uart_port *port =3D &uap->port; unsigned int status, pass_counter =3D AMBA_ISR_PASS_LIMIT; int handled =3D 0; =20 - spin_lock(&uap->port.lock); + spin_lock(&port->lock); =20 - status =3D readb(uap->port.membase + UART010_IIR); + status =3D readb(port->membase + UART010_IIR); if (status) { do { if (status & (UART010_IIR_RTIS | UART010_IIR_RIS)) - pl010_rx_chars(uap); + pl010_rx_chars(port); if (status & UART010_IIR_MIS) pl010_modem_status(uap); if (status & UART010_IIR_TIS) - pl010_tx_chars(uap); + pl010_tx_chars(port); =20 if (pass_counter-- =3D=3D 0) break; =20 - status =3D readb(uap->port.membase + UART010_IIR); + status =3D readb(port->membase + UART010_IIR); } while (status & (UART010_IIR_RTIS | UART010_IIR_RIS | UART010_IIR_TIS)); handled =3D 1; } =20 - spin_unlock(&uap->port.lock); + spin_unlock(&port->lock); =20 return IRQ_RETVAL(handled); } =20 static unsigned int pl010_tx_empty(struct uart_port *port) { - struct uart_amba_port *uap =3D - container_of(port, struct uart_amba_port, port); - unsigned int status =3D readb(uap->port.membase + UART01x_FR); + unsigned int status =3D readb(port->membase + UART01x_FR); + return status & UART01x_FR_BUSY ? 0 : TIOCSER_TEMT; } =20 static unsigned int pl010_get_mctrl(struct uart_port *port) { - struct uart_amba_port *uap =3D - container_of(port, struct uart_amba_port, port); unsigned int result =3D 0; unsigned int status; =20 - status =3D readb(uap->port.membase + UART01x_FR); + status =3D readb(port->membase + UART01x_FR); if (status & UART01x_FR_DCD) result |=3D TIOCM_CAR; if (status & UART01x_FR_DSR) @@ -284,24 +283,22 @@ static void pl010_set_mctrl(struct uart_port *port, u= nsigned int mctrl) container_of(port, struct uart_amba_port, port); =20 if (uap->data) - uap->data->set_mctrl(uap->dev, uap->port.membase, mctrl); + uap->data->set_mctrl(uap->dev, port->membase, mctrl); } =20 static void pl010_break_ctl(struct uart_port *port, int break_state) { - struct uart_amba_port *uap =3D - container_of(port, struct uart_amba_port, port); unsigned long flags; unsigned int lcr_h; =20 - spin_lock_irqsave(&uap->port.lock, flags); - lcr_h =3D readb(uap->port.membase + UART010_LCRH); + spin_lock_irqsave(&port->lock, flags); + lcr_h =3D readb(port->membase + UART010_LCRH); if (break_state =3D=3D -1) lcr_h |=3D UART01x_LCRH_BRK; else lcr_h &=3D ~UART01x_LCRH_BRK; - writel(lcr_h, uap->port.membase + UART010_LCRH); - spin_unlock_irqrestore(&uap->port.lock, flags); + writel(lcr_h, port->membase + UART010_LCRH); + spin_unlock_irqrestore(&port->lock, flags); } =20 static int pl010_startup(struct uart_port *port) @@ -317,25 +314,25 @@ static int pl010_startup(struct uart_port *port) if (retval) goto out; =20 - uap->port.uartclk =3D clk_get_rate(uap->clk); + port->uartclk =3D clk_get_rate(uap->clk); =20 /* * Allocate the IRQ */ - retval =3D request_irq(uap->port.irq, pl010_int, 0, "uart-pl010", uap); + retval =3D request_irq(port->irq, pl010_int, 0, "uart-pl010", uap); if (retval) goto clk_dis; =20 /* * initialise the old status of the modem signals */ - uap->old_status =3D readb(uap->port.membase + UART01x_FR) & UART01x_FR_MO= DEM_ANY; + uap->old_status =3D readb(port->membase + UART01x_FR) & UART01x_FR_MODEM_= ANY; =20 /* * Finally, enable interrupts */ writel(UART01x_CR_UARTEN | UART010_CR_RIE | UART010_CR_RTIE, - uap->port.membase + UART010_CR); + port->membase + UART010_CR); =20 return 0; =20 @@ -353,17 +350,17 @@ static void pl010_shutdown(struct uart_port *port) /* * Free the interrupt */ - free_irq(uap->port.irq, uap); + free_irq(port->irq, uap); =20 /* * disable all interrupts, disable the port */ - writel(0, uap->port.membase + UART010_CR); + writel(0, port->membase + UART010_CR); =20 /* disable break condition and fifos */ - writel(readb(uap->port.membase + UART010_LCRH) & + writel(readb(port->membase + UART010_LCRH) & ~(UART01x_LCRH_BRK | UART01x_LCRH_FEN), - uap->port.membase + UART010_LCRH); + port->membase + UART010_LCRH); =20 /* * Shut down the clock producer @@ -375,8 +372,6 @@ static void pl010_set_termios(struct uart_port *port, struct ktermios *termios, struct ktermios *old) { - struct uart_amba_port *uap =3D - container_of(port, struct uart_amba_port, port); unsigned int lcr_h, old_cr; unsigned long flags; unsigned int baud, quot; @@ -384,7 +379,7 @@ pl010_set_termios(struct uart_port *port, struct ktermi= os *termios, /* * Ask the core to calculate the divisor for us. */ - baud =3D uart_get_baud_rate(port, termios, old, 0, uap->port.uartclk/16);=20 + baud =3D uart_get_baud_rate(port, termios, old, 0, port->uartclk / 16); quot =3D uart_get_divisor(port, baud); =20 switch (termios->c_cflag & CSIZE) { @@ -408,63 +403,63 @@ pl010_set_termios(struct uart_port *port, struct kter= mios *termios, if (!(termios->c_cflag & PARODD)) lcr_h |=3D UART01x_LCRH_EPS; } - if (uap->port.fifosize > 1) + if (port->fifosize > 1) lcr_h |=3D UART01x_LCRH_FEN; =20 - spin_lock_irqsave(&uap->port.lock, flags); + spin_lock_irqsave(&port->lock, flags); =20 /* * Update the per-port timeout. */ uart_update_timeout(port, termios->c_cflag, baud); =20 - uap->port.read_status_mask =3D UART01x_RSR_OE; + port->read_status_mask =3D UART01x_RSR_OE; if (termios->c_iflag & INPCK) - uap->port.read_status_mask |=3D UART01x_RSR_FE | UART01x_RSR_PE; + port->read_status_mask |=3D UART01x_RSR_FE | UART01x_RSR_PE; if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) - uap->port.read_status_mask |=3D UART01x_RSR_BE; + port->read_status_mask |=3D UART01x_RSR_BE; =20 /* * Characters to ignore */ - uap->port.ignore_status_mask =3D 0; + port->ignore_status_mask =3D 0; if (termios->c_iflag & IGNPAR) - uap->port.ignore_status_mask |=3D UART01x_RSR_FE | UART01x_RSR_PE; + port->ignore_status_mask |=3D UART01x_RSR_FE | UART01x_RSR_PE; if (termios->c_iflag & IGNBRK) { - uap->port.ignore_status_mask |=3D UART01x_RSR_BE; + port->ignore_status_mask |=3D UART01x_RSR_BE; /* * If we're ignoring parity and break indicators, * ignore overruns too (for real raw support). */ if (termios->c_iflag & IGNPAR) - uap->port.ignore_status_mask |=3D UART01x_RSR_OE; + port->ignore_status_mask |=3D UART01x_RSR_OE; } =20 /* * Ignore all characters if CREAD is not set. */ if ((termios->c_cflag & CREAD) =3D=3D 0) - uap->port.ignore_status_mask |=3D UART_DUMMY_RSR_RX; + port->ignore_status_mask |=3D UART_DUMMY_RSR_RX; =20 - old_cr =3D readb(uap->port.membase + UART010_CR) & ~UART010_CR_MSIE; + old_cr =3D readb(port->membase + UART010_CR) & ~UART010_CR_MSIE; =20 if (UART_ENABLE_MS(port, termios->c_cflag)) old_cr |=3D UART010_CR_MSIE; =20 /* Set baud rate */ quot -=3D 1; - writel((quot & 0xf00) >> 8, uap->port.membase + UART010_LCRM); - writel(quot & 0xff, uap->port.membase + UART010_LCRL); + writel((quot & 0xf00) >> 8, port->membase + UART010_LCRM); + writel(quot & 0xff, port->membase + UART010_LCRL); =20 /* * ----------v----------v----------v----------v----- * NOTE: MUST BE WRITTEN AFTER UARTLCR_M & UARTLCR_L * ----------^----------^----------^----------^----- */ - writel(lcr_h, uap->port.membase + UART010_LCRH); - writel(old_cr, uap->port.membase + UART010_CR); + writel(lcr_h, port->membase + UART010_LCRH); + writel(old_cr, port->membase + UART010_CR); =20 - spin_unlock_irqrestore(&uap->port.lock, flags); + spin_unlock_irqrestore(&port->lock, flags); } =20 static void pl010_set_ldisc(struct uart_port *port, struct ktermios *termi= os) @@ -558,21 +553,20 @@ static struct uart_amba_port *amba_ports[UART_NR]; =20 static void pl010_console_putchar(struct uart_port *port, unsigned char ch) { - struct uart_amba_port *uap =3D - container_of(port, struct uart_amba_port, port); unsigned int status; =20 do { - status =3D readb(uap->port.membase + UART01x_FR); + status =3D readb(port->membase + UART01x_FR); barrier(); } while (!UART_TX_READY(status)); - writel(ch, uap->port.membase + UART01x_DR); + writel(ch, port->membase + UART01x_DR); } =20 static void pl010_console_write(struct console *co, const char *s, unsigned int count) { struct uart_amba_port *uap =3D amba_ports[co->index]; + struct uart_port *port =3D &uap->port; unsigned int status, old_cr; =20 clk_enable(uap->clk); @@ -580,20 +574,20 @@ pl010_console_write(struct console *co, const char *s= , unsigned int count) /* * First save the CR then disable the interrupts */ - old_cr =3D readb(uap->port.membase + UART010_CR); - writel(UART01x_CR_UARTEN, uap->port.membase + UART010_CR); + old_cr =3D readb(port->membase + UART010_CR); + writel(UART01x_CR_UARTEN, port->membase + UART010_CR); =20 - uart_console_write(&uap->port, s, count, pl010_console_putchar); + uart_console_write(port, s, count, pl010_console_putchar); =20 /* * Finally, wait for transmitter to become empty * and restore the TCR */ do { - status =3D readb(uap->port.membase + UART01x_FR); + status =3D readb(port->membase + UART01x_FR); barrier(); } while (status & UART01x_FR_BUSY); - writel(old_cr, uap->port.membase + UART010_CR); + writel(old_cr, port->membase + UART010_CR); =20 clk_disable(uap->clk); } --=20 2.35.1 From nobody Tue Jun 23 23:41:51 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 2B98BC433EF for ; Thu, 24 Feb 2022 11:10:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232133AbiBXLLW (ORCPT ); Thu, 24 Feb 2022 06:11:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233847AbiBXLLM (ORCPT ); Thu, 24 Feb 2022 06:11:12 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D5DE2905A8; Thu, 24 Feb 2022 03:10:31 -0800 (PST) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 4CE5B212B9; Thu, 24 Feb 2022 11:10:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1645701030; 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=xYvxaPxtmjrawievgZ8Raha0WUh7vamBwY35Qyu7N4c=; b=qSbXQL4u2oexw2Z3Dp+u+fai3BkFB00Z7oBpzHmQe9y2qeMsTkrPWkaQzG0N+ezzghFQqz Vz88L7/28/d1aK2FgQexcVlGsAsEZR2ZqTM5/kda4mnAI9mW+CdbPAe6rPK/1J71ZKSa5F BT4HUfPVoEILlja6aAEJAnDHoQzJWu4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1645701030; 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=xYvxaPxtmjrawievgZ8Raha0WUh7vamBwY35Qyu7N4c=; b=m+eKHrWZTWz4vtDIdXaXSxWEZSnznk+yiv0piNZ4Ty/N8l3dM2b6OskubXdvh4M99hhsmU YK1WEoz0BHRpZrAQ== 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 1D3EEA3B90; Thu, 24 Feb 2022 11:10:30 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby , Vladimir Zapolskiy , linux-arm-kernel@lists.infradead.org Subject: [PATCH 5/5] tty: serial: lpc32xx_hs: use serial_lpc32xx_stop_tx() helper Date: Thu, 24 Feb 2022 12:10:28 +0100 Message-Id: <20220224111028.20917-6-jslaby@suse.cz> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220224111028.20917-1-jslaby@suse.cz> References: <20220224111028.20917-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" Instead of open-coding what serial_lpc32xx_stop_tx() already does, call it in __serial_lpc32xx_tx() directly. Signed-off-by: Jiri Slaby Cc: Vladimir Zapolskiy Cc: linux-arm-kernel@lists.infradead.org --- drivers/tty/serial/lpc32xx_hs.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/tty/serial/lpc32xx_hs.c b/drivers/tty/serial/lpc32xx_h= s.c index b7b489c68c36..93140cac1ca1 100644 --- a/drivers/tty/serial/lpc32xx_hs.c +++ b/drivers/tty/serial/lpc32xx_hs.c @@ -276,10 +276,11 @@ static void __serial_lpc32xx_rx(struct uart_port *por= t) tty_flip_buffer_push(tport); } =20 +static void serial_lpc32xx_stop_tx(struct uart_port *port); + static void __serial_lpc32xx_tx(struct uart_port *port) { struct circ_buf *xmit =3D &port->state->xmit; - unsigned int tmp; =20 if (port->x_char) { writel((u32)port->x_char, LPC32XX_HSUART_FIFO(port->membase)); @@ -306,11 +307,8 @@ static void __serial_lpc32xx_tx(struct uart_port *port) uart_write_wakeup(port); =20 exit_tx: - if (uart_circ_empty(xmit)) { - tmp =3D readl(LPC32XX_HSUART_CTRL(port->membase)); - tmp &=3D ~LPC32XX_HSU_TX_INT_EN; - writel(tmp, LPC32XX_HSUART_CTRL(port->membase)); - } + if (uart_circ_empty(xmit)) + serial_lpc32xx_stop_tx(port); } =20 static irqreturn_t serial_lpc32xx_interrupt(int irq, void *dev_id) --=20 2.35.1