Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1290512
| From | Peter Hurley <peter@hurleysoftware.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 2/8] serial: core: Fold do_uart_get_info() into caller |
| Date | 2015-12-13 01:40 +0100 |
| Message-ID | <qF2RJ-14v-29@gated-at.bofh.it> (permalink) |
| References | <qF2RH-14v-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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 321b45f..89b5ddd 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -673,14 +673,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;
@@ -699,15 +703,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);
}
@@ -715,6 +710,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.6.3
--
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/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/8] Fix unsafe uart port access Peter Hurley <peter@hurleysoftware.com> - 2015-12-13 01:40 +0100 [PATCH 4/8] serial: core: Take port mutex for send_xchar() tty method Peter Hurley <peter@hurleysoftware.com> - 2015-12-13 01:40 +0100 [PATCH 3/8] serial: core: Use tty->index for port # in debug messages Peter Hurley <peter@hurleysoftware.com> - 2015-12-13 01:40 +0100 [PATCH 1/8] serial: core: Fold __uart_put_char() into caller Peter Hurley <peter@hurleysoftware.com> - 2015-12-13 01:40 +0100 [PATCH 5/8] serial: core: Expand port mutex section in uart_poll_init() Peter Hurley <peter@hurleysoftware.com> - 2015-12-13 01:40 +0100 [PATCH 6/8] serial: core: Prevent unsafe uart port access, part 1 Peter Hurley <peter@hurleysoftware.com> - 2015-12-13 01:40 +0100 [PATCH 2/8] serial: core: Fold do_uart_get_info() into caller Peter Hurley <peter@hurleysoftware.com> - 2015-12-13 01:40 +0100 [PATCH 7/8] serial: core: Prevent unsafe uart port access, part 2 Peter Hurley <peter@hurleysoftware.com> - 2015-12-13 01:40 +0100
csiph-web