diff options
author | Rob Clark <robdclark@gmail.com> | 2016-03-16 14:57:22 -0400 |
---|---|---|
committer | Rob Clark <robdclark@gmail.com> | 2016-05-08 10:16:03 -0400 |
commit | 340ff4104f4454f8f1c3bf793c46411115309545 (patch) | |
tree | aade7554b941603b793bbd4ff837f1d63f1beb22 /drivers/gpu/drm/msm/msm_drv.h | |
parent | 79f0e20215bb902352cf7eb31222f4120563775c (diff) | |
download | op-kernel-dev-340ff4104f4454f8f1c3bf793c46411115309545.zip op-kernel-dev-340ff4104f4454f8f1c3bf793c46411115309545.tar.gz |
drm/msm: split out timeout_to_jiffies helper
Signed-off-by: Rob Clark <robdclark@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/msm/msm_drv.h')
-rw-r--r-- | drivers/gpu/drm/msm/msm_drv.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index 86b7b37..af007ac 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -302,5 +302,20 @@ static inline int align_pitch(int width, int bpp) /* for conditionally setting boolean flag(s): */ #define COND(bool, val) ((bool) ? (val) : 0) +static inline unsigned long timeout_to_jiffies(const ktime_t *timeout) +{ + ktime_t now = ktime_get(); + unsigned long remaining_jiffies; + + if (ktime_compare(*timeout, now) < 0) { + remaining_jiffies = 0; + } else { + ktime_t rem = ktime_sub(*timeout, now); + struct timespec ts = ktime_to_timespec(rem); + remaining_jiffies = timespec_to_jiffies(&ts); + } + + return remaining_jiffies; +} #endif /* __MSM_DRV_H__ */ |