mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drivers:usb:serial:ftdi_sio.c: ftdi_set_termios make no sense some in a situation
@ 2011-12-05  7:47 wangyanqing
  2011-12-05 11:34 ` Alan Cox
  0 siblings, 1 reply; 3+ messages in thread
From: wangyanqing @ 2011-12-05  7:47 UTC (permalink / raw)
  To: gregkh; +Cc: amworsley, linux-kernel

b1ffb4c851f185e9051ba837c16d9b84ef688d26 make a improvement to drop no sense reset
termios. But it miss the situation, when call ftdi_set_termios with the value that
same with the default settings all the time, then termios will take no effect any way,
we need usb_control_msg to make effect. This patch try to resolve this question.

Signed-off-by: Wang YanQing <ukdnight@gmail.com>
---
 drivers/usb/serial/ftdi_sio.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 486769c..61f1be4 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -2056,6 +2056,7 @@ static void ftdi_set_termios(struct tty_struct *tty,
 	struct ktermios *termios = tty->termios;
 	unsigned int cflag = termios->c_cflag;
 	__u16 urb_value; /* will hold the new flags */
+	static int init_once = 1;
 
 	/* Added for xon/xoff support */
 	unsigned int iflag = termios->c_iflag;
@@ -2082,7 +2083,8 @@ static void ftdi_set_termios(struct tty_struct *tty,
 
 	if (old_termios->c_cflag == termios->c_cflag
 	    && old_termios->c_ispeed == termios->c_ispeed
-	    && old_termios->c_ospeed == termios->c_ospeed)
+	    && old_termios->c_ospeed == termios->c_ospeed
+	    && !init_once)
 		goto no_c_cflag_changes;
 
 	/* NOTE These routines can get interrupted by
@@ -2090,8 +2092,12 @@ static void ftdi_set_termios(struct tty_struct *tty,
 	   don't see any problems yet */
 
 	if ((old_termios->c_cflag & (CSIZE|PARODD|PARENB|CMSPAR|CSTOPB)) ==
-	    (termios->c_cflag & (CSIZE|PARODD|PARENB|CMSPAR|CSTOPB)))
+	    (termios->c_cflag & (CSIZE|PARODD|PARENB|CMSPAR|CSTOPB)) &&
+	    !init_once) {
 		goto no_data_parity_stop_changes;
+	} else {
+		init_once = 0;
+	}
 
 	/* Set number of data bits, parity, stop bits */
 
-- 
1.7.3.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-12-06  3:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-05  7:47 [PATCH] drivers:usb:serial:ftdi_sio.c: ftdi_set_termios make no sense some in a situation wangyanqing
2011-12-05 11:34 ` Alan Cox
2011-12-06  3:58   ` Wang YanQing

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®