[PATCH 07/15] header: add upstream version of clamp()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



saa7164-encoder.c uses clamp() with constant values which fails on
kernel version < 3.18 because the code wants to creates values of the
same type and wants to assign variable values to them. The new code
works with this kind of usage, use the new code also on older kernel
versions to fix this problem.

Signed-off-by: Hauke Mehrtens <hauke@xxxxxxxxxx>
---
 backport/backport-include/linux/kernel.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/backport/backport-include/linux/kernel.h b/backport/backport-include/linux/kernel.h
index 63ffe98..c0eec2d 100644
--- a/backport/backport-include/linux/kernel.h
+++ b/backport/backport-include/linux/kernel.h
@@ -148,6 +148,11 @@
 int __must_check hex2bin(u8 *dst, const char *src, size_t count);
 #endif /* < 3.2 */
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0)
+#undef clamp
+#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
+#endif /* < 3.18 */
+
 #endif /* __BACKPORT_KERNEL_H */
 
 /*
-- 
2.6.2

--
To unsubscribe from this list: send the line "unsubscribe backports" in



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux