Added kernel-specific handling for init_timer/setup_timer and

access_ok() for ec_tty module and example.
Closes #2.
This commit is contained in:
Florian Pose
2021-04-09 12:22:52 +02:00
parent f5d64bbab7
commit 6ad16e7e67
2 changed files with 39 additions and 9 deletions

View File

@@ -116,7 +116,11 @@ void check_master_state(void)
/*****************************************************************************/
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
void cyclic_task(struct timer_list *t)
#else
void cyclic_task(unsigned long data)
#endif
{
// receive process data
down(&master_sem);
@@ -214,8 +218,12 @@ int __init init_mini_module(void)
domain1_pd = ecrt_domain_data(domain1);
printk(KERN_INFO PFX "Starting cyclic sample thread.\n");
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
timer_setup(&timer, cyclic_task, 0);
#else
init_timer(&timer);
timer.function = cyclic_task;
#endif
timer.expires = jiffies + 10;
add_timer(&timer);