mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Alan Cox <alan@linux.intel.com>
Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-usb@vger.kernel.org
Subject: Re: [PATCH 1/5] tty: Add a function to insert a string of characters with the same flag
Date: Fri, 26 Feb 2010 14:11:00 -0800	[thread overview]
Message-ID: <20100226221100.GA22352@kroah.com> (raw)
In-Reply-To: <20100217130604.16008.86393.stgit@localhost.localdomain>

On Wed, Feb 17, 2010 at 01:06:30PM +0000, Alan Cox wrote:
> The USB drivers often want to insert a series of bytes all with the same
> flag set - provide a helper for this case.
> 
> Signed-off-by: Alan Cox <alan@linux.intel.com>
> ---
> 
>  drivers/char/tty_buffer.c |   12 +++++++-----
>  include/linux/tty_flip.h  |    7 ++++++-
>  2 files changed, 13 insertions(+), 6 deletions(-)
> 
> 
> diff --git a/drivers/char/tty_buffer.c b/drivers/char/tty_buffer.c
> index 8402eda..af8d977 100644
> --- a/drivers/char/tty_buffer.c
> +++ b/drivers/char/tty_buffer.c
> @@ -231,9 +231,10 @@ int tty_buffer_request_room(struct tty_struct *tty, size_t size)
>  EXPORT_SYMBOL_GPL(tty_buffer_request_room);
>  
>  /**
> - *	tty_insert_flip_string	-	Add characters to the tty buffer
> + *	tty_insert_flip_string_fixed_flag - Add characters to the tty buffer
>   *	@tty: tty structure
>   *	@chars: characters
> + *	@flag: flag value for each character
>   *	@size: size
>   *
>   *	Queue a series of bytes to the tty buffering. All the characters
> @@ -242,18 +243,19 @@ EXPORT_SYMBOL_GPL(tty_buffer_request_room);
>   *	Locking: Called functions may take tty->buf.lock
>   */
>  
> -int tty_insert_flip_string(struct tty_struct *tty, const unsigned char *chars,
> -				size_t size)
> +int tty_insert_flip_string_fixed_flag(struct tty_struct *tty,
> +		const unsigned char *chars, char flag, size_t size)
>  {
>  	int copied = 0;
>  	do {
> +		int goal = min(size - copied, TTY_BUFFER_PAGE);

This variable isn't used in this function.

>  		int space = tty_buffer_request_room(tty, goal);
>  		struct tty_buffer *tb = tty->buf.tail;
>  		/* If there is no space then tb may be NULL */
>  		if (unlikely(space == 0))
>  			break;
>  		memcpy(tb->char_buf_ptr + tb->used, chars, space);
> -		memset(tb->flag_buf_ptr + tb->used, TTY_NORMAL, space);
> +		memset(tb->flag_buf_ptr + tb->used, flag, space);

Should you have "goal" here instead of "space"?

thanks,

greg k-h

  parent reply	other threads:[~2010-02-26 23:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-17 13:06 Alan Cox
2010-02-17 13:06 ` [PATCH 2/5] tty: Prune uses of tty_request_room in the USB layer Alan Cox
2010-02-17 13:06 ` [PATCH 3/5] tty: sort out the request_room handling for whiteheat Alan Cox
2010-02-17 13:07 ` [PATCH 4/5] tty: kill request_room for USB ACM class Alan Cox
2010-02-17 13:07 ` [PATCH 5/5] tty: Fix up char drivers request_room usage Alan Cox
2010-02-26 22:11 ` Greg KH [this message]
2010-02-27 14:45   ` [PATCH 1/5] tty: Add a function to insert a string of characters with the same flag Christopher Curtis
2010-02-27 19:02   ` Alan Cox
2010-02-27 23:37     ` Greg KH
2010-02-27 19:32   ` 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=20100226221100.GA22352@kroah.com \
    --to=greg@kroah.com \
    --cc=alan@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux-usb@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

Powered by JetHome