summaryrefslogtreecommitdiff
path: root/io-module/mts-io.c
diff options
context:
space:
mode:
authorMykyta Dorokhin <mykyta.dorokhin@globallogic.com>2021-01-15 15:30:13 +0200
committerJohn Klug <john.klug@multitech.com>2021-01-20 15:14:42 -0600
commitc27e9a4e1b711bb41c45e6029fb786b72cc217ed (patch)
tree422892f956a3141a60ec50643d1c9b536d615530 /io-module/mts-io.c
parent6fb0b6bed65b9df6e34e83c84878cf002394f676 (diff)
downloadmts-io-c27e9a4e1b711bb41c45e6029fb786b72cc217ed.tar.gz
mts-io-c27e9a4e1b711bb41c45e6029fb786b72cc217ed.tar.bz2
mts-io-c27e9a4e1b711bb41c45e6029fb786b72cc217ed.zip
linux5.4: fix kernel module build issues
Diffstat (limited to 'io-module/mts-io.c')
-rw-r--r--io-module/mts-io.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/io-module/mts-io.c b/io-module/mts-io.c
index 6c14a74..a20cd39 100644
--- a/io-module/mts-io.c
+++ b/io-module/mts-io.c
@@ -42,6 +42,8 @@
#include <linux/io.h>
#include <linux/module.h>
#include <linux/firmware.h>
+
+#include "at91gpio.h"
#include "mts_io_module.h"
#include "mts_io.h"
#include "buttons.h"
@@ -114,12 +116,12 @@ DEFINE_MUTEX(mts_io_mutex);
static unsigned int *timings_data = NULL;
static unsigned int timings_data_size = 0;
static unsigned int timings_data_index = 0;
-static time_t timings_data_stop_seconds = 0;
+static time64_t timings_data_stop_seconds = 0;
static struct timer_list radio_reset_timer;
static volatile int radio_reset_timer_is_start = 0;
static struct timer_list radio_reset_available_timer;
static volatile int radio_reset_available_timer_is_start = 0;
-static time_t time_now_secs(void);
+static time64_t time_now_secs(void);
/* generic GPIO support */
#include "gpio.c"
@@ -284,10 +286,14 @@ static DEVICE_ATTR_MTS(dev_attr_radio_power, "radio-power",
mts_attr_show_gpio_pin, mts_attr_store_gpio_pin);
/* backoff-timers */
-static time_t time_now_secs(void)
+static time64_t time_now_secs(void)
{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,20,0)
+ return ktime_get_real_seconds();
+#else
struct timespec ts = current_kernel_time();
return ts.tv_sec;
+#endif
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)
@@ -479,8 +485,9 @@ static ssize_t mts_attr_show_radio_reset_backoff_seconds(struct device *dev,
ssize_t value;
if (strcmp(attr->attr.name, "radio-reset-backoff-seconds") == 0) {
+
if (radio_reset_timer_is_start == 1) {
- value = sprintf(buf, "%lu", (timings_data_stop_seconds - time_now_secs()));
+ value = sprintf(buf, "%lld", (timings_data_stop_seconds - time_now_secs()));
} else {
value = sprintf(buf, "%d", 0);
}