linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: Optimize Auto Repeat Loop
@ 2015-01-05 16:12 Anshul Garg
  0 siblings, 0 replies; 3+ messages in thread
From: Anshul Garg @ 2015-01-05 16:12 UTC (permalink / raw)
  To: dmitry.torokhov, dtor, linux-input; +Cc: aksgarg1989, anshul.g, p.shailesh

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 avoid running
auto repeat code if input device doesn't support EV_KEY and EV_REP
event type.

Signed-off-by: Anshul Garg <anshul.g@samsung.com>
---
 drivers/input/input.c |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index 213e3a1..601171b 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -152,12 +152,14 @@ static void input_pass_values(struct input_dev *dev,
 	add_input_randomness(vals->type, vals->code, vals->value);
 
 	/* trigger auto repeat for key events */
-	for (v = vals; v != vals + count; v++) {
-		if (v->type == EV_KEY && v->value != 2) {
-			if (v->value)
-				input_start_autorepeat(dev, v->code);
-			else
-				input_stop_autorepeat(dev);
+	if (test_bit(EV_KEY, dev->evbit) && test_bit(EV_REP, dev->evbit)) {
+		for (v = vals; v != vals + count; v++) {
+			if (v->type == EV_KEY && v->value != 2) {
+				if (v->value)
+					input_start_autorepeat(dev, v->code);
+				else
+					input_stop_autorepeat(dev);
+			}
 		}
 	}
 }
-- 
1.7.9.5


---
This email has been checked for viruses by Avast antivirus software.
http://www.avast.com


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] Input: Optimize Auto Repeat Loop
@ 2015-01-08 13:38 Anshul Garg
  2015-01-08 21:50 ` Dmitry Torokhov
  0 siblings, 1 reply; 3+ messages in thread
From: Anshul Garg @ 2015-01-08 13:38 UTC (permalink / raw)
  To: dmitry.torokhov, dtor, linux-input; +Cc: aksgarg1989, anshul.g

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 avoid running
auto repeat code if input device doesn't support EV_KEY and EV_REP
event type.

Signed-off-by: Anshul Garg <anshul.g@samsung.com>
---
 drivers/input/input.c |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index 213e3a1..601171b 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -152,12 +152,14 @@ static void input_pass_values(struct input_dev *dev,
 	add_input_randomness(vals->type, vals->code, vals->value);
 
 	/* trigger auto repeat for key events */
-	for (v = vals; v != vals + count; v++) {
-		if (v->type == EV_KEY && v->value != 2) {
-			if (v->value)
-				input_start_autorepeat(dev, v->code);
-			else
-				input_stop_autorepeat(dev);
+	if (test_bit(EV_KEY, dev->evbit) && test_bit(EV_REP, dev->evbit)) {
+		for (v = vals; v != vals + count; v++) {
+			if (v->type == EV_KEY && v->value != 2) {
+				if (v->value)
+					input_start_autorepeat(dev, v->code);
+				else
+					input_stop_autorepeat(dev);
+			}
 		}
 	}
 }
-- 
1.7.9.5


---
This email has been checked for viruses by Avast antivirus software.
http://www.avast.com


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Input: Optimize Auto Repeat Loop
  2015-01-08 13:38 Anshul Garg
@ 2015-01-08 21:50 ` Dmitry Torokhov
  0 siblings, 0 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2015-01-08 21:50 UTC (permalink / raw)
  To: Anshul Garg; +Cc: linux-input, anshul.g

On Thu, Jan 08, 2015 at 05:38:53AM -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 avoid running
> auto repeat code if input device doesn't support EV_KEY and EV_REP
> event type.
> 
> Signed-off-by: Anshul Garg <anshul.g@samsung.com>

Applied, thank you.

> ---
>  drivers/input/input.c |   14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/input/input.c b/drivers/input/input.c
> index 213e3a1..601171b 100644
> --- a/drivers/input/input.c
> +++ b/drivers/input/input.c
> @@ -152,12 +152,14 @@ static void input_pass_values(struct input_dev *dev,
>  	add_input_randomness(vals->type, vals->code, vals->value);
>  
>  	/* trigger auto repeat for key events */
> -	for (v = vals; v != vals + count; v++) {
> -		if (v->type == EV_KEY && v->value != 2) {
> -			if (v->value)
> -				input_start_autorepeat(dev, v->code);
> -			else
> -				input_stop_autorepeat(dev);
> +	if (test_bit(EV_KEY, dev->evbit) && test_bit(EV_REP, dev->evbit)) {
> +		for (v = vals; v != vals + count; v++) {
> +			if (v->type == EV_KEY && v->value != 2) {
> +				if (v->value)
> +					input_start_autorepeat(dev, v->code);
> +				else
> +					input_stop_autorepeat(dev);
> +			}
>  		}
>  	}
>  }
> -- 
> 1.7.9.5
> 
> 
> ---
> This email has been checked for viruses by Avast antivirus software.
> http://www.avast.com
> 

-- 
Dmitry

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-01-08 21:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-05 16:12 [PATCH] Input: Optimize Auto Repeat Loop Anshul Garg
  -- strict thread matches above, loose matches on Subject: below --
2015-01-08 13:38 Anshul Garg
2015-01-08 21:50 ` Dmitry Torokhov

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).