Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1305817 > unrolled thread
| Started by | Peter Hurley <peter@hurleysoftware.com> |
|---|---|
| First post | 2016-01-11 05:30 +0100 |
| Last post | 2016-01-11 05:30 +0100 |
| Articles | 6 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH v2 0/8] Misc serial cleanups Peter Hurley <peter@hurleysoftware.com> - 2016-01-11 05:30 +0100
[PATCH v2 5/8] serial: core: Cleanup uart_open() exit Peter Hurley <peter@hurleysoftware.com> - 2016-01-11 05:30 +0100
[PATCH v2 2/8] serial: core: Fold do_uart_get_info() into caller Peter Hurley <peter@hurleysoftware.com> - 2016-01-11 05:30 +0100
[PATCH v2 1/8] serial: core: Fold __uart_put_char() into caller Peter Hurley <peter@hurleysoftware.com> - 2016-01-11 05:30 +0100
[PATCH v2 8/8] serial: core: Perform RTS signalling before soft flow ctrl Peter Hurley <peter@hurleysoftware.com> - 2016-01-11 05:30 +0100
[PATCH v2 7/8] serial: core: Unfold < 80 char lines Peter Hurley <peter@hurleysoftware.com> - 2016-01-11 05:30 +0100
| From | Peter Hurley <peter@hurleysoftware.com> |
|---|---|
| Date | 2016-01-11 05:30 +0100 |
| Subject | [PATCH v2 0/8] Misc serial cleanups |
| Message-ID | <qPChc-5Gm-13@gated-at.bofh.it> |
Hi Greg, Apologies for the earlier mixed series; this is the proper series. This series contains accumulated cleanups for the serial core. Several of these patches were in earlier series that were not applied so I split the simpler ones into this series to form a basis for follow-on series (especially the "Fix unsafe uart port access" series and another that addresses the tty_port->flags problem). Regards, Regards, Peter Hurley (8): serial: core: Fold __uart_put_char() into caller serial: core: Fold do_uart_get_info() into caller serial: core: Use tty->index for port # in debug messages serial: Fix ASYNC_* => UPF_* flags misuse serial: core: Cleanup uart_open() exit serial: core: Remove cast from void ptr in uart_open() serial: core: Unfold < 80 char lines serial: core: Perform RTS signalling before soft flow ctrl arch/alpha/include/asm/serial.h | 8 ++-- arch/frv/include/asm/serial.h | 2 +- arch/m68k/include/asm/serial.h | 8 ++-- arch/mips/pmcs-msp71xx/msp_serial.c | 2 +- arch/mn10300/include/asm/serial.h | 10 ++--- arch/xtensa/platforms/xt2000/setup.c | 2 +- drivers/tty/serial/serial_core.c | 71 ++++++++++++++---------------------- drivers/tty/serial/serial_ks8695.c | 2 +- 8 files changed, 44 insertions(+), 61 deletions(-) -- 2.7.0
[toc] | [next] | [standalone]
| From | Peter Hurley <peter@hurleysoftware.com> |
|---|---|
| Date | 2016-01-11 05:30 +0100 |
| Subject | [PATCH v2 5/8] serial: core: Cleanup uart_open() exit |
| Message-ID | <qPChe-5Gm-45@gated-at.bofh.it> |
| In reply to | #1305817 |
If aborting uart_open() unsuccessfully, retval is non-zero, so the existing fall-through exit is equivalent. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> --- drivers/tty/serial/serial_core.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index f8c28a7..f77be14 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -1622,15 +1622,12 @@ static int uart_open(struct tty_struct *tty, struct file *filp) /* * If we succeeded, wait until the port is ready. */ +err_unlock: mutex_unlock(&port->mutex); if (retval == 0) retval = tty_port_block_til_ready(port, tty, filp); - end: return retval; -err_unlock: - mutex_unlock(&port->mutex); - goto end; } static const char *uart_type(struct uart_port *port) -- 2.7.0
[toc] | [prev] | [next] | [standalone]
| From | Peter Hurley <peter@hurleysoftware.com> |
|---|---|
| Date | 2016-01-11 05:30 +0100 |
| Subject | [PATCH v2 2/8] serial: core: Fold do_uart_get_info() into caller |
| Message-ID | <qPChe-5Gm-47@gated-at.bofh.it> |
| In reply to | #1305817 |
do_uart_get_info() has a single caller: uart_get_info().
Manually inline do_uart_get_info().
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
---
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_core.c
index 048b175..6dfb583 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -671,14 +671,18 @@ static void uart_unthrottle(struct tty_struct *tty)
uart_set_mctrl(port, TIOCM_RTS);
}
-static void do_uart_get_info(struct tty_port *port,
- struct serial_struct *retinfo)
+static void uart_get_info(struct tty_port *port, struct serial_struct *retinfo)
{
struct uart_state *state = container_of(port, struct uart_state, port);
struct uart_port *uport = state->uart_port;
memset(retinfo, 0, sizeof(*retinfo));
+ /*
+ * Ensure the state we copy is consistent and no hardware changes
+ * occur as we go
+ */
+ mutex_lock(&port->mutex);
retinfo->type = uport->type;
retinfo->line = uport->line;
retinfo->port = uport->iobase;
@@ -697,15 +701,6 @@ static void do_uart_get_info(struct tty_port *port,
retinfo->io_type = uport->iotype;
retinfo->iomem_reg_shift = uport->regshift;
retinfo->iomem_base = (void *)(unsigned long)uport->mapbase;
-}
-
-static void uart_get_info(struct tty_port *port,
- struct serial_struct *retinfo)
-{
- /* Ensure the state we copy is consistent and no hardware changes
- occur as we go */
- mutex_lock(&port->mutex);
- do_uart_get_info(port, retinfo);
mutex_unlock(&port->mutex);
}
@@ -713,6 +708,7 @@ static int uart_get_info_user(struct tty_port *port,
struct serial_struct __user *retinfo)
{
struct serial_struct tmp;
+
uart_get_info(port, &tmp);
if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
--
2.7.0
[toc] | [prev] | [next] | [standalone]
| From | Peter Hurley <peter@hurleysoftware.com> |
|---|---|
| Date | 2016-01-11 05:30 +0100 |
| Subject | [PATCH v2 1/8] serial: core: Fold __uart_put_char() into caller |
| Message-ID | <qPChe-5Gm-51@gated-at.bofh.it> |
| In reply to | #1305817 |
uart_put_char() is the required interface; manually inline
__uart_put_char().
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
---
drivers/tty/serial/serial_core.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 3698ada..048b175 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -483,12 +483,15 @@ static void uart_change_speed(struct tty_struct *tty, struct uart_state *state,
spin_unlock_irq(&uport->lock);
}
-static inline int __uart_put_char(struct uart_port *port,
- struct circ_buf *circ, unsigned char c)
+static int uart_put_char(struct tty_struct *tty, unsigned char c)
{
+ struct uart_state *state = tty->driver_data;
+ struct uart_port *port = state->uart_port;
+ struct circ_buf *circ;
unsigned long flags;
int ret = 0;
+ circ = &state->xmit;
if (!circ->buf)
return 0;
@@ -502,13 +505,6 @@ static inline int __uart_put_char(struct uart_port *port,
return ret;
}
-static int uart_put_char(struct tty_struct *tty, unsigned char ch)
-{
- struct uart_state *state = tty->driver_data;
-
- return __uart_put_char(state->uart_port, &state->xmit, ch);
-}
-
static void uart_flush_chars(struct tty_struct *tty)
{
uart_start(tty);
--
2.7.0
[toc] | [prev] | [next] | [standalone]
| From | Peter Hurley <peter@hurleysoftware.com> |
|---|---|
| Date | 2016-01-11 05:30 +0100 |
| Subject | [PATCH v2 8/8] serial: core: Perform RTS signalling before soft flow ctrl |
| Message-ID | <qPChe-5Gm-49@gated-at.bofh.it> |
| In reply to | #1305817 |
When throttling, time is of the essence; try RTS signalling before soft flow control, which will take longer. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> --- drivers/tty/serial/serial_core.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 3031982..0baa231 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -641,11 +641,11 @@ static void uart_throttle(struct tty_struct *tty) mask &= ~port->status; } - if (mask & UPSTAT_AUTOXOFF) - uart_send_xchar(tty, STOP_CHAR(tty)); - if (mask & UPSTAT_AUTORTS) uart_clear_mctrl(port, TIOCM_RTS); + + if (mask & UPSTAT_AUTOXOFF) + uart_send_xchar(tty, STOP_CHAR(tty)); } static void uart_unthrottle(struct tty_struct *tty) @@ -664,11 +664,11 @@ static void uart_unthrottle(struct tty_struct *tty) mask &= ~port->status; } - if (mask & UPSTAT_AUTOXOFF) - uart_send_xchar(tty, START_CHAR(tty)); - if (mask & UPSTAT_AUTORTS) uart_set_mctrl(port, TIOCM_RTS); + + if (mask & UPSTAT_AUTOXOFF) + uart_send_xchar(tty, START_CHAR(tty)); } static void uart_get_info(struct tty_port *port, struct serial_struct *retinfo) -- 2.7.0
[toc] | [prev] | [next] | [standalone]
| From | Peter Hurley <peter@hurleysoftware.com> |
|---|---|
| Date | 2016-01-11 05:30 +0100 |
| Subject | [PATCH v2 7/8] serial: core: Unfold < 80 char lines |
| Message-ID | <qPChe-5Gm-55@gated-at.bofh.it> |
| In reply to | #1305817 |
Signed-off-by: Peter Hurley <peter@hurleysoftware.com> --- drivers/tty/serial/serial_core.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 530b892..3031982 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -1686,17 +1686,13 @@ static void uart_line_info(struct seq_file *m, struct uart_driver *drv, int i) seq_printf(m, " tx:%d rx:%d", uport->icount.tx, uport->icount.rx); if (uport->icount.frame) - seq_printf(m, " fe:%d", - uport->icount.frame); + seq_printf(m, " fe:%d", uport->icount.frame); if (uport->icount.parity) - seq_printf(m, " pe:%d", - uport->icount.parity); + seq_printf(m, " pe:%d", uport->icount.parity); if (uport->icount.brk) - seq_printf(m, " brk:%d", - uport->icount.brk); + seq_printf(m, " brk:%d", uport->icount.brk); if (uport->icount.overrun) - seq_printf(m, " oe:%d", - uport->icount.overrun); + seq_printf(m, " oe:%d", uport->icount.overrun); #define INFOBIT(bit, str) \ if (uport->mctrl & (bit)) \ @@ -1731,8 +1727,7 @@ static int uart_proc_show(struct seq_file *m, void *v) struct uart_driver *drv = ttydrv->driver_state; int i; - seq_printf(m, "serinfo:1.0 driver%s%s revision:%s\n", - "", "", ""); + seq_printf(m, "serinfo:1.0 driver%s%s revision:%s\n", "", "", ""); for (i = 0; i < drv->nr; i++) uart_line_info(m, drv, i); return 0; -- 2.7.0
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web