From a2f35a3ccf9953ece897da27cd27701c60bc296d Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 2 May 2008 00:57:47 -0300 Subject: backport commit bdf4bbaaee3d4b8f555658333cbce1affe9070fb From: Mauro Carvalho Chehab kernel-sync: Author: Harvey Harrison Date: Wed Apr 30 00:54:55 2008 -0700 Add macros similar to min/max/min_t/max_t Also, change the variable names used in the min/max macros to avoid shadowed variable warnings when min/max min_t/max_t are nested. Small formatting changes to make all the macros have a similar form. [akpm@linux-foundation.org: coding-style fixes] [akpm@linux-foundation.org: fix v4l build] Signed-off-by: Mauro Carvalho Chehab --- v4l/compat.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'v4l') diff --git a/v4l/compat.h b/v4l/compat.h index 01847a319..49b04961f 100644 --- a/v4l/compat.h +++ b/v4l/compat.h @@ -554,6 +554,13 @@ static inline struct proc_dir_entry *proc_create(const char *a, #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) #define div64_u64(a,b) div64_64(a,b) + +#define clamp( x, l, h ) max_t( __typeof__( x ), \ + ( l ), \ + min_t( __typeof__( x ), \ + ( h ), \ + ( x ) ) ) + #endif #endif -- cgit v1.2.3