summaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/array_size.h
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2024-02-03 00:58:21 +0900
committerMasahiro Yamada <masahiroy@kernel.org>2024-02-19 18:20:41 +0900
commita6dac4002b88f0ad242ac20d9de86d11321ecf84 (patch)
treed1d62659b6ce342d6722e1abbee6088419f2a893 /scripts/kconfig/array_size.h
parent0a3128e75108cc23401aa5059b851ed047bfff0e (diff)
downloadlinux-stable-a6dac4002b88f0ad242ac20d9de86d11321ecf84.tar.gz
linux-stable-a6dac4002b88f0ad242ac20d9de86d11321ecf84.tar.bz2
linux-stable-a6dac4002b88f0ad242ac20d9de86d11321ecf84.zip
kconfig: move ARRAY_SIZE to a header
To use ARRAY_SIZE from other files, move it to its own header, just like include/linux/array_size.h. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Diffstat (limited to 'scripts/kconfig/array_size.h')
-rw-r--r--scripts/kconfig/array_size.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/kconfig/array_size.h b/scripts/kconfig/array_size.h
new file mode 100644
index 000000000000..26ba78d867d1
--- /dev/null
+++ b/scripts/kconfig/array_size.h
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef ARRAY_SIZE_H
+#define ARRAY_SIZE_H
+
+/**
+ * ARRAY_SIZE - get the number of elements in array @arr
+ * @arr: array to be sized
+ */
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+
+#endif /* ARRAY_SIZE_H */