Skip to content

Commit

Permalink
Adapt HDAPS driver to use the new timer_setup() interface.
Browse files Browse the repository at this point in the history
Linux 4.15 removed the ancient init_timer() API and changed the signature
of the timer handler function.

Signed-off-by: Jan Nordholz <[email protected]>
Closes: #31
  • Loading branch information
Jan Nordholz authored and evgeni committed Dec 27, 2017
1 parent fc60d0d commit 76c5120
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions hdaps.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 76c5120

Please sign in to comment.