summaryrefslogtreecommitdiff
path: root/include/linux/string.h
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@intel.com>2024-09-11 13:23:00 -0700
committerLucas De Marchi <lucas.demarchi@intel.com>2024-09-11 14:10:02 -0700
commitc7c3c7b7400bef1ba14831c0a8ca1cdb35f32c94 (patch)
treea049e43c56dd8b636d5768918447ff9c398c8de0 /include/linux/string.h
parentfb2551a0e93897aec7fb3d4f473ebc06b146d160 (diff)
parentb615b9c36cae0468491547206406a909a9a37f26 (diff)
Merge drm/drm-next into drm-xe-next
Sync with drm-misc and drm-intel-next for common APIs and refactors. Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Diffstat (limited to 'include/linux/string.h')
-rw-r--r--include/linux/string.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/string.h b/include/linux/string.h
index 9edace076ddb..5855c5626b4b 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -279,6 +279,18 @@ static inline void memcpy_flushcache(void *dst, const void *src, size_t cnt)
void *memchr_inv(const void *s, int c, size_t n);
char *strreplace(char *str, char old, char new);
+/**
+ * mem_is_zero - Check if an area of memory is all 0's.
+ * @s: The memory area
+ * @n: The size of the area
+ *
+ * Return: True if the area of memory is all 0's.
+ */
+static inline bool mem_is_zero(const void *s, size_t n)
+{
+ return !memchr_inv(s, 0, n);
+}
+
extern void kfree_const(const void *x);
extern char *kstrdup(const char *s, gfp_t gfp) __malloc;