]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
bitops: collect BIT macros to include/linux/bitops.h
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Tue, 21 Nov 2017 17:38:11 +0000 (02:38 +0900)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Tue, 28 Nov 2017 15:28:57 +0000 (00:28 +0900)
Same macros are defined in various places.  Collect them into
include/linux/bitops.h like Linux.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
arch/arm/include/asm/arch-sunxi/dram_sunxi_dw.h
arch/arm/mach-kirkwood/include/mach/gpio.h
drivers/gpio/kw_gpio.c
drivers/mtd/nand/nand_base.c
include/linux/bitops.h
include/usb/lin_gadget_compat.h

index 03fd46b724fd316179d34520d3f68676f8caf70a..66e206dd52fb1aa718bab756e331b768a4f81755 100644 (file)
@@ -13,6 +13,8 @@
 #ifndef _SUNXI_DRAM_SUN8I_H3_H
 #define _SUNXI_DRAM_SUN8I_H3_H
 
+#include <linux/bitops.h>
+
 struct sunxi_mctl_com_reg {
        u32 cr;                 /* 0x00 control register */
        u32 cr_r1;              /* 0x04 rank 1 control register (R40 only) */
@@ -211,7 +213,6 @@ struct sunxi_mctl_ctl_reg {
  * the 32-bit wide access consists of. Also three control signals can be
  * adjusted individually.
  */
-#define BITS_PER_BYTE          8
 #define NR_OF_BYTE_LANES       (32 / BITS_PER_BYTE)
 /* The eight data lines (DQn) plus DM, DQS and DQSN */
 #define LINES_PER_BYTE_LANE    (BITS_PER_BYTE + 3)
index aa8c5da36d35c4b3102083b1f8f9c916f0e0f622..ac2397dd4ce4a84e796ab751404a7d5c7ed33512 100644 (file)
 #ifndef __KIRKWOOD_GPIO_H
 #define __KIRKWOOD_GPIO_H
 
-/* got from kernel include/linux/bitops.h */
-#define BITS_PER_BYTE 8
-#define BITS_TO_LONGS(nr)      DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
-
 #define GPIO_MAX               50
 #define GPIO_OFF(pin)          (((pin) >> 5) ? 0x0040 : 0x0000)
 #define GPIO_OUT(pin)          (MVEBU_GPIO0_BASE + GPIO_OFF(pin) + 0x00)
index 43b27e3fea1bc86f5fbef46f969a7f8ff0322286..cc26cc165856766ff24370b359b48b490c799ba1 100644 (file)
@@ -14,7 +14,7 @@
  */
 
 #include <common.h>
-#include <asm/bitops.h>
+#include <linux/bitops.h>
 #include <asm/io.h>
 #include <asm/arch/soc.h>
 #include <asm/arch/gpio.h>
index 5bb4ea859b3e3bd0176c7bc6f3853708cc864324..efe3e4fe7bd48e6d2524ccaf44775cf40eef423d 100644 (file)
@@ -901,8 +901,6 @@ static int nand_wait(struct mtd_info *mtd, struct nand_chip *chip)
        return status;
 }
 
-#define BITS_PER_BYTE 8
-
 /**
  * nand_check_erased_buf - check if a buffer contains (almost) only 0xff data
  * @buf: buffer to test
index 576b15dc53c33381eccd7fe02efd9bd73615adc3..a47f6d17bb5f2571982c26650b96c237fad68b5d 100644 (file)
@@ -5,9 +5,16 @@
 #include <asm-generic/bitsperlong.h>
 #include <linux/compiler.h>
 
+#ifdef __KERNEL__
 #define BIT(nr)                        (1UL << (nr))
+#define BIT_ULL(nr)            (1ULL << (nr))
 #define BIT_MASK(nr)           (1UL << ((nr) % BITS_PER_LONG))
 #define BIT_WORD(nr)           ((nr) / BITS_PER_LONG)
+#define BIT_ULL_MASK(nr)       (1ULL << ((nr) % BITS_PER_LONG_LONG))
+#define BIT_ULL_WORD(nr)       ((nr) / BITS_PER_LONG_LONG)
+#define BITS_PER_BYTE          8
+#define BITS_TO_LONGS(nr)      DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
+#endif
 
 /*
  * Create a contiguous bitmask starting at bit position @l and ending at
index 4a01585f809427e9d06ed8c50d7fafd97a766f12..d0d71f7c321e4de18b5d1d76bf0ac817e74b13fa 100644 (file)
 #ifndef __LIN_COMPAT_H__
 #define __LIN_COMPAT_H__
 
+#include <linux/bitops.h>
 #include <linux/compat.h>
 
 /* common */
-#define BITS_PER_BYTE                          8
-#define BITS_TO_LONGS(nr) \
-       DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
 #define DECLARE_BITMAP(name, bits) \
        unsigned long name[BITS_TO_LONGS(bits)]