From patchwork Mon Mar 30 22:09:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Tissoires X-Patchwork-Id: 6126011 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6CEF49F32E for ; Mon, 30 Mar 2015 22:10:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A20EF2043C for ; Mon, 30 Mar 2015 22:10:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BEE9C2041B for ; Mon, 30 Mar 2015 22:10:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753510AbbC3WKG (ORCPT ); Mon, 30 Mar 2015 18:10:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33980 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753286AbbC3WJg (ORCPT ); Mon, 30 Mar 2015 18:09:36 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t2UM9UQb020557 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 30 Mar 2015 18:09:30 -0400 Received: from t540p.bos.redhat.com (dhcp-25-166.bos.redhat.com [10.18.25.166]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t2UM9SX3009185; Mon, 30 Mar 2015 18:09:30 -0400 From: Benjamin Tissoires To: Dmitry Torokhov , Henrik Rydberg , Hans de Goede , Peter Hutterer Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] Input: mt - prevent balanced slot assignment to assign twice the slot Date: Mon, 30 Mar 2015 18:09:26 -0400 Message-Id: <1427753368-2795-2-git-send-email-benjamin.tissoires@redhat.com> In-Reply-To: <1427753368-2795-1-git-send-email-benjamin.tissoires@redhat.com> References: <1427753368-2795-1-git-send-email-benjamin.tissoires@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If two touches are under the dmax distance, it looks like they can now be assigned to the same slot. Add a band aid to prevent such situation and be able to use the balanced slot assignment. Signed-off-by: Benjamin Tissoires --- drivers/input/input-mt.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/input/input-mt.c b/drivers/input/input-mt.c index cb150a1..ad74f64 100644 --- a/drivers/input/input-mt.c +++ b/drivers/input/input-mt.c @@ -371,11 +371,16 @@ static void input_mt_set_slots(struct input_mt *mt, *p = -1; for (s = mt->slots; s != mt->slots + mt->num_slots; s++) { + bool found = false; + if (!input_mt_is_active(s)) continue; for (p = slots; p != slots + num_pos; p++) - if (*w++ < 0) + if ((*w++ < 0) && !found) { *p = s - mt->slots; + /* no break here: w won't be incremented */ + found = true; + } } for (s = mt->slots; s != mt->slots + mt->num_slots; s++) {