Commit 0dfe5620 authored by Benoit Rat's avatar Benoit Rat

update to timespec64 for kernel 5.15

parent 6cb4c9ee
......@@ -55,13 +55,14 @@
/* This is the structure we need to manage interrupts and loop internally */
#define FMC_DIO_BUFFER_LEN 512
struct dio_channel {
struct timespec tsbuf[FMC_DIO_BUFFER_LEN];
struct timespec64 tsbuf[FMC_DIO_BUFFER_LEN];
struct wr_timestamp_info wr_ts_info_buf[FMC_DIO_BUFFER_LEN];
int bhead, btail;
wait_queue_head_t q;
/* The input event may fire a new pulse on this or another channel */
struct timespec prevts, delay;
struct timespec64 prevts, delay;
atomic_t count;
int target_channel;
};
......@@ -71,14 +72,14 @@ struct dio_device {
};
/* Instead of timespec_sub, just subtract the nanos */
static inline void fmc_dio_int_ts_sub(struct timespec *ts, int nano)
static inline void fmc_dio_int_ts_sub(struct timespec64 *ts, int nano)
{
set_normalized_timespec(ts, ts->tv_sec, ts->tv_nsec - nano);
set_normalized_timespec64(ts, ts->tv_sec, ts->tv_nsec - nano);
}
/* This programs a new pulse without changing the width */
static void __fmc_dio_int_new_pulse(struct fmc_dio *dev, int ch,
struct timespec *ts)
struct timespec64 *ts)
{
void __iomem *base = dev->dio;
struct regmap *map;
......@@ -105,7 +106,7 @@ static int fmc_dio_int_cmd_pulse(struct fmc_dio *dev,
struct dio_device *d = dev->priv;
struct dio_channel *c;
struct regmap *map;
struct timespec *ts;
struct timespec64 *ts;
uint32_t reg;
int ch;
struct regmap_common dio;
......@@ -209,7 +210,7 @@ static int fmc_dio_int_cmd_update_width(struct fmc_dio *dev,
struct dio_device *d = dev->priv;
struct dio_channel *c;
struct regmap *map;
struct timespec *ts;
struct timespec64 *ts;
int ch;
struct regmap_common dio;
uint32_t period;
......@@ -247,7 +248,7 @@ static int fmc_dio_int_cmd_stamp(struct fmc_dio *dev,
{
struct dio_device *d = dev->priv;
struct dio_channel *c = 0;
struct timespec *ts = cmd->t;
struct timespec64 *ts = cmd->t;
struct wr_timestamp_info *ts_info = cmd->wr_ts_info_buf;
struct regmap *map;
int mask, ch, last;
......@@ -304,7 +305,7 @@ again:
ch--; c--; /* The for above incremeted them */
try_module_get(THIS_MODULE);
if(cmd->wait_mode_flags & WR_DIO_F_WAIT_MODE_TIMEOUT) {
unsigned long tmo = timespec_to_jiffies(&(cmd->wait_mode_timeout));
unsigned long tmo = timespec64_to_jiffies(&(cmd->wait_mode_timeout));
ret_wait = wait_event_interruptible_timeout(c->q, c->bhead != c->btail, tmo);
if(!ret_wait)
ret_wait = -ETIMEDOUT;
......@@ -427,7 +428,7 @@ static int fmc_dio_int_cmd_irq(struct fmc_dio *dev,
struct dio_device *d = dev->priv;
struct dio_channel *c;
struct regmap *map;
struct timespec *ts;
struct timespec64 *ts;
uint32_t reg;
int ch;
struct regmap_common dio;
......@@ -580,15 +581,15 @@ out:
/* This is called from the interrupt handler to program a new pulse */
static void fmc_dio_int_trig_next_pulse(struct fmc_dio *dev, int ch,
struct dio_channel *c, struct timespec *ts)
struct dio_channel *c, struct timespec64 *ts)
{
struct timespec newts;
struct timespec64 newts;
if (c->target_channel == ch) {
c->prevts = timespec_add(c->prevts, c->delay);
c->prevts = timespec64_add(c->prevts, c->delay);
newts = c->prevts;
} else {
newts = timespec_add(*ts, c->delay);
newts = timespec64_add(*ts, c->delay);
}
__fmc_dio_int_new_pulse(dev, c->target_channel, &newts);
......@@ -605,7 +606,7 @@ irqreturn_t fmc_dio_int_interrupt(struct fmc_dio *dev)
static ktime_t t_ini, t_end;
static int rate_avg;
struct dio_channel *c;
struct timespec *ts;
struct timespec64 *ts;
struct wr_timestamp_info *ts_info;
struct regmap *map;
uint32_t mask, reg;
......
......@@ -16,6 +16,7 @@
#include <linux/fmc.h>
//FIXME: Back hack to maintain the IOCTL command numbers
#include <linux/sockios.h>
#include <linux/time64.h>
#include "hw/wr-dio-regs.h"
#include "hw/ppsg-regs.h"
......@@ -160,10 +161,10 @@ struct wr_dio_cmd {
uint32_t value; /* for DAC or I/O */
uint32_t flags;
uint32_t nstamp; /* from kernel, if IN_STAMP */
struct timespec t[WR_DIO_N_STAMP];
struct timespec64 t[WR_DIO_N_STAMP];
struct wr_timestamp_info wr_ts_info_buf[WR_DIO_N_STAMP];
uint32_t wait_mode_flags;
struct timespec wait_mode_timeout;
struct timespec64 wait_mode_timeout;
};
#define WR_DIO_F_NOW 0x01 /* Output is now, t[0] ignored */
......
......@@ -34,7 +34,7 @@ void *last_cmd;
struct wr_dio_cmd _cmd;
struct wr_dio_cmd *cmd = &_cmd;
static int parse_ts(char *s, struct timespec *ts)
static int parse_ts(char *s, struct timespec64 *ts)
{
int i, n;
unsigned long nano;
......
......@@ -49,11 +49,11 @@ unsigned char ruler_macaddr[ETH_ALEN];
struct ruler_action {
int isremote;
int channel;
struct timespec delay;
struct timespec64 delay;
};
/* Boring parsing separated to a separate function (same code as elsewhere) */
static int parse_ts(char *s, struct timespec *ts)
static int parse_ts(char *s, struct timespec64 *ts)
{
int i, n;
unsigned long nano;
......@@ -238,7 +238,7 @@ static struct ruler_action *ruler_build_actions(int nact, char **strings)
}
/* The main loop will wait for an event... */
static int ruler_wait_event(int inch, struct timespec *ts)
static int ruler_wait_event(int inch, struct timespec64 *ts)
{
ruler_cmd.command = WR_DIO_CMD_STAMP;
ruler_cmd.flags = WR_DIO_F_WAIT;
......@@ -255,7 +255,7 @@ static int ruler_wait_event(int inch, struct timespec *ts)
}
/* ...and run all actions when the event happens */
static int ruler_run_actions(int nact, struct timespec *ts,
static int ruler_run_actions(int nact, struct timespec64 *ts,
struct ruler_action *actions)
{
int i;
......@@ -315,7 +315,7 @@ static void print_version(char *pname)
int main(int argc, char **argv)
{
struct ruler_action *actions;
struct timespec ts;
struct timespec64 ts;
int inch;
if ((argc == 2) && (!strcmp(argv[1], "-V"))) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment