summaryrefslogtreecommitdiff
path: root/v4l
diff options
context:
space:
mode:
Diffstat (limited to 'v4l')
-rw-r--r--v4l/compat.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/v4l/compat.h b/v4l/compat.h
index 3df844c87..16ff90bc4 100644
--- a/v4l/compat.h
+++ b/v4l/compat.h
@@ -238,6 +238,12 @@ static inline int list_is_singular(const struct list_head *head)
min_t( __typeof__( x ), \
( h ), \
( x ) ) )
+#define clamp_val(val, min, max) ({ \
+ typeof(val) __val = (val); \
+ typeof(val) __min = (min); \
+ typeof(val) __max = (max); \
+ __val = __val < __min ? __min : __val; \
+ __val > __max ? __max : __val; })
#endif
#ifdef NEED_ALGO_CONTROL