diff options
Diffstat (limited to 'v4l/compat.h')
-rw-r--r-- | v4l/compat.h | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/v4l/compat.h b/v4l/compat.h index 8e778d7f5..ce28da615 100644 --- a/v4l/compat.h +++ b/v4l/compat.h @@ -36,6 +36,10 @@ #include <sound/driver.h> #endif +#ifdef NEED_SND_CARD_CREATE +#include <sound/core.h> +#endif + #ifdef NEED_ALGO_CONTROL #include <linux/i2c.h> #endif @@ -423,7 +427,7 @@ static inline int usb_endpoint_type(const struct usb_endpoint_descriptor *epd) pci_resource_len(pdev, bar)) #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29) +#ifdef NEED_POLL_SCHEDULE #define poll_schedule(pwq, task) \ do { \ set_current_state(task); \ @@ -432,4 +436,37 @@ static inline int usb_endpoint_type(const struct usb_endpoint_descriptor *epd) } while (0) #endif +#ifdef NEED_SND_CARD_CREATE +static inline int snd_card_create(int idx, const char *id, + struct module *module, int extra_size, + struct snd_card **card) +{ + *card = snd_card_new(idx, id, module, extra_size); + + if (*card == NULL) + return -ENOMEM; + return 0; +} #endif + +/* This macro was added in commit v2.6.23-5792-g34c6538 */ +#ifndef DMA_BIT_MASK +#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. */ +#define __fls v4l_compat_fls +static inline unsigned long v4l_compat_fls(unsigned long x) +{ + return fls(x) - 1; +} +#endif + +#endif /* _COMPAT_H */ |