public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Matthias Kaehlcke <matthias@kaehlcke.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] Introduce BIT macro
Date: Thu, 11 Feb 2010 21:03:02 +0100	[thread overview]
Message-ID: <20100211200302.GE15905@darwin> (raw)

Most code defines constants for bit positions by means of "(1 << n)". The Linux
kernel defines the BIT macro for this purpose, providing a uniform and more
readable way to define these constants. This patch adds the BIT macro to
linux/bitops.h, and removes its local definitions from davinci and ixp code.

Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>
---
 cpu/arm926ejs/davinci/cpu.c          |    2 --
 cpu/ixp/npe/include/IxOsalOsIxp400.h |    2 --
 include/asm-arm/arch-ixp/ixp425.h    |    2 --
 include/linux/bitops.h               |    1 +
 4 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/cpu/arm926ejs/davinci/cpu.c b/cpu/arm926ejs/davinci/cpu.c
index fc3551c..c274ddd 100644
--- a/cpu/arm926ejs/davinci/cpu.c
+++ b/cpu/arm926ejs/davinci/cpu.c
@@ -40,8 +40,6 @@
 #define PLLC_PLLDIV8	0x170
 #define PLLC_PLLDIV9	0x174
 
-#define BIT(x)		(1 << (x))
-
 /* SOC-specific pll info */
 #ifdef CONFIG_SOC_DM355
 #define ARM_PLLDIV	PLLC_PLLDIV1
diff --git a/cpu/ixp/npe/include/IxOsalOsIxp400.h b/cpu/ixp/npe/include/IxOsalOsIxp400.h
index 44a94fb..5e09651 100644
--- a/cpu/ixp/npe/include/IxOsalOsIxp400.h
+++ b/cpu/ixp/npe/include/IxOsalOsIxp400.h
@@ -47,8 +47,6 @@
 #ifndef IxOsalOsIxp400_H
 #define IxOsalOsIxp400_H
 
-#define BIT(x) (1<<(x))
-
 #define IXP425_EthA_BASE	0xc8009000
 #define IXP425_EthB_BASE	0xc800a000
 
diff --git a/include/asm-arm/arch-ixp/ixp425.h b/include/asm-arm/arch-ixp/ixp425.h
index 2114437..689e1ac 100644
--- a/include/asm-arm/arch-ixp/ixp425.h
+++ b/include/asm-arm/arch-ixp/ixp425.h
@@ -14,8 +14,6 @@
 #ifndef _ASM_ARM_IXP425_H_
 #define _ASM_ARM_IXP425_H_
 
-#define BIT(x)	(1<<(x))
-
 /* FIXME: Only this does work for u-boot... find out why... [RS] */
 #define UBOOT_REG_FIX 1
 #ifdef UBOOT_REG_FIX
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index e724310..c098c9a 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -104,6 +104,7 @@ static inline unsigned int generic_hweight8(unsigned int w)
 	return (res & 0x0F) + ((res >> 4) & 0x0F);
 }
 
+#define BIT(nr)			(1UL << (nr))
 #define BIT_MASK(nr)		(1UL << ((nr) % BITS_PER_LONG))
 #define BIT_WORD(nr)		((nr) / BITS_PER_LONG)
 
-- 
1.6.5

             reply	other threads:[~2010-02-11 20:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-11 20:03 Matthias Kaehlcke [this message]
2010-02-11 20:46 ` [U-Boot] [PATCH] Introduce BIT macro Wolfgang Denk
2010-02-11 20:59   ` Matthias Kaehlcke

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=20100211200302.GE15905@darwin \
    --to=matthias@kaehlcke.net \
    --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