drivers:usb:serial:ftdi_sio.c: ftdi_set_termios make no sense some in a situation
Subsystems (2)
PATCH 1/1 drivers:usb:serial:ftdi_sio.c: ftdi_set_termios make no sense some in a situation
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.
--- drivers/usb/serial/ftdi_sio.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-)
drivers/usb/serial/ftdi_sio.c +8 -2
@@ -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 */
Signature · 1 line
1.7.3.4
Alan Cox
NAKQuoted 15 lines · On Mon, 5 Dec 2011 15:47:30 +0800 wangyanqing <[email protected]> wrote:
b1ffb4c851f185e9051ba837c16d9b84ef688d26make a improvement to drop no sense reset termios. But it miss the situation, when callftdi_set_termioswith the value that same with the default settings all the time, then termios will take no effect any way, we needusb_control_msgto make effect. This patch try to resolve this question.Signed-off-by Wang YanQing <[email protected]>--- drivers/usb/serial/ftdi_sio.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-)drivers/usb/serial/ftdi_sio.c +0
-0
drivers/usb/serial/ftdi_sio.c static void ftdi_set_termios(struct tty_struct *tty, · line 2059
Quoted 4 lines
drivers/usb/serial/ftdi_sio.c +1
-0@@ -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 ;
NACK
Think about what happens if you have two such ports or remove and re-add it.
What code path is calling set_termios passing a termios data which has never been set ?
Alan
Quoted 5 lines · Alan Cox
NACK
Think about what happens if you have two such ports or remove and re-add it.
Alan, you are right! Thanks
Quoted 4 lines
What code path is calling
set_termiospassing a termios data which has never been set ?Alan
The question I meet is my usb-convertor base on FT232RL doesn't work, but it works well if I revert b1ffb4c851f185e9051ba837c16d9b84ef688d26.It seems that I should dig deeper.