forked from dect/dedected
1
0
Fork 0

com-on-air_cs-linux: Use timespec64 instead of timespec on kernels >= 5.6

struct timespec is deprecated since it overflows in 2038 on 32-bit
architectures.

https://lwn.net/Articles/643234/
This commit is contained in:
Martin Hauke 2023-12-16 12:41:34 +01:00
parent 47525a90a0
commit 16309c0396
3 changed files with 16 additions and 0 deletions

View File

@ -20,6 +20,7 @@
#include <linux/crc32.h>
#include <linux/kfifo.h>
#include <linux/poll.h>
#include <linux/version.h>
#include <pcmcia/cistpl.h>
#include <pcmcia/ciscode.h>
@ -406,7 +407,11 @@ com_on_air_irq_handler(int irq, void *dev_id)
uint8_t dip_irq = 0;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
jiffies_to_timespec64(jiffies, &dev->irq_timestamp);
#else
jiffies_to_timespec(jiffies, &dev->irq_timestamp);
#endif
dev->irq_count++;
switch(dev->operation_mode & COA_MODEMASK)

View File

@ -16,6 +16,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/version.h>
struct coa_info
{
@ -24,7 +25,11 @@ struct coa_info
int irq;
int irq_count;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
struct timespec64 irq_timestamp;
#else
struct timespec irq_timestamp;
#endif
struct pcmcia_device *links[2];

View File

@ -29,6 +29,8 @@
#include "dect.h"
#include "com_on_air.h"
#include <linux/version.h>
struct sniffer_cfg
{
int snifftype;
@ -57,7 +59,11 @@ struct sniffed_packet
unsigned char channel;
unsigned char slot;
unsigned char frameflags;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
struct timespec64 timestamp;
#else
struct timespec timestamp;
#endif
unsigned char data[53];
};