From patchwork Tue Aug 24 13:44:01 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Henrik Rydberg X-Patchwork-Id: 62578 X-Patchwork-Delegate: leann.ogasawara@canonical.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 566CFB70A3 for ; Tue, 24 Aug 2010 23:44:22 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1OntnT-0005ys-5e; Tue, 24 Aug 2010 14:44:15 +0100 Received: from ch-smtp01.sth.basefarm.net ([80.76.149.212]) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1OntnR-0005yi-5p for kernel-team@lists.ubuntu.com; Tue, 24 Aug 2010 14:44:13 +0100 Received: from c83-248-196-134.bredband.comhem.se ([83.248.196.134]:37060 helo=alnilam) by ch-smtp01.sth.basefarm.net with smtp (Exim 4.71) (envelope-from ) id 1OntnN-0002dI-4r; Tue, 24 Aug 2010 15:44:12 +0200 Received: by alnilam (sSMTP sendmail emulation); Tue, 24 Aug 2010 15:44:08 +0200 From: "Henrik Rydberg" To: kernel-team@lists.ubuntu.com Subject: [PATCH] input: mt: Initialize slots to unused (rev2) Date: Tue, 24 Aug 2010 15:44:01 +0200 Message-Id: <1282657441-10014-1-git-send-email-rydberg@euromail.se> X-Mailer: git-send-email 1.7.1 X-Originating-IP: 83.248.196.134 X-Scan-Result: No virus found in message 1OntnN-0002dI-4r. X-Scan-Signature: ch-smtp01.sth.basefarm.net 1OntnN-0002dI-4r eb18d9bd40bc055f8abd1431c4bc552a X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com 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. Suggested for Maverick. Signed-off-by: Henrik Rydberg --- drivers/input/input.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/input/input.c b/drivers/input/input.c index 085ea38..e6395bf 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -1750,8 +1750,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) { @@ -1764,6 +1765,9 @@ 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); + /* the slot abs array starts at ABS_MT_FIRST to save memory */ + while (num_slots--) + dev->mt[num_slots].abs[ABS_MT_TRACKING_ID - ABS_MT_FIRST] = -1; return 0; }