Re: [PATCH] Input:Optimize events_per_packet count calculation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Dec 10, 2014 at 05:18:43PM +0530, anshul.g@xxxxxxxxxxx wrote:
> From: Anshul Garg <anshul.g@xxxxxxxxxxx>
> 
> 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@xxxxxxxxxxx>

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
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux