Date: Wed, 29 Apr 2026 21:43:10 +0000 From: Jean-=?utf-8?Q?S=C3=A9bast?==?utf-8?Q?ien P=C3=A9?=dron <dumbbell@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: dd7e503a181a - stable/15 - linuxkpi: Move `ARRAY_SIZE` to <linux/array_size.h> Message-ID: <69f27b6e.46ff6.48632780@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/15 has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=dd7e503a181a590db6ddef1e6aabeae62e248d40 commit dd7e503a181a590db6ddef1e6aabeae62e248d40 Author: Jean-Sébastien Pédron <dumbbell@FreeBSD.org> AuthorDate: 2026-04-20 21:34:08 +0000 Commit: Jean-Sébastien Pédron <dumbbell@FreeBSD.org> CommitDate: 2026-04-29 21:04:15 +0000 linuxkpi: Move `ARRAY_SIZE` to <linux/array_size.h> The DRM generic code started to import this header directly in Linux 6.12.x. Let's move the definition of `ARRAY_SIZE()` (the only thing that <linux/array_size.h> defines) to this header. Also, include <linux/array_size.h> from the same headers as Linux. This includes <linux/kernel.h>, so the change should not break anything. Reviewed by: bz Sponsored by: The FreeBSD Foundation (cherry picked from commit 1c641d0436e377c57a767e37f56ce65253817d67) --- sys/compat/linuxkpi/common/include/linux/array_size.h | 17 +++++++++++++++++ sys/compat/linuxkpi/common/include/linux/kernel.h | 3 +-- sys/compat/linuxkpi/common/include/linux/kfifo.h | 1 + sys/compat/linuxkpi/common/include/linux/string.h | 1 + 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/array_size.h b/sys/compat/linuxkpi/common/include/linux/array_size.h new file mode 100644 index 000000000000..ebfaeccc9536 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/array_size.h @@ -0,0 +1,17 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2010 Isilon Systems, Inc. + * Copyright (c) 2010 iX Systems, Inc. + * Copyright (c) 2010 Panasas, Inc. + * All rights reserved. + */ + +#ifndef _LINUXKPI_LINUX_ARRAY_SIZE_H_ +#define _LINUXKPI_LINUX_ARRAY_SIZE_H_ + +#include <linux/compiler.h> + +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) + +#endif /* _LINUXKPI_LINUX_ARRAY_SIZE_H_ */ diff --git a/sys/compat/linuxkpi/common/include/linux/kernel.h b/sys/compat/linuxkpi/common/include/linux/kernel.h index 8caaf520fd3e..afbd9208a410 100644 --- a/sys/compat/linuxkpi/common/include/linux/kernel.h +++ b/sys/compat/linuxkpi/common/include/linux/kernel.h @@ -40,6 +40,7 @@ #include <sys/syslog.h> #include <sys/time.h> +#include <linux/array_size.h> #include <linux/bitops.h> #include <linux/build_bug.h> #include <linux/compiler.h> @@ -266,8 +267,6 @@ extern int linuxkpi_debug; }) #endif -#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) - #define u64_to_user_ptr(val) ((void *)(uintptr_t)(val)) #define offsetofend(t, m) \ diff --git a/sys/compat/linuxkpi/common/include/linux/kfifo.h b/sys/compat/linuxkpi/common/include/linux/kfifo.h index b0d0c17f07e4..c8cea1226b3c 100644 --- a/sys/compat/linuxkpi/common/include/linux/kfifo.h +++ b/sys/compat/linuxkpi/common/include/linux/kfifo.h @@ -30,6 +30,7 @@ #include <sys/types.h> +#include <linux/array_size.h> #include <linux/slab.h> #include <linux/gfp.h> diff --git a/sys/compat/linuxkpi/common/include/linux/string.h b/sys/compat/linuxkpi/common/include/linux/string.h index ad2b2fe7d377..ba6549804edc 100644 --- a/sys/compat/linuxkpi/common/include/linux/string.h +++ b/sys/compat/linuxkpi/common/include/linux/string.h @@ -31,6 +31,7 @@ #include <sys/ctype.h> +#include <linux/array_size.h> #include <linux/types.h> #include <linux/gfp.h> #include <linux/slab.h>home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69f27b6e.46ff6.48632780>
