public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jisheng Zhang <jszhang@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
	linux-riscv@lists.infradead.org
Subject: [PATCH] serial: 8250: don't lost port's default capabilities
Date: Sat,  6 Jul 2024 16:29:28 +0800	[thread overview]
Message-ID: <20240706082928.2238-1-jszhang@kernel.org> (raw)

Commit b0b8c84cf58d ("serial: of_serial: Handle auto-flow-control
property") added support for fifo-size and hw-flow-control properties
to avoid adding new types to 8250.c for UARTs that are compatible with
the standard types but that have different size fifo or support 16750
compatible auto flow control. We avoided many new 8250 port types with
this nice feature, but there's a problem, if the code detects fifo-size
or auto-flow-control property, up->capabilities will be set
accordingly, then serial8250_set_defaults() will ignore the default
port's capabilities:

|if (!up->capabilities)
|	up->capabilities = uart_config[type].flags;

If the port's default capabilities contains other bits such as
UART_CAP_SLEEP, UART_CAP_EFR and so on, they are lost.

Fixes: b0b8c84cf58d ("serial: of_serial: Handle auto-flow-control property")
Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
---
 drivers/tty/serial/8250/8250_port.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index 893bc493f662..e20614241229 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -3245,8 +3245,7 @@ void serial8250_set_defaults(struct uart_8250_port *up)
 			up->port.fifosize = uart_config[type].fifo_size;
 		if (!up->tx_loadsz)
 			up->tx_loadsz = uart_config[type].tx_loadsz;
-		if (!up->capabilities)
-			up->capabilities = uart_config[type].flags;
+		up->capabilities |= uart_config[type].flags;
 	}
 
 	set_io_from_upio(port);
-- 
2.43.0


             reply	other threads:[~2024-07-06  8:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-06  8:29 Jisheng Zhang [this message]
2024-07-06  9:02 ` [PATCH] serial: 8250: don't lost port's default capabilities Greg Kroah-Hartman
2024-07-06 14:05 ` Yixun Lan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240706082928.2238-1-jszhang@kernel.org \
    --to=jszhang@kernel.org \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-serial@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox