public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: Mark Underwood <basicmark@yahoo.com>
Cc: Rogier Wolff <R.E.Wolff@BitWizard.nl>, linux-kernel@vger.kernel.org
Subject: Re: Linux tty layer hackery: Heads up and RFC
Date: Tue, 26 Jul 2005 12:11:31 +0100	[thread overview]
Message-ID: <1122376291.2542.15.camel@localhost.localdomain> (raw)
In-Reply-To: <20050726095535.95521.qmail@web30308.mail.mud.yahoo.com>

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' 


  reply	other threads:[~2005-07-26 10:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-21 17:46 Linux tty layer hackery: Heads up and RFC Alan Cox
2005-07-21 17:47 ` Sergei Organov
2005-07-22 14:57 ` Rogier Wolff
2005-07-22 16:16   ` Alan Cox
2005-07-26  9:55   ` Mark Underwood
2005-07-26 11:11     ` Alan Cox [this message]
2005-07-26 12:38       ` Mark Underwood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1122376291.2542.15.camel@localhost.localdomain \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=R.E.Wolff@BitWizard.nl \
    --cc=basicmark@yahoo.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox