summaryrefslogtreecommitdiff
path: root/include/linux/bitops.h
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2020-01-20 14:54:55 -0500
committerTom Rini <[email protected]>2020-01-20 14:54:55 -0500
commit07add22cab3be86067c227a30ad5d0feab541316 (patch)
tree9731f3a2a402d60f5a0d93fee6856d9fd1dc87b7 /include/linux/bitops.h
parentcd304e218012de4ac2e3d55e869b2102af4fdcb2 (diff)
parent1adea9cc03a73d43a8f5c88659fa163fe21b382b (diff)
Merge tag '2020-01-20-ti-2020.04' of https://gitlab.denx.de/u-boot/custodians/u-boot-ti
K3 J721E: * DMA support. * MMC and ADMA support. * EEPROM support. * J721e High Security EVM support. * USB DT nodes K3 AM654: * Fixed boot due to pmic probe error. * USB support and DT nodes. * ADMA support DRA7xx/AM57xx: * BBAI board support * Clean up of net platform code under board/ti AM33/AM43/Davinci: * Reduce SPL size for omap3 boards. * SPL DT support for da850-lcdk * PLL divider fix for AM335x
Diffstat (limited to 'include/linux/bitops.h')
-rw-r--r--include/linux/bitops.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index 259df43fb00..a07c70fd485 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -4,6 +4,7 @@
#include <asm/types.h>
#include <asm-generic/bitsperlong.h>
#include <linux/compiler.h>
+#include <linux/kernel.h>
#ifdef __KERNEL__
#define BIT(nr) (1UL << (nr))
@@ -133,6 +134,17 @@ static inline unsigned int generic_hweight8(unsigned int w)
return (res & 0x0F) + ((res >> 4) & 0x0F);
}
+static inline unsigned long generic_hweight64(__u64 w)
+{
+ return generic_hweight32((unsigned int)(w >> 32)) +
+ generic_hweight32((unsigned int)w);
+}
+
+static inline unsigned long hweight_long(unsigned long w)
+{
+ return sizeof(w) == 4 ? generic_hweight32(w) : generic_hweight64(w);
+}
+
#include <asm/bitops.h>
/* linux/include/asm-generic/bitops/non-atomic.h */