Thread (20 messages) 20 messages, 5 authors, 2010-08-13

Re: [PATCH 4/4] input: dynamically allocate ABS information

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2010-07-21 08:30:57
Also in: lkml
Subsystem: input (keyboard, mouse, joystick, touchscreen) drivers, the rest · Maintainers: Dmitry Torokhov, Linus Torvalds

On Wed, Jun 16, 2010 at 10:39:03AM +0200, Daniel Mack wrote:
Hi Dmitry,

On Mon, May 24, 2010 at 09:15:28AM -0700, Dmitry Torokhov wrote:
quoted
On Mon, May 24, 2010 at 06:08:05PM +0200, Daniel Mack wrote:
quoted
any feelings about this approach?
Still pondering...I applied the very first patch though...
Any news about this? I have no problem throwing away the whole patch set
and use a different approach, if there is any :)
Daniel,

The approach is pretty solid, with the exception that I do not think
we'd save much if we allocate every axis data separately (as I mentioned
in one of my earlier mails).

Coudl you please take a look at the following patches and let me know if
you see something wrong.

Thanks!

-- 
Dmitry


Input: add static inline accessors for ABS properties

From: Daniel Mack <redacted>

In preparation for dynamically allocated ABS axis, introduce a number of
sttaic inline access helpers. This should make the transition less
painful.

Signed-off-by: Daniel Mack <redacted>
Signed-off-by: Dmitry Torokhov <redacted>
---

 include/linux/input.h |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/include/linux/input.h b/include/linux/input.h
index 339d043..4a55311 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,
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help