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(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 310d79227b7..b50004bca55 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -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 */ diff --git a/include/linux/minmax.h b/include/linux/minmax.h index 52ce477459d..38b27c0232f 100644 --- a/include/linux/minmax.h +++ b/include/linux/minmax.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 */ -- 2.43.0