Input: Break out MT data

Move all MT-related things to a separate place. This saves some
bytes for non-mt input devices, and prepares for new MT features.

Reviewed-and-tested-by: Benjamin Tissoires <benjamin.tissoires@enac.fr>
Tested-by: Ping Cheng <pingc@wacom.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
This commit is contained in:
Henrik Rydberg 2012-09-15 15:15:58 +02:00
parent 4cbe5a555f
commit 8d18fba282
5 changed files with 61 additions and 46 deletions

View file

@ -23,6 +23,20 @@ struct input_mt_slot {
int abs[ABS_MT_LAST - ABS_MT_FIRST + 1];
};
/**
* struct input_mt - state of tracked contacts
* @trkid: stores MT tracking ID for the next contact
* @num_slots: number of MT slots the device uses
* @slot: MT slot currently being transmitted
* @slots: array of slots holding current values of tracked contacts
*/
struct input_mt {
int trkid;
int num_slots;
int slot;
struct input_mt_slot slots[];
};
static inline void input_mt_set_value(struct input_mt_slot *slot,
unsigned code, int value)
{
@ -38,9 +52,9 @@ static inline int input_mt_get_value(const struct input_mt_slot *slot,
int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots);
void input_mt_destroy_slots(struct input_dev *dev);
static inline int input_mt_new_trkid(struct input_dev *dev)
static inline int input_mt_new_trkid(struct input_mt *mt)
{
return dev->trkid++ & TRKID_MAX;
return mt->trkid++ & TRKID_MAX;
}
static inline void input_mt_slot(struct input_dev *dev, int slot)