linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Input: Use accessor for MT events
@ 2012-01-12 19:21 Henrik Rydberg
  2012-01-13  8:58 ` Chase Douglas
  0 siblings, 1 reply; 2+ messages in thread
From: Henrik Rydberg @ 2012-01-12 19:21 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, linux-kernel, Henrik Rydberg

Add an accessor function for the actual MT event types, and use
it everywhere.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
---
 drivers/input/input.c    |    2 +-
 include/linux/input/mt.h |    8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index da38d97..ba6839f 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -180,7 +180,7 @@ static int input_handle_abs_event(struct input_dev *dev,
 		return INPUT_IGNORE_EVENT;
 	}
 
-	is_mt_event = code >= ABS_MT_FIRST && code <= ABS_MT_LAST;
+	is_mt_event = input_is_mt_value(code);
 
 	if (!is_mt_event) {
 		pold = &dev->absinfo[code].value;
diff --git a/include/linux/input/mt.h b/include/linux/input/mt.h
index 318bb82..f867375 100644
--- a/include/linux/input/mt.h
+++ b/include/linux/input/mt.h
@@ -48,10 +48,14 @@ static inline void input_mt_slot(struct input_dev *dev, int slot)
 	input_event(dev, EV_ABS, ABS_MT_SLOT, slot);
 }
 
+static inline bool input_is_mt_value(int axis)
+{
+	return axis >= ABS_MT_FIRST && axis <= ABS_MT_LAST;
+}
+
 static inline bool input_is_mt_axis(int axis)
 {
-	return axis == ABS_MT_SLOT ||
-		(axis >= ABS_MT_FIRST && axis <= ABS_MT_LAST);
+	return axis == ABS_MT_SLOT || input_is_mt_value(axis);
 }
 
 void input_mt_report_slot_state(struct input_dev *dev,
-- 
1.7.8.1


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

* Re: [PATCH 1/2] Input: Use accessor for MT events
  2012-01-12 19:21 [PATCH 1/2] Input: Use accessor for MT events Henrik Rydberg
@ 2012-01-13  8:58 ` Chase Douglas
  0 siblings, 0 replies; 2+ messages in thread
From: Chase Douglas @ 2012-01-13  8:58 UTC (permalink / raw)
  To: Henrik Rydberg; +Cc: Dmitry Torokhov, linux-input, linux-kernel

On 01/12/2012 08:21 PM, Henrik Rydberg wrote:
> Add an accessor function for the actual MT event types, and use
> it everywhere.

Just to double check, it's only used in two places as you have below?
Your comment made me think it's used all over, and maybe you forgot to
git add files.

If everything is correct,

Reviewed-by: Chase Douglas <chase.douglas@canonical.com>

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

end of thread, other threads:[~2012-01-13  8:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-12 19:21 [PATCH 1/2] Input: Use accessor for MT events Henrik Rydberg
2012-01-13  8:58 ` Chase Douglas

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