Skip to contentSkip to conversation

Input: seeking internal API recommendation

DISCUSSION Dmitry Torokhov 1 participant 1 message Sep 8, 2005

lore
Share & tools
lore
#0 lore raw

Hi Vojtech,

I would like to lighten input_dev structure a bit and only allocate memory for abs{val|min|max|flat|fuzz} for devices that are going to generate absolute events. It will save 1260 bytes for every input device registered.

If you remember I was also working on converting input devices to sysfs (it progresses very nicely, I will post patches soon). As part of that conversion I have a function input_allocate_device that returns new input_dev structure. To ease error handling in individual drivers I would like to have all memory allocation go into that function. Plus we might switch other parts of input_dev to dynamic allocation. So I see basically 2 possible options:

struct input_dev *input_allocate_device(int evbits); or struct input_dev *input_allocate_device(int evbit,...)

The first form will not be sufficient if we ever go past 31 event types, but I like it better than varargs.

Any suggestions?

Signature · 1 line
Dmitry