linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input:Optimize events_per_packet count calculation
@ 2014-12-10 11:48 anshul.g
  2014-12-13 20:02 ` Dmitry Torokhov
  0 siblings, 1 reply; 3+ messages in thread
From: anshul.g @ 2014-12-10 11:48 UTC (permalink / raw)
  To: dmitry.torokhov, dtor, linux-input; +Cc: aksgarg1989, anshul.g

From: Anshul Garg <anshul.g@samsung.com>

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>
---
 drivers/input/input.c |   22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index 29ca0bb..8172296 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -1973,18 +1973,22 @@ static unsigned int input_estimate_events_per_packet(struct input_dev *dev)
 
 	events = mt_slots + 1; /* count SYN_MT_REPORT and SYN_REPORT */
 
-	for (i = 0; i < ABS_CNT; i++) {
-		if (test_bit(i, dev->absbit)) {
-			if (input_is_mt_axis(i))
-				events += mt_slots;
-			else
-				events++;
+	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))
+					events += mt_slots;
+				else
+					events++;
+			}
 		}
 	}
 
-	for (i = 0; i < REL_CNT; i++)
-		if (test_bit(i, dev->relbit))
-			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;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread
* [PATCH] Input:Optimize events_per_packet count calculation
@ 2014-12-10 11:10 anshul.g
  0 siblings, 0 replies; 3+ messages in thread
From: anshul.g @ 2014-12-10 11:10 UTC (permalink / raw)
  To: dmitry.torokhov, dtor, linux-input; +Cc: aksgarg1989, anshul.g

From: Anshul Garg <anshul.g@samsung.com>

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>
---
 drivers/input/input.c |   22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index 29ca0bb..8172296 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -1973,18 +1973,22 @@ static unsigned int input_estimate_events_per_packet(struct input_dev *dev)
 
 	events = mt_slots + 1; /* count SYN_MT_REPORT and SYN_REPORT */
 
-	for (i = 0; i < ABS_CNT; i++) {
-		if (test_bit(i, dev->absbit)) {
-			if (input_is_mt_axis(i))
-				events += mt_slots;
-			else
-				events++;
+	if (test_bit(EV_ABS, dev->evit)) {
+		for (i = 0; i < ABS_CNT; i++) {
+			if (test_bit(i, dev->absbit)) {
+				if (input_is_mt_axis(i))
+					events += mt_slots;
+				else
+					events++;
+			}
 		}
 	}
 
-	for (i = 0; i < REL_CNT; i++)
-		if (test_bit(i, dev->relbit))
-			events++;
+	if (test_bit(EV_REL, dev->evit)) {
+		for (i = 0; i < REL_CNT; i++)
+			if (test_bit(i, dev->relbit))
+				events++;
+	}
 
 	/* Make room for KEY and MSC events */
 	events += 7;
-- 
1.7.9.5


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

end of thread, other threads:[~2014-12-13 20:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-10 11:48 [PATCH] Input:Optimize events_per_packet count calculation anshul.g
2014-12-13 20:02 ` Dmitry Torokhov
  -- strict thread matches above, loose matches on Subject: below --
2014-12-10 11:10 anshul.g

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