aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorAnshul Garg <anshul.g@samsung.com>2014-12-13 14:58:23 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2014-12-16 00:45:55 -0500
commitbaf332c0f1cede26e9c2af6276b36b4c3a36e34a (patch)
treee1b1c89c0d056b1e00865a6bdb4dd58e0e46e0d8 /drivers/input
parent189387f9e0affb491b8c8833b6afd9623ab7f26a (diff)
Input: optimize events_per_packet count calculation
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> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/input.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 04217c2e345c..213e3a1903ee 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -1974,18 +1974,22 @@ static unsigned int input_estimate_events_per_packet(struct input_dev *dev)
1974 1974
1975 events = mt_slots + 1; /* count SYN_MT_REPORT and SYN_REPORT */ 1975 events = mt_slots + 1; /* count SYN_MT_REPORT and SYN_REPORT */
1976 1976
1977 for (i = 0; i < ABS_CNT; i++) { 1977 if (test_bit(EV_ABS, dev->evbit)) {
1978 if (test_bit(i, dev->absbit)) { 1978 for (i = 0; i < ABS_CNT; i++) {
1979 if (input_is_mt_axis(i)) 1979 if (test_bit(i, dev->absbit)) {
1980 events += mt_slots; 1980 if (input_is_mt_axis(i))
1981 else 1981 events += mt_slots;
1982 events++; 1982 else
1983 events++;
1984 }
1983 } 1985 }
1984 } 1986 }
1985 1987
1986 for (i = 0; i < REL_CNT; i++) 1988 if (test_bit(EV_REL, dev->evbit)) {
1987 if (test_bit(i, dev->relbit)) 1989 for (i = 0; i < REL_CNT; i++)
1988 events++; 1990 if (test_bit(i, dev->relbit))
1991 events++;
1992 }
1989 1993
1990 /* Make room for KEY and MSC events */ 1994 /* Make room for KEY and MSC events */
1991 events += 7; 1995 events += 7;