From: Dmitry Torokhov on
On Mon, May 24, 2010 at 06:08:05PM +0200, Daniel Mack wrote:
> Hi Dmitry,
>
> any feelings about this approach?
>

Still pondering...I applied the very first patch though...

Thanks.

--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Daniel Mack on
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 :)

And I need one, because I have a patch pending for a MIDI/Controller
device which is something like a drum computer control device, and this
one has more ABS information channels than currently supported by the
input stack.

OTOH, the current plan is to use *axis* information for the transport
to the user space, but in fact, their hardware representation is a
pressure-sesitive button. Same counts for potentiometers etc, which
aren't axis either. So maybe I should use some different layer for such
devices? MIDI legacy after all? I'm open to any suggestions :)

Thanks,
Daniel

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Dmitry Torokhov on
On Wed, May 19, 2010 at 07:22:37PM +0200, Daniel Mack wrote:
>
> /**
> + * input_alloc_absinfo - allocates an input_absinfo struct
> + * @dev: the input device
> + * @axis: the ABS axis
> + *
> + * If the absinfo struct the caller asked for is already allocated, this
> + * functions will not do anything but return it.
> + */
> +struct input_absinfo *input_alloc_absinfo(struct input_dev *dev, int axis)
> +{
> + if (!dev->absinfo[axis])
> + dev->absinfo[axis] =
> + kzalloc(sizeof(struct input_absinfo), GFP_KERNEL);
> +
> + WARN(!dev->absinfo[axis], "%s(): kzalloc() failed?\n", __func__);
> + return dev->absinfo[axis];

This causes us to allocate every absinfo structure separately and use
64 additional pointers (256 bytes on 32 bit boxes and even more on 64 bit
boxes). If device uses enough axis we end up eating up most savings.

I think we should simply alloctate ABS_CNT worth of absinfo first time
we try to set up abs parameters and be done with it so we'll be saving
space for devices not reporting absolute events.

Another optionw woudl be to allow drivers specify size of absinfo array
but I am not sure if it worth it.

Thanks.

--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: ext-phil.2.carmody on
A tiny tiny nit...

From: Dmitry Torokhov [dmitry.torokhov(a)gmail.com]
....
+void input_alloc_absinfo(struct input_dev *dev)
+{
+ if (!dev->absinfo)
+ dev->absinfo = kcalloc(ABS_CNT, sizeof(struct input_absinfo),
+ GFP_KERNEL);
+
+ WARN(!dev->absinfo, "%s(): kzalloc() failed?\n", __func__);

kcalloc failed, not kzalloc.

Phil
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Artem Bityutskiy on
On Wed, 2010-07-21 at 11:22 +0200, ext-phil.2.carmody(a)nokia.com wrote:
> A tiny tiny nit...
>
> From: Dmitry Torokhov [dmitry.torokhov(a)gmail.com]
> ...
> +void input_alloc_absinfo(struct input_dev *dev)
> +{
> + if (!dev->absinfo)
> + dev->absinfo = kcalloc(ABS_CNT, sizeof(struct input_absinfo),
> + GFP_KERNEL);
> +
> + WARN(!dev->absinfo, "%s(): kzalloc() failed?\n", __func__);
>
> kcalloc failed, not kzalloc.

kmalloc and friends already print a warning with a stack dump when they
fail, unless this is overrided with __GFP_NOWARN, which is not the case
here. So in usually we do not print messages/warnigns when we fail to
allocate.

--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/