[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100714081848.GC2712@core.coreip.homeip.net>
Date: Wed, 14 Jul 2010 01:18:48 -0700
From: Dmitry Torokhov <dmitry.torokhov@...il.com>
To: Daniel Mack <daniel@...aq.de>
Cc: linux-kernel@...r.kernel.org, linux-input@...r.kernel.org
Subject: Re: [PATCH 4/4] input: dynamically allocate ABS information
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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists