Input: Optimize Auto Repeat Loop
Subsystems (2)
PATCH 1/1 Input: Optimize Auto Repeat Loop
From: Anshul Garg <[email protected]>
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 <[email protected]>
--- drivers/input/input.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/input/input.c +8 -6
@@ -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); + } } } }
Signature · 6 lines
1.7.9.5 --- This email has been checked for viruses by Avast antivirus software. http://www.avast.com