aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/sti/sti_plane.c
diff options
context:
space:
mode:
authorTina Ruchandani <ruchandani.tina@gmail.com>2016-04-13 02:28:02 -0700
committerBenjamin Gaignard <benjamin.gaignard@linaro.org>2016-06-27 10:18:09 +0200
commit2c83f581611491e5efcc619e1198f0fcad9f330b (patch)
treeca23b1199709c00a324235bc1d9cea3d37c39ab4 /drivers/gpu/drm/sti/sti_plane.c
parentMerge tag 'mediatek-drm-2016-06-20' of git://git.pengutronix.de/git/pza/linux into drm-next (diff)
downloadlinux-dev-2c83f581611491e5efcc619e1198f0fcad9f330b.tar.xz
linux-dev-2c83f581611491e5efcc619e1198f0fcad9f330b.zip
drm/sti: Use 64-bit timestamps
'struct timespec' uses a 32-bit field for seconds, which will overflow in year 2038 and beyond. This patch is part of a larger attempt to remove instances of timeval, timespec and time_t, all of which suffer from the y2038 issue, from the kernel. Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/sti/sti_plane.c')
-rw-r--r--drivers/gpu/drm/sti/sti_plane.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/drivers/gpu/drm/sti/sti_plane.c b/drivers/gpu/drm/sti/sti_plane.c
index 85cee9098439..0cf3335ef37c 100644
--- a/drivers/gpu/drm/sti/sti_plane.c
+++ b/drivers/gpu/drm/sti/sti_plane.c
@@ -45,25 +45,15 @@ const char *sti_plane_to_str(struct sti_plane *plane)
#define STI_FPS_INTERVAL_MS 3000
-static int sti_plane_timespec_ms_diff(struct timespec lhs, struct timespec rhs)
-{
- struct timespec tmp_ts = timespec_sub(lhs, rhs);
- u64 tmp_ns = (u64)timespec_to_ns(&tmp_ts);
-
- do_div(tmp_ns, NSEC_PER_MSEC);
-
- return (u32)tmp_ns;
-}
-
void sti_plane_update_fps(struct sti_plane *plane,
bool new_frame,
bool new_field)
{
- struct timespec now;
+ ktime_t now;
struct sti_fps_info *fps;
int fpks, fipks, ms_since_last, num_frames, num_fields;
- getrawmonotonic(&now);
+ now = ktime_get();
/* Compute number of frame updates */
fps = &plane->fps_info;
@@ -76,7 +66,7 @@ void sti_plane_update_fps(struct sti_plane *plane,
return;
fps->curr_frame_counter++;
- ms_since_last = sti_plane_timespec_ms_diff(now, fps->last_timestamp);
+ ms_since_last = ktime_to_ms(ktime_sub(now, fps->last_timestamp));
num_frames = fps->curr_frame_counter - fps->last_frame_counter;
if (num_frames <= 0 || ms_since_last < STI_FPS_INTERVAL_MS)