From: Mike Dunn <mikedunn@newsguy.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 6/8] lib: import bitrev library from linux kernel
Date: Mon, 08 Apr 2013 09:46:26 -0700 [thread overview]
Message-ID: <5162F462.7060006@newsguy.com> (raw)
In-Reply-To: <201304080823.56302.marex@denx.de>
On 04/07/2013 11:23 PM, Marek Vasut wrote:
> Dear Mike Dunn,
>
>> This patch adds the bitrev library from the linux kernel. This is a simple
>> algorithm that uses an 8 bit look-up table to reverse the bits in data
>> types of 8, 16, or 32 bit widths. The docg4 nand flash driver uses it.
>>
>> Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
>> ---
>> include/linux/bitrev.h | 16 +++++++++++++
>> lib/Makefile | 1 +
>> lib/bitrev.c | 56
>> ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 73
>> insertions(+), 0 deletions(-)
>> create mode 100644 include/linux/bitrev.h
>> create mode 100644 lib/bitrev.c
>>
>> diff --git a/include/linux/bitrev.h b/include/linux/bitrev.h
>> new file mode 100644
>> index 0000000..7ffe03f
>> --- /dev/null
>> +++ b/include/linux/bitrev.h
>> @@ -0,0 +1,16 @@
>> +#ifndef _LINUX_BITREV_H
>> +#define _LINUX_BITREV_H
>> +
>> +#include <linux/types.h>
>> +
>> +extern u8 const byte_rev_table[256];
>> +
>> +static inline u8 bitrev8(u8 byte)
>> +{
>> + return byte_rev_table[byte];
>> +}
>> +
>> +extern u16 bitrev16(u16 in);
>> +extern u32 bitrev32(u32 in);
>
> Do we really need to expose the array and use so many externs here?
Yeah, I don't know why the function prototypes were given the 'extern'
specifier. This is how it is in the kernel. They aren't necessary.
As for the table... if the bitrev8() function is moved to bitrev.c, the table
need not be extern. But if I'm not mistaken, bitrev8() is in the header so that
it can be inlined by the compiler. So for the sake of performance I think the
extern is appropriate for the table.
Thanks Marek,
Mike
next prev parent reply other threads:[~2013-04-08 16:46 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-07 16:40 [U-Boot] [PATCH 0/8] palm treo 680 smartphone board support Mike Dunn
2013-04-07 16:40 ` [U-Boot] [PATCH 1/8] pxa_lcd: add the ACX544AKN lcd device Mike Dunn
2013-04-07 16:40 ` [U-Boot] [PATCH 2/8] pxa_lcd: make lcd_enable() a weak pointer Mike Dunn
2013-04-07 19:08 ` Fabio Estevam
2013-04-08 17:49 ` Mike Dunn
2013-04-07 16:41 ` [U-Boot] [PATCH 3/8] pxa_lcd: allow L_BIAS line to be unused Mike Dunn
2013-04-08 5:28 ` Marek Vasut
2013-04-09 17:02 ` Mike Dunn
2013-04-07 16:41 ` [U-Boot] [PATCH 4/8] pxa27x_udc: remove call to unimplemented set_GPIO_mode() Mike Dunn
2013-04-07 16:41 ` [U-Boot] [PATCH 5/8] arm: bootm: call udc_disable() before booting linux Mike Dunn
2013-04-08 5:29 ` Marek Vasut
2013-04-07 16:41 ` [U-Boot] [PATCH 6/8] lib: import bitrev library from linux kernel Mike Dunn
2013-04-08 6:23 ` Marek Vasut
2013-04-08 16:46 ` Mike Dunn [this message]
2013-04-08 7:38 ` Wolfgang Denk
2013-04-07 16:41 ` [U-Boot] [PATCH 7/8] mtd: nand: add driver for diskonchip g4 nand flash Mike Dunn
2013-04-08 6:25 ` Marek Vasut
2013-04-08 17:10 ` Mike Dunn
2013-04-08 17:26 ` Marek Vasut
2013-04-09 0:59 ` Scott Wood
2013-04-09 15:36 ` Mike Dunn
2013-04-07 16:41 ` [U-Boot] [PATCH 8/8] board support for palm treo 680 Mike Dunn
2013-04-08 6:27 ` Marek Vasut
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5162F462.7060006@newsguy.com \
--to=mikedunn@newsguy.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox