From patchwork Sun Mar 27 07:13:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhaoxiu Zeng X-Patchwork-Id: 8675411 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 CF4AE9F3D1 for ; Sun, 27 Mar 2016 07:13:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 01C8D2024C for ; Sun, 27 Mar 2016 07:13:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2B1852022D for ; Sun, 27 Mar 2016 07:13:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751331AbcC0HNh (ORCPT ); Sun, 27 Mar 2016 03:13:37 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:36848 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751297AbcC0HNh (ORCPT ); Sun, 27 Mar 2016 03:13:37 -0400 Received: by mail-pf0-f195.google.com with SMTP id q129so16799452pfb.3; Sun, 27 Mar 2016 00:13:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:references:cc:to:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=yngKma5oyfFftf50DP7DcHA8LFrbBWHkopUXKEpBzn8=; b=gWS34X8bjmE/AKnWdOdOj5oFtOSnzh/tDPLudBOdNcBh4FfoGCc5Qgii1D8YId9aS1 Jry1Boa4w+7Jc8hg5lCJJk5tBcAnZd/vv3Xxi6kSldVOuDpw0jqRfwJklm7ZQb+uA6RQ 6w1se9h2g4ahpldbSmcuQFeHLvOPoPXlIG/PVNGv9bPhGDop1L5lEuRKc0xVkV5WcRga tMwTIepdkmPdCff5K7VWI70Y/CkUNJ8MtJiK9roW9bWsI0omMvcTT4aJ2AXoRdBu3FYT vhKRmdm+oIPy5PmTemf9NFZaUWWl5enJ92HQTJ+xGJVRDcXR1YIpnphywRzXWiXOJi5k vZSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:references:cc:to:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=yngKma5oyfFftf50DP7DcHA8LFrbBWHkopUXKEpBzn8=; b=h8KWE9M2rTUPlVVt/fM6teJXOcgZDbf4O/8UFByIzRW4qOg3gmCDPSpuLAWcbihd0P jCab5mdT7VIrzX8yM5h8PM3zORQ6eSZbW1BAvIpF1uHZ6iqeU2+dAaH5mpbXqIM5aihM GaXlaBquwRp6+yIoIMDINqVYVk/qpETlI8PSpw7wYpQ3wgsFXSXoV0Id3Ryfp2Z2ylGN pB7Mej8cMrjsN6R6ndkp9gZv+iKLezDWTHLrPPiwlsE8R6P09CKcBzu5vZMth4etvTUP rfP6wAOTdEl66KuR4scFbEEp12bIhAqg67B+6vvt11acRUDiSpiVeLb32Z1F9apsl+IJ oODA== X-Gm-Message-State: AD7BkJIgmr/9PpQDbJAciJFsh7UvH02EHJFwjf9Hfqcp6Dxqse7ATkVfsH92rYZJ/V+3Eg== X-Received: by 10.98.12.8 with SMTP id u8mr33211081pfi.36.1459062816436; Sun, 27 Mar 2016 00:13:36 -0700 (PDT) Received: from [0.0.0.0] (tor-exit4-readme.dfri.se. [171.25.193.78]) by smtp.googlemail.com with ESMTPSA id l14sm26986189pfi.23.2016.03.27.00.13.26 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 27 Mar 2016 00:13:36 -0700 (PDT) Subject: [PATCH 17/31] input: joystick: use parity32 in grip_mp.c References: <1458788612-4367-1-git-send-email-zhaoxiu.zeng@gmail.com> Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org To: Dmitry Torokhov From: "zhaoxiu.zeng" Message-ID: <56F78804.5060501@gmail.com> Date: Sun, 27 Mar 2016 15:13:08 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 In-Reply-To: <1458788612-4367-1-git-send-email-zhaoxiu.zeng@gmail.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, 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: Zeng Zhaoxiu Signed-off-by: Zeng Zhaoxiu --- drivers/input/joystick/grip_mp.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/drivers/input/joystick/grip_mp.c b/drivers/input/joystick/grip_mp.c index 573191d..3e29eb1 100644 --- a/drivers/input/joystick/grip_mp.c +++ b/drivers/input/joystick/grip_mp.c @@ -112,20 +112,6 @@ static const int axis_map[] = { 5, 9, 1, 5, 6, 10, 2, 6, 4, 8, 0, 4, 5, 9, 1, 5 static int register_slot(int i, struct grip_mp *grip); /* - * Returns whether an odd or even number of bits are on in pkt. - */ - -static int bit_parity(u32 pkt) -{ - int x = pkt ^ (pkt >> 16); - x ^= x >> 8; - x ^= x >> 4; - x ^= x >> 2; - x ^= x >> 1; - return x & 1; -} - -/* * Poll gameport; return true if all bits set in 'onbits' are on and * all bits set in 'offbits' are off. */ @@ -235,7 +221,7 @@ static int mp_io(struct gameport* gameport, int sendflags, int sendcode, u32 *pa pkt = (pkt >> 2) | 0xf0000000; } - if (bit_parity(pkt) == 1) + if (parity32(pkt)) return IO_RESET; /* Acknowledge packet receipt */