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: 5180811 X-Patchwork-Delegate: tiwai@suse.de Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B490D9F349 for ; Tue, 28 Oct 2014 21:40:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F010220176 for ; Tue, 28 Oct 2014 21:40:41 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id C87F2200ED for ; Tue, 28 Oct 2014 21:40:39 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id D7E392605CA; Tue, 28 Oct 2014 22:40:38 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id F3801261510; Tue, 28 Oct 2014 22:36:59 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 66706261522; Tue, 28 Oct 2014 22:36:58 +0100 (CET) Received: from smtprelay.hostedemail.com (smtprelay0081.hostedemail.com [216.40.44.81]) by alsa0.perex.cz (Postfix) with ESMTP id 63AF52619D8 for ; Tue, 28 Oct 2014 22:22:59 +0100 (CET) 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-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> 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 Cc: alsa-devel , Russell King , "Wang, Yalin" , Will Deacon , Akinobu Mita , LKML , linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org Subject: [alsa-devel] [PATCH] 6fire: Convert byte_rev_table uses to bitrev8 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.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) {