Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed call to timer functions for later kernel API (>4.14) #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions dnt900.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
#include <linux/bitops.h>
#include <linux/timer.h>

#include <linux/version.h>


#define LDISC_NAME "dnt900"
#define CLASS_NAME "dnt900"
#define TTY_DRIVER_NAME "ttyDNT"
Expand Down Expand Up @@ -396,7 +399,11 @@ static void dnt900_map_remotes(struct work_struct *ws);
static void dnt900_map_all_remotes(struct work_struct *ws);

static irqreturn_t dnt900_cts_handler(int irq, void *dev_id);
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0)
static void dnt900_next_remote_read(unsigned long data);
#else
static void dnt900_next_remote_read(struct timer_list *t);
#endif

static struct dnt900_local *dnt900_create_local(struct tty_struct *tty);
static void dnt900_unregister_local(struct dnt900_local *local);
Expand Down Expand Up @@ -2716,9 +2723,15 @@ static irqreturn_t dnt900_cts_handler(int irq, void *dev_id)
return IRQ_HANDLED;
}

#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0)
static void dnt900_next_remote_read(unsigned long data)
{
struct dnt900_local *local = (struct dnt900_local *)data;
#else
static void dnt900_next_remote_read(struct timer_list *t)
{
struct dnt900_local *local = from_timer(local, t, remote_read_timer);
#endif

wake_up_interruptible(&local->remote_read_queue);
}
Expand Down Expand Up @@ -2759,9 +2772,14 @@ static struct dnt900_local *dnt900_create_local(struct tty_struct *tty)
INIT_KFIFO(local->packet_fifo);
init_waitqueue_head(&local->tx_queue);
init_waitqueue_head(&local->remote_read_queue);
init_timer(&local->remote_read_timer);
local->remote_read_timer.data = (unsigned long)local;
local->remote_read_timer.function = dnt900_next_remote_read;
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0)

init_timer(&local->remote_read_timer);
local->remote_read_timer.data = (unsigned long)local;
local->remote_read_timer.function = dnt900_next_remote_read;
#else
timer_setup(&local->remote_read_timer, dnt900_next_remote_read, 0);
#endif
return local;

fail_register:
Expand Down