Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 01a9c2da authored by Anshul Garg's avatar Anshul Garg Committed by Matt Wagantall
Browse files

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.

Change-Id: I913be1e5356d5ca7d3047e6b0413069993c2921c
Signed-off-by: default avatarAnshul Garg <anshul.g@samsung.com>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
Git-commit: baf332c0f1cede26e9c2af6276b36b4c3a36e34a
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git


Signed-off-by: default avatarMatt Wagantall <mattw@codeaurora.org>
parent ef0d0e07
Loading
Loading
Loading
Loading
+13 −9
Original line number Diff line number Diff line
@@ -1980,6 +1980,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))
@@ -1988,10 +1989,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;