LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org
Cc: Jiri Slaby <jirislaby@kernel.org>, Jay Dolan <jay.dolan@accesio.com>
Subject: [PATCH v2 3/3] serial: 8250_pericom: Use serial_dl_write() instead of open coded
Date: Mon, 22 Nov 2021 15:35:12 +0200	[thread overview]
Message-ID: <20211122133512.8947-4-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20211122133512.8947-1-andriy.shevchenko@linux.intel.com>

It's better to stick with standard API to write and read DL value
when the hardware is compatible with it. In case any quirks are
needed it may be easily added in one place rather than modifying
code here and there.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/tty/serial/8250/8250_pericom.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_pericom.c b/drivers/tty/serial/8250/8250_pericom.c
index f0d026325f17..025b055363c3 100644
--- a/drivers/tty/serial/8250/8250_pericom.c
+++ b/drivers/tty/serial/8250/8250_pericom.c
@@ -70,11 +70,11 @@ static void pericom_do_set_divisor(struct uart_port *port, unsigned int baud,
 		/* Update delta due to possible divisor change */
 		delta = maxrate / divisor - baud;
 		if (abs(delta) < baud / 50) {
+			struct uart_8250_port *up = up_to_u8250p(port);
 			int lcr = serial_port_in(port, UART_LCR);
 
 			serial_port_out(port, UART_LCR, lcr | 0x80);
-			serial_port_out(port, UART_DLL, divisor & 0xff);
-			serial_port_out(port, UART_DLM, (divisor >> 8) & 0xff);
+			serial_dl_write(up, divisor);
 			serial_port_out(port, 2, 16 - scr);
 			serial_port_out(port, UART_LCR, lcr);
 			return;
-- 
2.33.0


  parent reply	other threads:[~2021-11-22 13:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-22 13:35 [PATCH v2 0/3] serial: 8250_pci: Split Pericom driver Andy Shevchenko
2021-11-22 13:35 ` [PATCH v2 1/3] serial: 8250_pci: Split out " Andy Shevchenko
2021-11-22 13:35 ` [PATCH v2 2/3] serial: 8250_pericom: Re-enable higher baud rates Andy Shevchenko
2021-11-22 13:35 ` Andy Shevchenko [this message]
2021-11-23  5:27   ` [PATCH v2 3/3] serial: 8250_pericom: Use serial_dl_write() instead of open coded Jay Dolan
2021-11-23  9:00     ` Andy Shevchenko

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=20211122133512.8947-4-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jay.dolan@accesio.com \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --subject='Re: [PATCH v2 3/3] serial: 8250_pericom: Use serial_dl_write() instead of open coded' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).