From: Mauro Rossi Date: Wed, 29 Nov 2017 00:04:17 +0000 (+0100) Subject: tp_smapi/hdaps: use timer_setup() with kernel 4.15 and later X-Git-Url: http://git.osdn.net/view?p=android-x86%2Fdevice-generic-common.git;a=commitdiff_plain;h=refs%2Fheads%2Fmarshmallow-x86 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 --- 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;