mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
189387f9e0
commit
baf332c0f1
|
@ -1974,6 +1974,7 @@ static unsigned int input_estimate_events_per_packet(struct input_dev *dev)
|
|||
|
||||
events = mt_slots + 1; /* count SYN_MT_REPORT and SYN_REPORT */
|
||||
|
||||
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))
|
||||
|
@ -1982,10 +1983,13 @@ static unsigned int input_estimate_events_per_packet(struct input_dev *dev)
|
|||
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;
|
||||
|
|
Loading…
Reference in New Issue