Messages in this thread | | | Subject | Re: Linux tty layer hackery: Heads up and RFC | From | Alan Cox <> | Date | Tue, 26 Jul 2005 12:11:31 +0100 |
| |
On Maw, 2005-07-26 at 10:55 +0100, Mark Underwood wrote: > What my driver would like to do is to handle its own > input buffers. It would pass the buffer to the tty > layer when it is full and the tty layer would pass the
In theory you can do that already, although the locking is a bit screwed up for it. Actually all the tty locking is broken for rx I believe. Everyone should be holding the tty read lock when updating flip buffers but right now we don't
> buffer back once it has drained the data from it. > The problem is that I don't always receive a block > worth of characters so I also need to pass the tty > layer a buffer (which I'm still DMAing into) with a > count of how many chars there are in the buffer and a > offset of where to start from.
You can do this now providing you don't do it blindly from IRQ context.
>From a workqueue do
struct tty_ldisc *ld = tty_ldisc_ref(tty); int space;
if(ld == NULL) /* Bin/defer */ return; space = ld->receive_room(tty); if(count > space) count = space;
ld->receive_buf(tty, charbuf, flagbuf, count);
There is a corner case if TTY_DONT_FLIP is set where you should queue but not all drivers do this and the DONT_FLIP hack 'has to die'
- 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/
| |