diff options
| author | Jean-Sébastien Pédron <dumbbell@FreeBSD.org> | 2026-04-12 10:16:55 +0000 |
|---|---|---|
| committer | Jean-Sébastien Pédron <dumbbell@FreeBSD.org> | 2026-04-22 18:09:54 +0000 |
| commit | ab77c26d3643b88b29d3526d60b939d1cca402f9 (patch) | |
| tree | 91089566cf477433c3c8d7e89ec8c2b5ad7399d4 | |
| parent | 373871696d3da5f9fe1dcd23c83be95dbaa1b41d (diff) | |
linuxkpi: Add `mem_is_zero()`
The DRM generic code and the i915 DRM driver started to replace the use
of `memchr_inv()` by a `mem_is_zero()` in Linux 6.12. We reuse the
previous use of `memchr_inv()` to implement `mem_is_zero()`.
Reviewed by: bz
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D56442
| -rw-r--r-- | sys/compat/linuxkpi/common/include/linux/string.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/string.h b/sys/compat/linuxkpi/common/include/linux/string.h index 0b858e7af623..8ca20df27792 100644 --- a/sys/compat/linuxkpi/common/include/linux/string.h +++ b/sys/compat/linuxkpi/common/include/linux/string.h @@ -198,6 +198,12 @@ memchr_inv(const void *start, int c, size_t length) return (NULL); } +static inline bool +mem_is_zero(const void *start, size_t length) +{ + return (memchr_inv(start, 0, length) == NULL); +} + static inline size_t str_has_prefix(const char *str, const char *prefix) { |
