Re: what serial driver restructure is planned?

From: Rogier Wolff (R.E.Wolff@BitWizard.nl)
Date: Tue Feb 12 2002 - 05:38:37 EST


Alan Cox wrote:
> > Could we also have an interface to serial devices which bypass the tty
> > layer? Ie a /dev/ttyraw* which just speaks to the serial port without
> > going through the labyrinthine tty layers?
>
> You've got one
>
> > 9 times out of 10 when I reach for /dev/ttyS* that is all I want and
> > the tty layer is just wasteful and gets in the way of a conceptually
> > very simple device.
>
> The only bits of the tty layer being used in raw data passing is the same
> buffer management logic you would need anyway. In short - the perceived
> waste is simply not there

IMHO, the main waste is "in the drivers".

A serial driver restructuring should have a simple driver just be
"pass a character to the hardware" and "get a character from the
hardware" as well as "read/write modem control" register. (And the
driver would be requested to call a "modem status changed, please
ask me what the new status is").

That way you can build a working serial driver in under 100 lines of
code.

Now most advanced serial drivers would want to also provide "pass a
bunch of characters to the hardware" routine. By default that would
just be a routine that calls the output one char function
repeatedly. But hardware with a larger buffer can really benefit from
the block-move.

All "tty-layer" things should then move out of the driver. For
instance: no calling of "hangup" if the flags allow that: The driver
should report that DCD went down, and then something generic should in
one place decide wether or not to call "hangup" (i.e. send the hangup
signal).

If someone wires "DCD" to "TXD", and then uses the port in CLOCAL, we
will call the "DCD changed" function WAY too often. But that is just
stupid. Let's not create a stupid architecture because it will be
inefficient in a stupid case.

        Roger.

-- 
** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2137555 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
* There are old pilots, and there are bold pilots. 
* There are also old, bald pilots. 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Feb 15 2002 - 21:00:48 EST