diff options
author | Imre Deak <imre.deak@intel.com> | 2013-05-21 13:03:17 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-05-22 07:51:15 -0400 |
commit | df97729f1bcb5055ba414f08b48364d46c6baef0 (patch) | |
tree | c7a0f7bbf5d185d7d92d56abe6df72c26756b5d0 /drivers/gpu/drm/i915/i915_drv.h | |
parent | e3de42b68478a8c95dd27520e9adead2af9477a5 (diff) |
drm/i915: add msecs_to_jiffies_timeout to guarantee minimum duration
We need this to avoid premature timeouts whenever scheduling a timeout
based on the current jiffies value. For an explanation see [1].
The following patches will take the helper into use.
Once the more generic solution proposed in the thread at [1] is accepted
this patch can be reverted while keeping the follow-up patches.
[1] http://marc.info/?l=linux-kernel&m=136854294730957&w=2
Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_drv.h')
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index d5dcf7fe1ee9..b9d00dcf9a2d 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -1943,4 +1943,19 @@ static inline void __user *to_user_ptr(u64 address) | |||
1943 | return (void __user *)(uintptr_t)address; | 1943 | return (void __user *)(uintptr_t)address; |
1944 | } | 1944 | } |
1945 | 1945 | ||
1946 | static inline unsigned long msecs_to_jiffies_timeout(const unsigned int m) | ||
1947 | { | ||
1948 | unsigned long j = msecs_to_jiffies(m); | ||
1949 | |||
1950 | return min_t(unsigned long, MAX_JIFFY_OFFSET, j + 1); | ||
1951 | } | ||
1952 | |||
1953 | static inline unsigned long | ||
1954 | timespec_to_jiffies_timeout(const struct timespec *value) | ||
1955 | { | ||
1956 | unsigned long j = timespec_to_jiffies(value); | ||
1957 | |||
1958 | return min_t(unsigned long, MAX_JIFFY_OFFSET, j + 1); | ||
1959 | } | ||
1960 | |||
1946 | #endif | 1961 | #endif |