aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/input-mt.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/input-mt.c')
-rw-r--r--drivers/input/input-mt.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/drivers/input/input-mt.c b/drivers/input/input-mt.c
index 34feb3e1127b..54fce56c8023 100644
--- a/drivers/input/input-mt.c
+++ b/drivers/input/input-mt.c
@@ -368,27 +368,35 @@ static void input_mt_set_slots(struct input_mt *mt,
368 int *slots, int num_pos) 368 int *slots, int num_pos)
369{ 369{
370 struct input_mt_slot *s; 370 struct input_mt_slot *s;
371 int *w = mt->red, *p; 371 int *w = mt->red, j;
372 372
373 for (p = slots; p != slots + num_pos; p++) 373 for (j = 0; j != num_pos; j++)
374 *p = -1; 374 slots[j] = -1;
375 375
376 for (s = mt->slots; s != mt->slots + mt->num_slots; s++) { 376 for (s = mt->slots; s != mt->slots + mt->num_slots; s++) {
377 if (!input_mt_is_active(s)) 377 if (!input_mt_is_active(s))
378 continue; 378 continue;
379 for (p = slots; p != slots + num_pos; p++) 379
380 if (*w++ < 0) 380 for (j = 0; j != num_pos; j++) {
381 *p = s - mt->slots; 381 if (w[j] < 0) {
382 slots[j] = s - mt->slots;
383 break;
384 }
385 }
386
387 w += num_pos;
382 } 388 }
383 389
384 for (s = mt->slots; s != mt->slots + mt->num_slots; s++) { 390 for (s = mt->slots; s != mt->slots + mt->num_slots; s++) {
385 if (input_mt_is_active(s)) 391 if (input_mt_is_active(s))
386 continue; 392 continue;
387 for (p = slots; p != slots + num_pos; p++) 393
388 if (*p < 0) { 394 for (j = 0; j != num_pos; j++) {
389 *p = s - mt->slots; 395 if (slots[j] < 0) {
396 slots[j] = s - mt->slots;
390 break; 397 break;
391 } 398 }
399 }
392 } 400 }
393} 401}
394 402