Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1259173 > unrolled thread

[PATCH v3 0/3] serial: 8250_early: simplify serial_putc()

Started byMasahiro Yamada <yamada.masahiro@socionext.com>
First post2015-10-30 03:40 +0100
Last post2015-10-30 14:50 +0100
Articles 4 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v3 0/3] serial: 8250_early: simplify serial_putc() Masahiro Yamada <yamada.masahiro@socionext.com> - 2015-10-30 03:40 +0100
    [PATCH v3 1/3] serial: 8250_early: do not save and restore IER in write callback Masahiro Yamada <yamada.masahiro@socionext.com> - 2015-10-30 03:40 +0100
    [PATCH v3 3/3] serial: 8250_early: squash wait_for_xmitr() into serial_putc() Masahiro Yamada <yamada.masahiro@socionext.com> - 2015-10-30 03:40 +0100
    Re: [PATCH v3 0/3] serial: 8250_early: simplify serial_putc() Peter Hurley <peter@hurleysoftware.com> - 2015-10-30 14:50 +0100

#1259173 — [PATCH v3 0/3] serial: 8250_early: simplify serial_putc()

FromMasahiro Yamada <yamada.masahiro@socionext.com>
Date2015-10-30 03:40 +0100
Subject[PATCH v3 0/3] serial: 8250_early: simplify serial_putc()
Message-ID<qp7LH-8qM-5@gated-at.bofh.it>

Changes in v3:
  - Split into three patches.
  - Confirm the empty TX only after sending each character.

Changes in v2:
  - split into two patches

Masahiro Yamada (3):
  serial: 8250_early: do not save and restore IER in write callback
  serial: 8250_early: confirm empty transmitter after sending characters
  serial: 8250_early: squash wait_for_xmitr() into serial_putc()

 drivers/tty/serial/8250/8250_early.c | 24 ++++--------------------
 1 file changed, 4 insertions(+), 20 deletions(-)

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1259174 — [PATCH v3 1/3] serial: 8250_early: do not save and restore IER in write callback

FromMasahiro Yamada <yamada.masahiro@socionext.com>
Date2015-10-30 03:40 +0100
Subject[PATCH v3 1/3] serial: 8250_early: do not save and restore IER in write callback
Message-ID<qp7LI-8qM-17@gated-at.bofh.it>
In reply to#1259173
The IER has already been masked in early_serial8250_setup(), there is
no reason to save and restore it every time early_serial8250_write()
is called.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/tty/serial/8250/8250_early.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_early.c b/drivers/tty/serial/8250/8250_early.c
index 7aff3d8..23c322f 100644
--- a/drivers/tty/serial/8250/8250_early.c
+++ b/drivers/tty/serial/8250/8250_early.c
@@ -99,20 +99,11 @@ static void __init early_serial8250_write(struct console *console,
 {
 	struct earlycon_device *device = console->data;
 	struct uart_port *port = &device->port;
-	unsigned int ier;
-
-	/* Save the IER and disable interrupts preserving the UUE bit */
-	ier = serial8250_early_in(port, UART_IER);
-	if (ier)
-		serial8250_early_out(port, UART_IER, ier & UART_IER_UUE);
 
 	uart_console_write(port, s, count, serial_putc);
 
-	/* Wait for transmitter to become empty and restore the IER */
+	/* Wait for transmitter to become empty */
 	wait_for_xmitr(port);
-
-	if (ier)
-		serial8250_early_out(port, UART_IER, ier);
 }
 
 static void __init init_port(struct earlycon_device *device)
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1259176 — [PATCH v3 3/3] serial: 8250_early: squash wait_for_xmitr() into serial_putc()

FromMasahiro Yamada <yamada.masahiro@socionext.com>
Date2015-10-30 03:40 +0100
Subject[PATCH v3 3/3] serial: 8250_early: squash wait_for_xmitr() into serial_putc()
Message-ID<qp7LI-8qM-23@gated-at.bofh.it>
In reply to#1259173
Now, wait_for_xmitr() is only called from serial_putc(), and both
are short enough.  They can be merged into a single function.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/tty/serial/8250/8250_early.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_early.c b/drivers/tty/serial/8250/8250_early.c
index 0b65a26..f9e25ed 100644
--- a/drivers/tty/serial/8250/8250_early.c
+++ b/drivers/tty/serial/8250/8250_early.c
@@ -76,24 +76,20 @@ static void __init serial8250_early_out(struct uart_port *port, int offset, int
 
 #define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
 
-static void __init wait_for_xmitr(struct uart_port *port)
+static void __init serial_putc(struct uart_port *port, int c)
 {
 	unsigned int status;
 
+	serial8250_early_out(port, UART_TX, c);
+
 	for (;;) {
 		status = serial8250_early_in(port, UART_LSR);
 		if ((status & BOTH_EMPTY) == BOTH_EMPTY)
-			return;
+			break;
 		cpu_relax();
 	}
 }
 
-static void __init serial_putc(struct uart_port *port, int c)
-{
-	serial8250_early_out(port, UART_TX, c);
-	wait_for_xmitr(port);
-}
-
 static void __init early_serial8250_write(struct console *console,
 					const char *s, unsigned int count)
 {
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1259500

FromPeter Hurley <peter@hurleysoftware.com>
Date2015-10-30 14:50 +0100
Message-ID<qpie5-6qe-13@gated-at.bofh.it>
In reply to#1259173
On 10/29/2015 10:39 PM, Masahiro Yamada wrote:
> Changes in v3:
>    - Split into three patches.
>    - Confirm the empty TX only after sending each character.
>
> Changes in v2:
>    - split into two patches
>
> Masahiro Yamada (3):
>    serial: 8250_early: do not save and restore IER in write callback
>    serial: 8250_early: confirm empty transmitter after sending characters
>    serial: 8250_early: squash wait_for_xmitr() into serial_putc()
>
>   drivers/tty/serial/8250/8250_early.c | 24 ++++--------------------
>   1 file changed, 4 insertions(+), 20 deletions(-)

For series

Reviewed-by: Peter Hurley <peter@hurleysoftware.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web