linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] input: mt: Initialize slots to unused
@ 2010-08-22 13:46 Henrik Rydberg
  2010-08-29  5:58 ` Dmitry Torokhov
  0 siblings, 1 reply; 2+ messages in thread
From: Henrik Rydberg @ 2010-08-22 13:46 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, linux-kernel, Henrik Rydberg

For MT slots, the ABS_MT_TRACKING_ID determines whether a slot is in use,
but currently leaves initialization up to the drivers. This patch sets the
slot state to unused upon creation.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
---
 drivers/input/input.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index a9b025f..9325844 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -1599,8 +1599,9 @@ EXPORT_SYMBOL(input_free_device);
  * @dev: input device supporting MT events and finger tracking
  * @num_slots: number of slots used by the device
  *
- * This function allocates all necessary memory for MT slot handling
- * in the input device, and adds ABS_MT_SLOT to the device capabilities.
+ * This function allocates all necessary memory for MT slot handling in the
+ * input device, and adds ABS_MT_SLOT to the device capabilities. All slots
+ * are initially unused with ABS_MT_TRACKING_ID == -1.
  */
 int input_mt_create_slots(struct input_dev *dev, unsigned int num_slots)
 {
@@ -1613,6 +1614,8 @@ int input_mt_create_slots(struct input_dev *dev, unsigned int num_slots)
 
 	dev->mtsize = num_slots;
 	input_set_abs_params(dev, ABS_MT_SLOT, 0, num_slots - 1, 0, 0);
+	while (num_slots--)
+		dev->mt[num_slots].abs[ABS_MT_TRACKING_ID - ABS_MT_FIRST] = -1;
 
 	return 0;
 }
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/2] input: mt: Initialize slots to unused
  2010-08-22 13:46 [PATCH 1/2] input: mt: Initialize slots to unused Henrik Rydberg
@ 2010-08-29  5:58 ` Dmitry Torokhov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2010-08-29  5:58 UTC (permalink / raw)
  To: Henrik Rydberg; +Cc: linux-input, linux-kernel

On Sun, Aug 22, 2010 at 03:46:49PM +0200, Henrik Rydberg wrote:
> For MT slots, the ABS_MT_TRACKING_ID determines whether a slot is in use,
> but currently leaves initialization up to the drivers. This patch sets the
> slot state to unused upon creation.
> 
> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>

Applied (which change to for() loop - I prefer not change passed
arguments), thanks Henrik.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-08-29  5:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-22 13:46 [PATCH 1/2] input: mt: Initialize slots to unused Henrik Rydberg
2010-08-29  5:58 ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).