drm/exynos: g2d: Replace struct timeval usage
Subsystems (3)
PATCH 1/1 drm/exynos: g2d: Replace struct timeval usage
'struct timeval' uses a 32-bit seconds representation which will overflow in the year 2038 and beyond. This patch replaces the use of struct timeval with struct timespec64 which uses a 64-bit seconds representation and is y2038 safe.
The patch is part of a larger effort to remove all 32-bit timekeeping variables (timeval, time_t and timespec) from the kernel.
Signed-off-by Tina Ruchandani <[email protected]>
--- drivers/gpu/drm/exynos/exynos_drm_g2d.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_g2d.c +4 -3
@@ -15,6 +15,7 @@#include <linux/platform_device.h> #include <linux/pm_runtime.h> #include <linux/slab.h> +#include <linux/time64.h> #include <linux/workqueue.h> #include <linux/dma-mapping.h> #include <linux/dma-attrs.h>
@@ -889,7 +890,7 @@ static void g2d_finish_event(struct g2d_data *g2d, u32 cmdlist_no)struct drm_device *drm_dev = g2d->subdrv.drm_dev;struct g2d_runqueue_node *runqueue_node = g2d->runqueue_node;struct drm_exynos_pending_g2d_event *e; -struct timeval now; +struct timespec64 now;unsigned long flags;if (list_empty (&runqueue_node->event_list))
@@ -898,9 +899,9 @@ static void g2d_finish_event(struct g2d_data *g2d, u32 cmdlist_no) e =list_first_entry (&runqueue_node->event_list, struct drm_exynos_pending_g2d_event, base.link); -do_gettimeofday (&now); +getnstimeofday64 (&now); e->event.tv_sec = now.tv_sec; - e->event.tv_usec = now.tv_usec; + e->event.tv_usec = (now.tv_nsec /NSEC_PER_USEC ); e->event.cmdlist_no = cmdlist_no;spin_lock_irqsave (&drm_dev->event_lock, flags);
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 1/1 drm/exynos: g2d: Replace struct timeval usage
drivers/gpu/drm/exynos/exynos_drm_g2d.c static void g2d_finish_event(struct g2d_data *g2d, u32 cmdlist_no) · line 905
Quoted 7 lines · On Monday 01 June 2015 08:36:18 Tina Ruchandani wrote:
drivers/gpu/drm/exynos/exynos_drm_g2d.c +2
-2-do_gettimeofday (&now); +getnstimeofday64 (&now); e->event.tv_sec = now.tv_sec; - e->event.tv_usec = now.tv_usec; + e->event.tv_usec = (now.tv_nsec /NSEC_PER_USEC ); e->event.cmdlist_no = cmdlist_no;
This has the same problem as the ipp patch: e->event.tv_sec is a 32-bit variable, so this will still overflow, and the patch has no effect.
Arnd