Skip to content

Commit

Permalink
master/device: Add workaround for kernel 5.6
Browse files Browse the repository at this point in the history
Kernel 5.6 has removed the timeval structure.
  • Loading branch information
ribalda committed May 11, 2020
1 parent b2a0182 commit 7d73d5b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions master/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,9 +445,9 @@ void ec_device_clear_stats(

static void do_gettimeofday(struct timeval *tv)
{
struct timespec ts;
struct timespec64 ts;

ktime_get_ts(&ts);
ktime_get_ts64(&ts);
tv->tv_sec = ts.tv_sec;
tv->tv_usec = ts.tv_nsec / NSEC_PER_USEC;
}
Expand Down
9 changes: 9 additions & 0 deletions master/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#define __EC_DEVICE_H__

#include <linux/interrupt.h>
#include <linux/version.h>

#include "../devices/ecdev.h"
#include "globals.h"
Expand All @@ -54,6 +55,14 @@
#include "debug.h"
#endif

#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
struct timeval {
__kernel_old_time_t tv_sec; /* seconds */
__kernel_suseconds_t tv_usec; /* microseconds */
};
#endif


#ifdef EC_DEBUG_RING
#define EC_DEBUG_RING_SIZE 10

Expand Down

0 comments on commit 7d73d5b

Please sign in to comment.