oct612x: timeval -> ktime

The timeval structure is removed in Linux kernel 5.0 since it is not
year 2038 safe. Standardize on the ktime values.

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
This commit is contained in:
Shaun Ruffell 2019-01-08 14:03:35 +00:00
parent 95fccc653c
commit db9c5f5c89

View File

@ -23,6 +23,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/hrtimer.h>
#include <dahdi/kernel.h> #include <dahdi/kernel.h>
@ -31,15 +32,11 @@
UINT32 Oct6100UserGetTime(tPOCT6100_GET_TIME f_pTime) UINT32 Oct6100UserGetTime(tPOCT6100_GET_TIME f_pTime)
{ {
/* Why couldn't they just take a timeval like everyone else? */ /* Why couldn't they just take a timeval like everyone else? */
struct timeval tv; u64 total_usecs;
unsigned long long total_usecs;
unsigned int mask = ~0;
do_gettimeofday(&tv); total_usecs = ktime_to_us(ktime_get_real());
total_usecs = (((unsigned long long)(tv.tv_sec)) * 1000000) + f_pTime->aulWallTimeUs[0] = total_usecs;
(((unsigned long long)(tv.tv_usec))); f_pTime->aulWallTimeUs[1] = total_usecs >> 32;
f_pTime->aulWallTimeUs[0] = (total_usecs & mask);
f_pTime->aulWallTimeUs[1] = (total_usecs >> 32);
return cOCT6100_ERR_OK; return cOCT6100_ERR_OK;
} }