diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-09-15 13:56:01 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-09-15 13:56:01 -0300 |
commit | 136a9b83fb4cb819c2f27cbb5948d26cec0e7934 (patch) | |
tree | 397919f977ae7937aa60a5001f62f0ba3faef2db /v4l/compat.h | |
parent | fdafaa4f7e2ea516dbd7791f362f05273aaaa6cc (diff) | |
parent | c5d1ee111d9e00f9ce75e48e5e3806fdcd681a83 (diff) | |
download | mediapointer-dvb-s2-136a9b83fb4cb819c2f27cbb5948d26cec0e7934.tar.gz mediapointer-dvb-s2-136a9b83fb4cb819c2f27cbb5948d26cec0e7934.tar.bz2 |
merge: http://kernellabs.com/hg/~mkrufky/tda18271-merge
From: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'v4l/compat.h')
-rw-r--r-- | v4l/compat.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/v4l/compat.h b/v4l/compat.h index 11dc57109..465b3ae8b 100644 --- a/v4l/compat.h +++ b/v4l/compat.h @@ -72,6 +72,15 @@ #define vmalloc_32_user(a) vmalloc_32(a) #endif +#ifndef DIV_ROUND_CLOSEST +#define DIV_ROUND_CLOSEST(x, divisor)( \ +{ \ + typeof(divisor) __divisor = divisor; \ + (((x) + ((__divisor) / 2)) / (__divisor)); \ +} \ +) +#endif + #ifdef NEED_BOOL_TYPE /* bool type and enum-based definition of true and false was added in 2.6.19 */ typedef int bool; @@ -480,4 +489,29 @@ static inline unsigned long v4l_compat_fls(unsigned long x) } #endif +/* + * Compatibility code for hrtimer API + * This will make hrtimer usable for kernels 2.6.22 and later. + * For earlier kernels, not all required functions are exported + * so there's nothing we can do. + */ + +#ifdef _LINUX_HRTIMER_H +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25) && \ + LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22) +/* Forward a hrtimer so it expires after the hrtimer's current now */ +static inline unsigned long hrtimer_forward_now(struct hrtimer *timer, + ktime_t interval) +{ + return hrtimer_forward(timer, timer->base->get_time(), interval); +} +#endif +#endif /* _LINUX_HRTIMER_H */ + +#ifndef PCI_VDEVICE +#define PCI_VDEVICE(vendor, device) \ + PCI_VENDOR_ID_##vendor, (device), \ + PCI_ANY_ID, PCI_ANY_ID, 0, 0 +#endif + #endif /* _COMPAT_H */ |