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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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:
> > On Mon, May 24, 2010 at 06:08:05PM +0200, Daniel Mack wrote:
> > > 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 <daniel@xxxxxxxx>

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 <daniel@xxxxxxxx>
Signed-off-by: Dmitry Torokhov <dtor@xxxxxxx>
---

 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,
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux