design-question serial-driver + predefined ldisc - Nuber

Michael Westermann (mw@microdata-pos.de)
Tue, 8 Aug 2000 14:29:20 +0200


Hallo,

I hav a projekt for POS-Systeme with a few driver's that
all use a protokoll over the serial device.
I think it is a goo idea when i use the ldisc mechanism
from the tty driver.

My problem is that the ldiscs array in tty_io.c is static
predefined. I have 3 to 10 protokoll's over this mechnism.

I think it is a good idea, to create a dynamic part on the ldiscs
structure.

My idea for a changed tty_register_ldisc funktion.

int tty_register_ldisc(int disc, struct tty_ldisc *new_ldisc)
{
if (disc < N_TTY || disc >= NR_LDISCS)
return -EINVAL;

if (disc == N_LDDYN)
if ((disc = get_free_ldisc()) < 0)
return -EINVAL;

if (new_ldisc) {
.....
return (disc > N_NDDYN) ? disc : 0;
} else {
if (disc > N_LDDYN) set_free_ldisc(disc);
memset(&ldiscs[disc], 0, sizeof(struct tty_ldisc));
return 0;
}
}

Comments ?

Renegard's

Michael Westermann

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