From e07d8139c890f6cfb8b1eba0bf7a7f258c9e1d38 Mon Sep 17 00:00:00 2001 From: Mauro Rossi Date: Wed, 29 Nov 2017 01:04:17 +0100 Subject: [PATCH] tp_smapi/hdaps: use timer_setup() with kernel 4.15 and later Fixes the following building error happening with kernel 4.15: CC [M] .../out/target/product/x86/obj/kmodule/tp_smapi/hdaps.o .../out/target/product/x86/obj/kmodule/tp_smapi/hdaps.c: In function 'hdaps_init': .../out/target/product/x86/obj/kmodule/tp_smapi/hdaps.c:782:2: error: implicit declaration of function 'init_timer' [-Werror=implicit-function-declaration] init_timer(&hdaps_timer); ^ .../out/target/product/x86/obj/kmodule/tp_smapi/hdaps.c:783:23: warning: assignment from incompatible pointer type hdaps_timer.function = hdaps_mousedev_poll; ^ cc1: some warnings being treated as errors --- tp_smapi/hdaps.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tp_smapi/hdaps.c b/tp_smapi/hdaps.c index f54099a..338f551 100644 --- a/tp_smapi/hdaps.c +++ b/tp_smapi/hdaps.c @@ -779,8 +779,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) + timer_setup(&hdaps_timer, hdaps_mousedev_poll, 0); +#else init_timer(&hdaps_timer); hdaps_timer.function = hdaps_mousedev_poll; +#endif ret = platform_driver_register(&hdaps_driver); if (ret) goto out; -- 2.11.0