[Concept,12/16] ext4l: Move umin to linux/minmax.h
Commit Message
From: Simon Glass <simon.glass@canonical.com>
Move the umin() macro to include/linux/minmax.h and add the matching
umax() macro. These return the minimum/maximum of two unsigned values.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---
fs/ext4l/ext4_uboot.h | 3 +--
include/linux/minmax.h | 18 ++++++++++++++++++
2 files changed, 19 insertions(+), 2 deletions(-)
@@ -699,8 +699,7 @@ struct dx_hash_info {
/* indirect.c stubs */
-/* umin - unsigned min (Linux 6.x) */
-#define umin(x, y) ((x) < (y) ? (x) : (y))
+/* umin is in linux/minmax.h */
/* truncate_inode_pages is in linux/pagemap.h */
@@ -49,4 +49,22 @@ static inline bool in_range32(u32 val, u32 start, u32 len)
return (val - start) < len;
}
+/**
+ * umin - Return the minimum of two unsigned values
+ * @x: First value
+ * @y: Second value
+ *
+ * Return: The smaller of @x and @y
+ */
+#define umin(x, y) ((x) < (y) ? (x) : (y))
+
+/**
+ * umax - Return the maximum of two unsigned values
+ * @x: First value
+ * @y: Second value
+ *
+ * Return: The larger of @x and @y
+ */
+#define umax(x, y) ((x) > (y) ? (x) : (y))
+
#endif /* _LINUX_MINMAX_H */