* [PATCH] serial: fix termios settings in open
@ 2010-06-29 20:31 Arnd Bergmann
2010-07-07 21:38 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2010-06-29 20:31 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-kernel, Arnd Bergmann, Alan Cox, Tony Luck
Move termios initialization in open into uart_dtr_rts to make sure
it always gets called when necessary. Based on a suggestion from
Alan Cox.
Alan writes:
Ok this sort of makes sense. Something isn't getting initialised and both
getty and minicom will do a termios set which is sorting it out.
This is occurring because the generic block_til_ready sets
ASYNCB_NORMAL_ACTIVE so the termios updating gets skipped.
This patch should cure it and then we can think about doing it more
elegantly by getting the serial layer to use tty_port_open, kfifo and
the like and removing the tons of repeated crap in all the drivers.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reported-by: Tony Luck <tony.luck@intel.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Tony Luck <tony.luck@intel.com>
---
Greg, please apply to you tty series. I thought there was a bug
in this patch but it turns out that this was incorrect. There
is still something fishy on my system with hardware flow control,
but it seems to be a preexisting condition, so this patch is actually
good, unlike what I said before. Please apply next to "serial: Use
block_til_ready helper", which introduces the ploblem.
drivers/serial/serial_core.c | 19 +++++++++----------
1 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index 78b1eac..cd85112 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -1533,8 +1533,16 @@ static void uart_dtr_rts(struct tty_port *port, int onoff)
struct uart_state *state = container_of(port, struct uart_state, port);
struct uart_port *uport = state->uart_port;
- if (onoff)
+ if (onoff) {
uart_set_mctrl(uport, TIOCM_DTR | TIOCM_RTS);
+
+ /*
+ * If this is the first open to succeed,
+ * adjust things to suit.
+ */
+ if (!test_and_set_bit(ASYNCB_NORMAL_ACTIVE, &port->flags))
+ uart_update_termios(port->tty, state);
+ }
else
uart_clear_mctrl(uport, TIOCM_DTR | TIOCM_RTS);
}
@@ -1649,15 +1657,6 @@ static int uart_open(struct tty_struct *tty, struct file *filp)
if (retval == 0)
retval = tty_port_block_til_ready(port, tty, filp);
- /*
- * If this is the first open to succeed, adjust things to suit.
- */
- if (retval == 0 && !(port->flags & ASYNC_NORMAL_ACTIVE)) {
- set_bit(ASYNCB_NORMAL_ACTIVE, &port->flags);
-
- uart_update_termios(tty, state);
- }
-
fail:
return retval;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] serial: fix termios settings in open
2010-06-29 20:31 [PATCH] serial: fix termios settings in open Arnd Bergmann
@ 2010-07-07 21:38 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2010-07-07 21:38 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: Greg Kroah-Hartman, linux-kernel, Alan Cox, Tony Luck
On Tue, Jun 29, 2010 at 10:31:40PM +0200, Arnd Bergmann wrote:
> Move termios initialization in open into uart_dtr_rts to make sure
> it always gets called when necessary. Based on a suggestion from
> Alan Cox.
>
> Alan writes:
> Ok this sort of makes sense. Something isn't getting initialised and both
> getty and minicom will do a termios set which is sorting it out.
> This is occurring because the generic block_til_ready sets
> ASYNCB_NORMAL_ACTIVE so the termios updating gets skipped.
>
> This patch should cure it and then we can think about doing it more
> elegantly by getting the serial layer to use tty_port_open, kfifo and
> the like and removing the tons of repeated crap in all the drivers.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Reported-by: Tony Luck <tony.luck@intel.com>
> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
> Cc: Tony Luck <tony.luck@intel.com>
> ---
>
> Greg, please apply to you tty series. I thought there was a bug
> in this patch but it turns out that this was incorrect. There
> is still something fishy on my system with hardware flow control,
> but it seems to be a preexisting condition, so this patch is actually
> good, unlike what I said before. Please apply next to "serial: Use
> block_til_ready helper", which introduces the ploblem.
Now applied, thanks.
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-07-07 21:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-29 20:31 [PATCH] serial: fix termios settings in open Arnd Bergmann
2010-07-07 21:38 ` Greg KH
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).