From patchwork Wed Nov 14 15:59:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Tissoires X-Patchwork-Id: 1742251 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 85D1BDF264 for ; Wed, 14 Nov 2012 16:01:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422981Ab2KNQB1 (ORCPT ); Wed, 14 Nov 2012 11:01:27 -0500 Received: from mail-wi0-f172.google.com ([209.85.212.172]:38882 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423016Ab2KNP74 (ORCPT ); Wed, 14 Nov 2012 10:59:56 -0500 Received: by mail-wi0-f172.google.com with SMTP id hj6so622577wib.1 for ; Wed, 14 Nov 2012 07:59:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:x-mailer:in-reply-to:references; bh=SRQRu8jn8CUWWkWbofCi/RPD/LDpVS9irt/+lCYl3nw=; b=TQguiBkMMKot2oh/wL4yMS34ZXe0jK4XdT8GKYkV5Rkc53BC0NotmSk27nuBQRIxwF F+EDnBMZwNMRU7PsKDCeTe6oZJ7CH5mU+rOtYtu0qONZ7tg/7QK9rKnPy2fe4EVmrPto kVy3wt+KCMq1QT7F0S9xMsNSu4eJWRw56uX2/uZobZDEyzd3S2DwzldGXAdpTgzr4NHp N6+ssUF9AatCkGJcm307VCBU1rYHMsYEeXYdnMUpE6BEU8ZwJE890J/+JbUbUrcuYx3C LA1QcWyz4E+K0T4CqjDut/DUjXqSfR5KL3yQmFO07A/SRAJfXl1FD+mum+yUT9R6w8mT IocA== Received: by 10.216.197.142 with SMTP id t14mr10603991wen.151.1352908795198; Wed, 14 Nov 2012 07:59:55 -0800 (PST) Received: from localhost.localdomain.com (lan31-8-82-247-176-67.fbx.proxad.net. [82.247.176.67]) by mx.google.com with ESMTPS id r10sm3050116wiz.0.2012.11.14.07.59.53 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 14 Nov 2012 07:59:54 -0800 (PST) From: Benjamin Tissoires To: "benjamin.tissoires" , Dmitry Torokhov , Henrik Rydberg , Jiri Kosina , Stephane Chatty , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 10/14] Input: mt: add input_mt_is_used Date: Wed, 14 Nov 2012 16:59:22 +0100 Message-Id: <1352908766-4492-11-git-send-email-benjamin.tissoires@gmail.com> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1352908766-4492-1-git-send-email-benjamin.tissoires@gmail.com> References: <1352908766-4492-1-git-send-email-benjamin.tissoires@gmail.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org This patch extracts the test (slot->frame == mt->frame) so that it can be used in third party drivers. Signed-off-by: Benjamin Tissoires --- drivers/input/input-mt.c | 2 +- include/linux/input/mt.h | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/input/input-mt.c b/drivers/input/input-mt.c index c0ec7d4..475b9d4 100644 --- a/drivers/input/input-mt.c +++ b/drivers/input/input-mt.c @@ -247,7 +247,7 @@ void input_mt_sync_frame(struct input_dev *dev) if (mt->flags & INPUT_MT_DROP_UNUSED) { for (s = mt->slots; s != mt->slots + mt->num_slots; s++) { - if (s->frame == mt->frame) + if (input_mt_is_used(mt, s)) continue; input_mt_slot(dev, s - mt->slots); input_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); diff --git a/include/linux/input/mt.h b/include/linux/input/mt.h index cc5cca7..2e86bd0 100644 --- a/include/linux/input/mt.h +++ b/include/linux/input/mt.h @@ -69,6 +69,12 @@ static inline bool input_mt_is_active(const struct input_mt_slot *slot) return input_mt_get_value(slot, ABS_MT_TRACKING_ID) >= 0; } +static inline bool input_mt_is_used(const struct input_mt *mt, + const struct input_mt_slot *slot) +{ + return slot->frame == mt->frame; +} + int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots, unsigned int flags); void input_mt_destroy_slots(struct input_dev *dev);