linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Anshul Garg <aksgarg1989@gmail.com>
Cc: linux-input@vger.kernel.org, anshul.g@samsung.com
Subject: Re: [PATCH] Input: Optimize Event Filter functionality
Date: Thu, 8 Jan 2015 13:51:02 -0800	[thread overview]
Message-ID: <20150108215102.GF23256@dtor-ws> (raw)
In-Reply-To: <1420724384-54188-1-git-send-email-aksgarg1989@gmail.com>

On Thu, Jan 08, 2015 at 05:39:44AM -0800, Anshul Garg wrote:
> From: Anshul Garg <aksgarg1989@gmail.com>
> 
> As input_pass_values function is called everytime when EV_SYN is sent
> from input driver or input event buffer becomes full.
> So in case of regular handler event filter code should not run so added
> check whether handler supports filter or not.
> 
> Signed-off-by: Anshul Garg <anshul.g@samsung.com>

Applied, thank you.

> ---
>  drivers/input/input.c |   24 ++++++++++++++----------
>  1 file changed, 14 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/input/input.c b/drivers/input/input.c
> index 213e3a1..de55279 100644
> --- a/drivers/input/input.c
> +++ b/drivers/input/input.c
> @@ -100,23 +100,24 @@ static unsigned int input_to_handler(struct input_handle *handle,
>  	struct input_value *end = vals;
>  	struct input_value *v;
>  
> -	for (v = vals; v != vals + count; v++) {
> -		if (handler->filter &&
> -		    handler->filter(handle, v->type, v->code, v->value))
> -			continue;
> -		if (end != v)
> -			*end = *v;
> -		end++;
> +	if (handler->filter) {
> +		for (v = vals; v != vals + count; v++) {
> +			if (handler->filter(handle, v->type, v->code, v->value))
> +				continue;
> +			if (end != v)
> +				*end = *v;
> +			end++;
> +		}
> +		count = end - vals;
>  	}
>  
> -	count = end - vals;
>  	if (!count)
>  		return 0;
>  
>  	if (handler->events)
>  		handler->events(handle, vals, count);
>  	else if (handler->event)
> -		for (v = vals; v != end; v++)
> +		for (v = vals; v != vals + count; v++)
>  			handler->event(handle, v->type, v->code, v->value);
>  
>  	return count;
> @@ -143,8 +144,11 @@ static void input_pass_values(struct input_dev *dev,
>  		count = input_to_handler(handle, vals, count);
>  	} else {
>  		list_for_each_entry_rcu(handle, &dev->h_list, d_node)
> -			if (handle->open)
> +			if (handle->open) {
>  				count = input_to_handler(handle, vals, count);
> +				if (!count)
> +					break;
> +			}
>  	}
>  
>  	rcu_read_unlock();
> -- 
> 1.7.9.5
> 
> 
> ---
> This email has been checked for viruses by Avast antivirus software.
> http://www.avast.com
> 

-- 
Dmitry

  reply	other threads:[~2015-01-08 21:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-08 13:39 [PATCH] Input: Optimize Event Filter functionality Anshul Garg
2015-01-08 21:51 ` Dmitry Torokhov [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-01-05 16:27 Anshul Garg

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=20150108215102.GF23256@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=aksgarg1989@gmail.com \
    --cc=anshul.g@samsung.com \
    --cc=linux-input@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;
as well as URLs for NNTP newsgroup(s).