summaryrefslogtreecommitdiff
path: root/v4l/compat.h
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2009-03-06 17:43:12 +0100
committerHans Verkuil <hverkuil@xs4all.nl>2009-03-06 17:43:12 +0100
commiteb8b7bf49ccc32d335f2b934431aeb5fc24220c2 (patch)
tree685897c523df17cffcae95d9d368d31a58dba25d /v4l/compat.h
parent706b9e26b99f3461c34fd3a397d73e0a0d60aafb (diff)
downloadmediapointer-dvb-s2-eb8b7bf49ccc32d335f2b934431aeb5fc24220c2.tar.gz
mediapointer-dvb-s2-eb8b7bf49ccc32d335f2b934431aeb5fc24220c2.tar.bz2
v4l/compat.h: add clamp_val
From: Hans Verkuil <hverkuil@xs4all.nl> Priority: normal Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Diffstat (limited to 'v4l/compat.h')
-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