Commit ac712d70 authored by Ton Damen's avatar Ton Damen

Adapted to new timer implementation in Centos8 kernel

parent 8d9cb4e1
......@@ -7,6 +7,7 @@
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/version.h>
#include <linux/fs.h>
#include <linux/pci.h>
#include <linux/uaccess.h>
......@@ -51,8 +52,8 @@ static struct cdev c_dev = {
.owner = THIS_MODULE
};
int i = PAGE_SIZE;
// semaphores for exclusive read/write operations
// semaphores for exclusive read/write operations
DEFINE_SEMAPHORE(rd_sem);
DEFINE_SEMAPHORE(wr_sem);
......@@ -63,22 +64,35 @@ DECLARE_WAIT_QUEUE_HEAD(waitq);
#define JIFFIES_10MS (HZ / 100)
#if KERNEL_VERSION(4,15,0) < LINUX_VERSION_CODE
static void timer_fn(struct timer_list *);
#else
static void timer_fn(unsigned long);
#endif
#if KERNEL_VERSION(4,15,0) < LINUX_VERSION_CODE
DEFINE_TIMER(poll_timer, timer_fn);
#else
DEFINE_TIMER(poll_timer, timer_fn, 0, 0);
#endif
static struct timer_list tlist = TIMER_INITIALIZER(timer_fn, 0, 0);
static void start_timer(void)
{
tlist.expires = jiffies + JIFFIES_10MS;
add_timer(&tlist);
poll_timer.expires = jiffies + JIFFIES_10MS;
add_timer(&poll_timer);
}
static void stop_timer(void)
{
del_timer(&tlist);
del_timer(&poll_timer);
}
#if KERNEL_VERSION(4,15,0) < LINUX_VERSION_CODE
static void timer_fn(struct timer_list *tlist)
#else
static void timer_fn(unsigned long arg)
#endif
{
if (vuart_rx_avail(bar_addr + UART_BASE_ADDR))
wake_up_interruptible(&waitq);
......
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