On Fri, 2020-07-10 at 12:34 +0200, Greg KH wrote:
On Fri, Jul 10, 2020 at 11:35:18AM +0200, Joakim Tjernlund wrote:
BO will disable USB input until the device opens. This will avoid garbage chars waiting flood the TTY. This mimics a real UART device better. For initial termios to reach USB core, USB driver has to be registered before TTY driver.
You are doing two different things here, please break this up into 2 patches, with good documentation for both of them.
And any reason you didn't send this to the people listed in scripts/get_maintainers.pl when run on this patch?
Signed-off-by: Joakim Tjernlund joakim.tjernlund@infinera.com Cc: stable@vger.kernel.org
I hope this change makes sense to you, if so I belive ttyUSB could do the same.
drivers/usb/class/cdc-acm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 751f00285ee6..5680f71200e5 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -1999,19 +1999,19 @@ static int __init acm_init(void) acm_tty_driver->subtype = SERIAL_TYPE_NORMAL, acm_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; acm_tty_driver->init_termios = tty_std_termios;
acm_tty_driver->init_termios.c_cflag = B9600 | CS8 | CREAD |
acm_tty_driver->init_termios.c_cflag = B0 | CS8 | CREAD |
HUPCL | CLOCAL;
Huh? Are you sure this works?
Yes, sort of. I didn't see prehistory chars when changed to B0
tty_set_operations(acm_tty_driver, &acm_ops);
retval = tty_register_driver(acm_tty_driver);
retval = usb_register(&acm_driver);
if (retval) { put_tty_driver(acm_tty_driver); return retval; }
retval = usb_register(&acm_driver);
retval = tty_register_driver(acm_tty_driver);
if (retval) {
tty_unregister_driver(acm_tty_driver);
usb_deregister(&acm_driver);
Why are you switching these around? I think I know, but you don't really say...
I wrote: For initial termios to reach USB core, USB driver has to be registered before TTY driver. Found out that by trial and error. Isn't that clear enough?
I could change to: cdc-acm: acm_init: register USB before TTY driver
For initial termios to reach USB core, USB driver has to be registered before TTY driver.
and then just have that change: @@ -2003,15 +2003,15 @@ static int __init acm_init(void) HUPCL | CLOCAL; tty_set_operations(acm_tty_driver, &acm_ops);
- retval = tty_register_driver(acm_tty_driver); + retval = usb_register(&acm_driver); if (retval) { put_tty_driver(acm_tty_driver); return retval; }
- retval = usb_register(&acm_driver); + retval = tty_register_driver(acm_tty_driver); if (retval) { - tty_unregister_driver(acm_tty_driver); + usb_deregister(&acm_driver); put_tty_driver(acm_tty_driver); return retval; }