From patchwork Tue Aug 11 05:49:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yalin wang X-Patchwork-Id: 6988321 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 B35F1C05AC for ; Tue, 11 Aug 2015 05:49:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DC6A120574 for ; Tue, 11 Aug 2015 05:49:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 058EC204B5 for ; Tue, 11 Aug 2015 05:49:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753475AbbHKFtj (ORCPT ); Tue, 11 Aug 2015 01:49:39 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:36387 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753094AbbHKFti convert rfc822-to-8bit (ORCPT ); Tue, 11 Aug 2015 01:49:38 -0400 Received: by pacrr5 with SMTP id rr5so119886723pac.3; Mon, 10 Aug 2015 22:49:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-type:content-transfer-encoding:subject:message-id:date :to:mime-version; bh=0XSVCrE2lYazyIHaqwIc8oUP582cOh6u2kWFiqqOW7k=; b=NF7ZDtYgE6ZRF75fRW/zAzdquLYZEvstkLl8sK1MCesYtxrRI/jZKM7/Tf+vElZuDf bdPhO/RjBlukWn8NF5IrIaxENNCmKK4i0zXnrCyHaPedN9mpLn5ngtiBexhwyPMoEP9c 9TjQwx/PEIIidgHXI4aSGxQQb0+FfXnLe0i2E79mxTLKeLfFIiugtWhaTGy6EbmL+8Se NMA0+JP1Bei6BsVH7kDU9GmoCOO6MzysxVVJ6UOIqg1sIGwV6zjSRq0SX6XBQ3y7miTX cQD8mcmCgXQXSffJAzDtxevzHMs5npbWENfR4rBsWI25C5fQdlzZTeYl10SrLQJromzO 8Dkg== X-Received: by 10.68.96.65 with SMTP id dq1mr52553673pbb.70.1439272177840; Mon, 10 Aug 2015 22:49:37 -0700 (PDT) Received: from [17.87.29.244] ([17.87.29.244]) by smtp.gmail.com with ESMTPSA id fe8sm976333pab.40.2015.08.10.22.49.36 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Aug 2015 22:49:37 -0700 (PDT) From: yalin wang Subject: [PATCH] joystick/zhenhua: remove zhenhua_bitreverse() Message-Id: Date: Tue, 11 Aug 2015 13:49:34 +0800 To: linux-input@vger.kernel.org, open list Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2098\)) X-Mailer: Apple Mail (2.2098) 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.0 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 This change remove zhenhua_bitreverse() function, use generic bitrev8() function instead. Signed-off-by: yalin wang --- drivers/input/joystick/zhenhua.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/input/joystick/zhenhua.c b/drivers/input/joystick/zhenhua.c index 30af2e8..4a8258b 100644 --- a/drivers/input/joystick/zhenhua.c +++ b/drivers/input/joystick/zhenhua.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -72,16 +73,6 @@ struct zhenhua { char phys[32]; }; - -/* bits in all incoming bytes needs to be "reversed" */ -static int zhenhua_bitreverse(int x) -{ - x = ((x & 0xaa) >> 1) | ((x & 0x55) << 1); - x = ((x & 0xcc) >> 2) | ((x & 0x33) << 2); - x = ((x & 0xf0) >> 4) | ((x & 0x0f) << 4); - return x; -} - /* * zhenhua_process_packet() decodes packets the driver receives from the * RC transmitter. It updates the data accordingly. @@ -120,7 +111,7 @@ static irqreturn_t zhenhua_interrupt(struct serio *serio, unsigned char data, un return IRQ_HANDLED; /* wrong MSB -- ignore this byte */ if (zhenhua->idx < ZHENHUA_MAX_LENGTH) - zhenhua->data[zhenhua->idx++] = zhenhua_bitreverse(data); + zhenhua->data[zhenhua->idx++] = bitrev8(data); if (zhenhua->idx == ZHENHUA_MAX_LENGTH) { zhenhua_process_packet(zhenhua);