Re: [PATCH 3/3] usb console,usb-serial: pass initial console baud on to first tty open

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 17 Sep 2009 14:08:28 +0100
Alan Cox <alan@xxxxxxxxxxxxxxxxxxx> wrote:

> 
> > -			memset(&dummy, 0, sizeof(struct ktermios));
> > -			tty->termios = termios;
> > +			tty->termios = &usb_serial_tty_driver->init_termios;
> 
> That will corrupt the master one which is a reference used for many ports.
> 
> 
> You need the serial_install stuff or something similar resurrecting to do
> this properly.

Here's a suggestion on how to do it.

Add a tty->ops->init_termios()

Make tty_init_termios() read

       if (tp == NULL) {
                tp = kzalloc(sizeof(struct ktermios[2]), GFP_KERNEL);
                if (tp == NULL)
                        return -ENOMEM;
                memcpy(tp, &tty->driver->init_termios,
                                                sizeof(struct ktermios));
		if (tty->ops->init_termios)
			tty->ops->init_termios(tty);
                tty->driver->termios[idx] = tp;
        }

Thats a good deal cleaner than the ->install override in the USB patches
Greg inherited and will be usable for cleaning up USB stuff too.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux