diff options
author | Gerd Knorr <devnull@localhost> | 2004-10-05 12:57:08 +0000 |
---|---|---|
committer | Gerd Knorr <devnull@localhost> | 2004-10-05 12:57:08 +0000 |
commit | bcc9e747d2ce00c7e3d9238508fc04ce32958ef3 (patch) | |
tree | b02a6ee38c72ed96bd55cb236d0e1bc5b0696e67 /v4l/compat.h | |
parent | b5ec404857ece5b3a8203e9fac09be563a35f3ab (diff) | |
download | mediapointer-dvb-s2-bcc9e747d2ce00c7e3d9238508fc04ce32958ef3.tar.gz mediapointer-dvb-s2-bcc9e747d2ce00c7e3d9238508fc04ce32958ef3.tar.bz2 |
- misc build fixes.
- start switching over msp34xx to v4l2.
Diffstat (limited to 'v4l/compat.h')
-rw-r--r-- | v4l/compat.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/v4l/compat.h b/v4l/compat.h index 354f55736..fa33f82db 100644 --- a/v4l/compat.h +++ b/v4l/compat.h @@ -32,6 +32,16 @@ static inline unsigned long msecs_to_jiffies(const unsigned int m) return (m * HZ + 999) / 1000; #endif } +static inline unsigned int jiffies_to_msecs(const unsigned long j) +{ +#if HZ <= 1000 && !(1000 % HZ) + return (1000 / HZ) * j; +#elif HZ > 1000 && !(HZ % 1000) + return (j + (HZ / 1000) - 1)/(HZ / 1000); +#else + return (j * 1000) / HZ; +#endif +} static inline void msleep(unsigned int msecs) { unsigned long timeout = msecs_to_jiffies(msecs); @@ -41,6 +51,18 @@ static inline void msleep(unsigned int msecs) } } #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9) +static inline unsigned long msleep_interruptible(unsigned int msecs) +{ + unsigned long timeout = msecs_to_jiffies(msecs); + + while (timeout) { + set_current_state(TASK_INTERRUPTIBLE); + timeout = schedule_timeout(timeout); + } + return jiffies_to_msecs(timeout); +} +#endif /* * Local variables: |