Messages in this thread | | | Date | Fri, 17 Oct 2008 12:40:04 +0100 | From | Alan Cox <> | Subject | Re: [PATCH 72/80] tty: fix up gigaset a bit |
| |
> > /* prevent other callers from entering ldisc methods */ > > + /* FIXME: should use the tty state flags */ > > tty->disc_data = NULL; > > > > if (!cs->hw.ser) > > Do you know of an example line discipline that has got this right? > My model for this code was drivers/net/ppp_async.c but now it seems > that this was not as exemplary as I had hoped.
If you want to know if the tty has been closed for further I/O then you can use test_bit(TTY_IO_ERROR, &tty->flags). This gets set at the right points on close/hangup/etc.
> > @@ -680,6 +675,8 @@ gigaset_tty_ioctl(struct tty_struct *tty, struct file *file, > > /* > > * Poll on the tty. > > * Unused, always return zero. > > + * > > + * FIXME: should probably return an exception - especially on hangup > > */ > > static unsigned int > > gigaset_tty_poll(struct tty_struct *tty, struct file *file, poll_table *wait) > > Looking around, I see that many LDs don't even provide a poll method. > So I'm thinking of just dropping this one. Would that be ok?
PPP doesn't route characters via the tty interface while you seem to do so for the AT emulation so you do need it. In the hangup case you want to return an exception event too: probably you want
POLLIN|POLLOUT|POLLERR|POLLHUP|POLLRDNORM|POLLWRNORM
for that case.
Alan
| |