All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Organov <osv@javad.com>
To: Alan Cox <alan@redhat.com>
Cc: linux-serial@vger.kernel.org
Subject: [Q] New tty flip interface doubt.
Date: Wed, 21 Jun 2006 16:16:33 +0400	[thread overview]
Message-ID: <87hd2epuu6.fsf@javad.com> (raw)

Alan,

Could you please slightly clarify the intent and suggest the right way
to use the new interface routine tty_buffer_request_room() along with
tty_insert_flip_string() (see below)?

I'm looking into some drivers that use it and into your initial
description of the changes to the tty flip buffers, and I have a
doubt. Consider the code:

  tty_buffer_request_room(tty, urb->actual_length);
  tty_insert_flip_string(tty, data, urb->actual_length);
  tty_flip_buffer_push(tty);

For me it seems that in this case the call to tty_buffer_request_room()
is useless as the first thing tty_insert_flip_string() does is to call
tty_buffer_request_room() with exactly the same parameters anyway.

On the other hand, your explanations of the new interfaces talk about
tty_buffer_request_room() as something that lets kernel handle memory
better. I'm not sure I understand what it means in practice.

On yet another hand (or foot, should one has only two hands), some
drivers do call tty_buffer_request_room(), and others don't.

Yet another way of doing things I see in the kernel code is:

  int count = tty_buffer_request_room(tty, length);
  tty_insert_flip_string(tty, data, count);

this one is also doubtful as just calling

  tty_insert_flip_string(tty, data, length);

instead has slightly more chances to transfer 'length' chars as
tty_insert_flip_string(), unlike tty_buffer_request_room(), loops to
find the memory.

Overall, what's the canonical way to transfer 'length' chars from a
buffer 'buf' to the tty layer?

-- 
Sergei.

             reply	other threads:[~2006-06-21 12:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-21 12:16 Sergei Organov [this message]
2006-06-21 13:42 ` [Q] New tty flip interface doubt Alan Cox
2006-06-22  7:33   ` Sergei Organov
2006-06-22 12:56     ` Alan Cox
2006-06-22 15:17       ` Sergei Organov
2006-06-23 13:16         ` Alan Cox

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=87hd2epuu6.fsf@javad.com \
    --to=osv@javad.com \
    --cc=alan@redhat.com \
    --cc=linux-serial@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.