Re: new locking in change_termios breaks USB serial drivers

From: Alan Cox
Date: Fri Oct 01 2004 - 11:53:15 EST


On Gwe, 2004-10-01 at 17:24, Al Borchers wrote:
> Its a design decision for the tty layer. You should choose whatever is
> best there and the drivers will have to adapt.

>From a tty layer I don't think there is a motivation to enforce no
sleep. Hopefully nobody has a reason to need to fiddle with termios
data in their IRQ handlers ?

> To correctly support TCSETAW/TCSETSW the USB serial drivers would have to
> have two different versions of set_termios--a non sleeping one to be called

Providing the driver isnt sticking its nose into ->ioctl the tty layer
core already correctly handles TCSETAW for you because it uses
tty_wait_until_sent before issuing the change. You don't have to deal
with that providing you've implemented driver->chars_in_buffer, and
if neccessary ->wait_until_sent.

In a waiting case the driver will get

->chars_in_buffer
until it returns zero
->wait_until_sent
->change_termios

which serializes with respect to the one writer. If you have a writer
during a termios change by another well tough luck, you lose and I've
no intention of changing that behaviour unless someone cites a standard
requiring it.


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