summaryrefslogtreecommitdiff
path: root/include/linux/input.h
diff options
context:
space:
mode:
authorDaniel Mack <daniel@caiaq.de>2010-08-02 19:33:51 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2010-08-02 20:29:50 -0700
commit7957e9c4d175cc065f4277211fcb7d784fcee860 (patch)
treec8f96d944e54063f61ae99bf3233f80bc2599ab3 /include/linux/input.h
parent0d87c7228a49e8342d60dd552892e470e0b291fa (diff)
downloadlwn-7957e9c4d175cc065f4277211fcb7d784fcee860.tar.gz
lwn-7957e9c4d175cc065f4277211fcb7d784fcee860.zip
Input: add static inline accessors for ABS properties
In preparation for dynamically allocated ABS axis, introduce a number of static inline access helpers. This should make the transition less painful. Signed-off-by: Daniel Mack <daniel@caiaq.de> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'include/linux/input.h')
-rw-r--r--include/linux/input.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/linux/input.h b/include/linux/input.h
index 339d043ccb53..4a5531161de1 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -1469,6 +1469,36 @@ static inline void input_set_abs_params(struct input_dev *dev, int axis, int min
dev->absbit[BIT_WORD(axis)] |= BIT_MASK(axis);
}
+#define INPUT_GENERATE_ABS_ACCESSORS(_suffix, _item) \
+static inline int input_abs_get_##_suffix(struct input_dev *dev, \
+ unsigned int axis) \
+{ \
+ return dev->abs##_item[axis]; \
+} \
+ \
+static inline void input_abs_set_##_suffix(struct input_dev *dev, \
+ unsigned int axis, int val) \
+{ \
+ dev->abs##_item[axis] = val; \
+}
+
+INPUT_GENERATE_ABS_ACCESSORS(min, min)
+INPUT_GENERATE_ABS_ACCESSORS(max, max)
+INPUT_GENERATE_ABS_ACCESSORS(fuzz, fuzz)
+INPUT_GENERATE_ABS_ACCESSORS(flat, flat)
+INPUT_GENERATE_ABS_ACCESSORS(res, res)
+
+static inline int input_abs_get_val(struct input_dev *dev, unsigned int axis)
+{
+ return dev->abs[axis];
+}
+
+static inline void input_abs_set_val(struct input_dev *dev,
+ unsigned int axis, int val)
+{
+ dev->abs[axis] = val;
+}
+
int input_get_keycode(struct input_dev *dev,
unsigned int scancode, unsigned int *keycode);
int input_set_keycode(struct input_dev *dev,