From patchwork Wed May 11 09:19:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zengzhaoxiu@163.com X-Patchwork-Id: 9066291 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DF6A2BF29F for ; Wed, 11 May 2016 09:20:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 268C320172 for ; Wed, 11 May 2016 09:20:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 461DB20154 for ; Wed, 11 May 2016 09:20:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932184AbcEKJT4 (ORCPT ); Wed, 11 May 2016 05:19:56 -0400 Received: from m50-135.163.com ([123.125.50.135]:34869 "EHLO m50-135.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932330AbcEKJTx (ORCPT ); Wed, 11 May 2016 05:19:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=KzscahsGiKtELw//p5 gyF8tLEriHrIGmnZ4S4u5ks4c=; b=n9kRhVk4O91uMSdSmHh1GepnlZuYIhD8rN BlaY8iVZZ7w3NvOp0A/zRmBHz15Cx8p1wZiSiJggcfX54vbXviM70b/dn3xXEoIB UjoUjbnj9SFWYyHbaQNR0DudWB3/U3tbQrWGWxar0X6OdxaiO0cPiGrciaS/3pdz m1OsyttM4= Received: from zhaoxiuzeng-VirtualBox.spreadtrum.com (unknown [112.95.225.98]) by smtp5 (Coremail) with SMTP id D9GowABHcTIz+TJXN9RCAA--.13432S2; Wed, 11 May 2016 17:19:50 +0800 (CST) From: zengzhaoxiu@163.com To: linux-kernel@vger.kernel.org Cc: Zhaoxiu Zeng , Dmitry Torokhov , linux-input@vger.kernel.org Subject: [patch V4 17/31] input: use parity16 in ams_delta_serio Date: Wed, 11 May 2016 17:19:43 +0800 Message-Id: <1462958385-25351-1-git-send-email-zengzhaoxiu@163.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1462955158-28394-1-git-send-email-zengzhaoxiu@163.com> References: <1462955158-28394-1-git-send-email-zengzhaoxiu@163.com> X-CM-TRANSID: D9GowABHcTIz+TJXN9RCAA--.13432S2 X-Coremail-Antispam: 1Uf129KBjvdXoWruw15Gr1kWr45JryxZr1fZwb_yoWfArb_Za s5GFn7XF4qkF43twn0yrs8X3sYvwnYqryF9F1Yya15Gry8Wr95JFy8uFW5AFn3XrWkury7 Ar95WasYgw4xWjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUeenmtUUUUU== X-Originating-IP: [112.95.225.98] X-CM-SenderInfo: p2hqw6xkdr5xrx6rljoofrz/1tbiMBZmgFWBV7JCrwAAsc Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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 From: Zhaoxiu Zeng Signed-off-by: Zhaoxiu Zeng Acked-by: Dmitry Torokhov --- drivers/input/serio/ams_delta_serio.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/input/serio/ams_delta_serio.c b/drivers/input/serio/ams_delta_serio.c index 45887e3..85459b3 100644 --- a/drivers/input/serio/ams_delta_serio.c +++ b/drivers/input/serio/ams_delta_serio.c @@ -48,13 +48,9 @@ static int check_data(int data) data); return SERIO_FRAME; } - /* calculate the parity */ - for (i = 1; i < 10; i++) { - if (data & (1 << i)) - parity++; - } /* it should be odd */ - if (!(parity & 0x01)) { + parity = parity16(data & 0x3fe); + if (!parity) { dev_warn(&ams_delta_serio->dev, "paritiy check failed, data=0x%X parity=0x%X\n", data, parity);