]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Merge branch 'for-4.1/upstream' into for-next
authorJiri Kosina <jkosina@suse.cz>
Tue, 7 Apr 2015 13:17:11 +0000 (15:17 +0200)
committerJiri Kosina <jkosina@suse.cz>
Tue, 7 Apr 2015 13:17:11 +0000 (15:17 +0200)
drivers/input/input-mt.c

index cb150a1dbaff9c9e788885747113e83e8f1dbe52..34feb3e1127b2b64c31e8d803f98fcb5ec2aaffc 100644 (file)
@@ -88,10 +88,13 @@ int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots,
                        goto err_mem;
        }
 
-       /* Mark slots as 'unused' */
+       /* Mark slots as 'inactive' */
        for (i = 0; i < num_slots; i++)
                input_mt_set_value(&mt->slots[i], ABS_MT_TRACKING_ID, -1);
 
+       /* Mark slots as 'unused' */
+       mt->frame = 1;
+
        dev->mt = mt;
        return 0;
 err_mem:
@@ -439,6 +442,8 @@ EXPORT_SYMBOL(input_mt_assign_slots);
  * set the key on the first unused slot and return.
  *
  * If no available slot can be found, -1 is returned.
+ * Note that for this function to work properly, input_mt_sync_frame() has
+ * to be called at each frame.
  */
 int input_mt_get_slot_by_key(struct input_dev *dev, int key)
 {
@@ -453,7 +458,7 @@ int input_mt_get_slot_by_key(struct input_dev *dev, int key)
                        return s - mt->slots;
 
        for (s = mt->slots; s != mt->slots + mt->num_slots; s++)
-               if (!input_mt_is_active(s)) {
+               if (!input_mt_is_active(s) && !input_mt_is_used(mt, s)) {
                        s->key = key;
                        return s - mt->slots;
                }