From patchwork Tue Oct 28 21:22:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Perches X-Patchwork-Id: 5179981 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0C6C1C11AC for ; Tue, 28 Oct 2014 21:25:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 39A7920158 for ; Tue, 28 Oct 2014 21:25:06 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3414D20154 for ; Tue, 28 Oct 2014 21:25:05 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XjEEY-0006Qd-Ss; Tue, 28 Oct 2014 21:23:18 +0000 Received: from smtprelay0183.hostedemail.com ([216.40.44.183] helo=smtprelay.hostedemail.com) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XjEEV-0006HW-Cg for linux-arm-kernel@lists.infradead.org; Tue, 28 Oct 2014 21:23:15 +0000 Received: from filter.hostedemail.com (ff-bigip1 [10.5.19.254]) by smtprelay03.hostedemail.com (Postfix) with ESMTP id BAD216AA30; Tue, 28 Oct 2014 21:22:53 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2, 0, 0, , d41d8cd98f00b204, joe@perches.com, :::::::::::::::::::::::::, RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1431:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3353:3865:3866:3867:3874:4321:5007:6261:6742:7808:7903:7904:10004:10400:10848:11026:11232:11473:11658:11914:12043:12438:12517:12519:12555:12740:13069:13311:13357:14196:14394:21080, 0, RBL:none, CacheIP:none, Bayesian:0.5, 0.5, 0.5, Netcheck:none, DomainCache:0, MSF:not bulk, SPF:fn, MSBL:0, DNSBL:none, Custom_rules:0:0:0 X-HE-Tag: actor33_36067225e591d X-Filterd-Recvd-Size: 2942 Received: from joe-X200MA.home (pool-71-103-235-196.lsanca.fios.verizon.net [71.103.235.196]) (Authenticated sender: joe@perches.com) by omf06.hostedemail.com (Postfix) with ESMTPA; Tue, 28 Oct 2014 21:22:51 +0000 (UTC) Message-ID: <1414531369.10912.14.camel@perches.com> Subject: [PATCH] 6fire: Convert byte_rev_table uses to bitrev8 From: Joe Perches To: Jaroslav Kysela , Takashi Iwai Date: Tue, 28 Oct 2014 14:22:49 -0700 In-Reply-To: <1414392371.8884.2.camel@perches.com> References: <35FD53F367049845BC99AC72306C23D103E010D18254@CNBJMBX05.corpusers.net> <35FD53F367049845BC99AC72306C23D103E010D18257@CNBJMBX05.corpusers.net> <1414392371.8884.2.camel@perches.com> X-Mailer: Evolution 3.12.7-0ubuntu1 Mime-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141028_142315_513039_D1549038 X-CRM114-Status: GOOD ( 13.92 ) X-Spam-Score: -0.0 (/) Cc: alsa-devel , Russell King , "Wang, Yalin" , Will Deacon , Akinobu Mita , LKML , linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Use the inline function instead of directly indexing the array. This allows some architectures with hardware instructions for bit reversals to eliminate the array. Signed-off-by: Joe Perches --- On Sun, 2014-10-26 at 23:46 -0700, Joe Perches wrote: > On Mon, 2014-10-27 at 14:37 +0800, Wang, Yalin wrote: > > this change add CONFIG_HAVE_ARCH_BITREVERSE config option, > > so that we can use arm/arm64 rbit instruction to do bitrev operation > > by hardware. [] > > diff --git a/include/linux/bitrev.h b/include/linux/bitrev.h > > index 7ffe03f..ef5b2bb 100644 > > --- a/include/linux/bitrev.h > > +++ b/include/linux/bitrev.h > > @@ -3,6 +3,14 @@ > > > > #include > > > > +#ifdef CONFIG_HAVE_ARCH_BITREVERSE > > +#include > > + > > +#define bitrev32 __arch_bitrev32 > > +#define bitrev16 __arch_bitrev16 > > +#define bitrev8 __arch_bitrev8 > > + > > +#else > > extern u8 const byte_rev_table[256]; sound/usb/6fire/firmware.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/usb/6fire/firmware.c b/sound/usb/6fire/firmware.c index 3b02e54..62c25e7 100644 --- a/sound/usb/6fire/firmware.c +++ b/sound/usb/6fire/firmware.c @@ -316,7 +316,7 @@ static int usb6fire_fw_fpga_upload( while (c != end) { for (i = 0; c != end && i < FPGA_BUFSIZE; i++, c++) - buffer[i] = byte_rev_table[(u8) *c]; + buffer[i] = bitrev8((u8)*c); ret = usb6fire_fw_fpga_write(device, buffer, i); if (ret < 0) {