summaryrefslogtreecommitdiff
path: root/v4l/compat.h
diff options
context:
space:
mode:
Diffstat (limited to 'v4l/compat.h')
-rw-r--r--v4l/compat.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/v4l/compat.h b/v4l/compat.h
index 6a40e2a33..6b3504706 100644
--- a/v4l/compat.h
+++ b/v4l/compat.h
@@ -283,10 +283,14 @@ static inline int dummy_algo_control(struct i2c_adapter *adapter,
})
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 28)
+#ifdef NEED_SND_BUG_ON
#define snd_BUG_ON(cond) WARN((cond), "BUG? (%s)\n", __stringify(cond))
#endif
+#ifdef NEED_BITOPS
+#define BIT(x) (1UL<<((x)%BITS_PER_LONG))
+#endif
+
#ifndef PCI_DEVICE_ID_MARVELL_88ALP01_CCIC
#define PCI_DEVICE_ID_MARVELL_88ALP01_CCIC 0x4102
#endif
@@ -454,4 +458,20 @@ static inline int snd_card_create(int idx, const char *id,
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
#endif
+/* __fls() was added for generic code in 2.6.29, existed for just 64-bit arches
+ * since 2.6.26 (v2.6.25-5228-g56a6b1e), and was x86-64 only before then. We
+ * only want this compat code when __fls doesn't exist, which 2.6.29 or later,
+ * non x86-64, and non 64-bit that's 2.6.26 or later. */
+#if !(LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29) || \
+ defined(__x86_64__) || \
+ (BITS_PER_LONG == 64 && LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)))
+/* This define will prevent breakage if __fls was already defined. */
+#undef __fls
+#define __fls v4l_compat_fls
+static inline unsigned long v4l_compat_fls(unsigned long x)
+{
+ return fls(x) - 1;
+}
+#endif
+
#endif /* _COMPAT_H */