All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: anshul.g@samsung.com
Cc: linux-input@vger.kernel.org, aksgarg1989@gmail.com
Subject: Re: [PATCH] Input:Optimize events_per_packet count calculation
Date: Sat, 13 Dec 2014 12:02:56 -0800	[thread overview]
Message-ID: <20141213200256.GF22702@dtor-ws> (raw)
In-Reply-To: <1418212123-4549-1-git-send-email-anshul.g@samsung.com>

On Wed, Dec 10, 2014 at 05:18:43PM +0530, anshul.g@samsung.com wrote:
> From: Anshul Garg <anshul.g@samsung.com>
> 
> This patch avoids unnecessary operations while estimating events per
> packet for an input device when event type is not set.
> 
> Signed-off-by: Anshul Garg <anshul.g@samsung.com>

Applied, thank you.

> ---
>  drivers/input/input.c |   22 +++++++++++++---------
>  1 file changed, 13 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/input/input.c b/drivers/input/input.c
> index 29ca0bb..8172296 100644
> --- a/drivers/input/input.c
> +++ b/drivers/input/input.c
> @@ -1973,18 +1973,22 @@ static unsigned int input_estimate_events_per_packet(struct input_dev *dev)
>  
>  	events = mt_slots + 1; /* count SYN_MT_REPORT and SYN_REPORT */
>  
> -	for (i = 0; i < ABS_CNT; i++) {
> -		if (test_bit(i, dev->absbit)) {
> -			if (input_is_mt_axis(i))
> -				events += mt_slots;
> -			else
> -				events++;
> +	if (test_bit(EV_ABS, dev->evbit)) {
> +		for (i = 0; i < ABS_CNT; i++) {
> +			if (test_bit(i, dev->absbit)) {
> +				if (input_is_mt_axis(i))
> +					events += mt_slots;
> +				else
> +					events++;
> +			}
>  		}
>  	}
>  
> -	for (i = 0; i < REL_CNT; i++)
> -		if (test_bit(i, dev->relbit))
> -			events++;
> +	if (test_bit(EV_REL, dev->evbit)) {
> +		for (i = 0; i < REL_CNT; i++)
> +			if (test_bit(i, dev->relbit))
> +				events++;
> +	}
>  
>  	/* Make room for KEY and MSC events */
>  	events += 7;
> -- 
> 1.7.9.5
> 

-- 
Dmitry

  reply	other threads:[~2014-12-13 20:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-10 11:48 [PATCH] Input:Optimize events_per_packet count calculation anshul.g
2014-12-13 20:02 ` Dmitry Torokhov [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-12-10 11:10 anshul.g

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=20141213200256.GF22702@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 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.