summaryrefslogtreecommitdiff
blob: 88c5580db181b2984c5dba1f6b8397c2d3a421aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
From 76c5120f7be4880cf2c6801f872327e4e70c449f Mon Sep 17 00:00:00 2001
From: Jan Nordholz <jnordholz@sec.t-labs.tu-berlin.de>
Date: Mon, 4 Dec 2017 03:27:11 +0100
Subject: [PATCH] Adapt HDAPS driver to use the new timer_setup() interface.

Linux 4.15 removed the ancient init_timer() API and changed the signature
of the timer handler function.

Signed-off-by: Jan Nordholz <jnordholz@sec.t-labs.tu-berlin.de>
Closes: #31
---
 hdaps.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/hdaps.c b/hdaps.c
index 0763c3a..76930a3 100644
--- a/hdaps.c
+++ b/hdaps.c
@@ -469,7 +469,11 @@ static void hdaps_calibrate(void)
 /* Timer handler for updating the input device. Runs in softirq context,
  * so avoid lenghty or blocking operations.
  */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0)
 static void hdaps_mousedev_poll(unsigned long unused)
+#else
+static void hdaps_mousedev_poll(struct timer_list *unused)
+#endif
 {
 	int ret;
 
@@ -779,8 +783,12 @@ static int __init hdaps_init(void)
 			hdaps_invert = 0; /* default */
 
 	/* Init timer before platform_driver_register, in case of suspend */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0)
 	init_timer(&hdaps_timer);
 	hdaps_timer.function = hdaps_mousedev_poll;
+#else
+	timer_setup(&hdaps_timer, hdaps_mousedev_poll, 0);
+#endif
 	ret = platform_driver_register(&hdaps_driver);
 	if (ret)
 		goto out;