aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2021-11-28 11:00:34 +0100
committerIngo Molnar <mingo@kernel.org>2022-03-15 12:57:35 +0100
commit80c4496c7f6fe9380008050a7667a009b54738b3 (patch)
tree39468cf73d43f19820c8ad7f097993bafa559094
parent75357fc436a95fccd2c5718ad6c01ad061db3bb6 (diff)
downloadtip-80c4496c7f6fe9380008050a7667a009b54738b3.tar.gz
headers/deps: hashtable_types: Use ilog2_const()
Make HASH_BITS() use ilog2_const(). Since it uses ARRAY_SIZE(), which is not supposed to be used on dynamic arrays, this shouldn't be a limitation in practice. If some code uses it that way, a compiler error or warning should alert us, due to HASH_BITS() returning -1. I hope. :-/ Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--include/linux/hashtable_types.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/hashtable_types.h b/include/linux/hashtable_types.h
index c11bee62b158f4..c5e7539a1e5596 100644
--- a/include/linux/hashtable_types.h
+++ b/include/linux/hashtable_types.h
@@ -22,7 +22,7 @@
struct hlist_head name[1 << (bits)]
#define HASH_SIZE(name) (ARRAY_SIZE(name))
-#define HASH_BITS(name) ilog2(HASH_SIZE(name))
+#define HASH_BITS(name) const_ilog2(HASH_SIZE(name))
/* Use hash_32 when possible to allow for fast 32bit hashing in 64bit kernels. */
#define hash_min(val, bits) \