Re: [PATCH 72/80] tty: fix up gigaset a bit

From: Alan Cox
Date: Fri Oct 17 2008 - 07:40:28 EST


> > /* 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
--
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/