Input: Use accessor for MT values
authorHenrik Rydberg <rydberg@euromail.se>
Thu, 12 Jan 2012 18:40:34 +0000 (19:40 +0100)
committerHenrik Rydberg <rydberg@euromail.se>
Thu, 2 Feb 2012 13:42:20 +0000 (14:42 +0100)
The current MT accessor function does not distinguish between the MT
values and the slot specification event. Add an accessor function for
the values only, and use it where appropriate.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
drivers/input/input.c
include/linux/input/mt.h

index 1f78c957a75a4d284e34d04bf07145bb4014fb26..8921c6180c51dfe0efadeef0e7be59878aeca252 100644 (file)
@@ -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;
index 318bb82325a6fa59e4b3d9a13a17a99152dc5674..f86737586e190364a09c882afbab7890e66bde04 100644 (file)
@@ -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,