Skip to content

Commit

Permalink
Input: Use accessor for MT values
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Henrik Rydberg committed Feb 2, 2012
1 parent 62aa2b5 commit b89529a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion drivers/input/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 6 additions & 2 deletions include/linux/input/mt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit b89529a

Please sign in to comment.