log: kernel4.19 compile error [1/1]
authorLiqiang Jin <liqiang.jin@amlogic.com>
Tue, 23 Jul 2019 10:31:25 +0000 (18:31 +0800)
committerLiqiang Jin <liqiang.jin@amlogic.com>
Wed, 24 Jul 2019 07:03:16 +0000 (15:03 +0800)
PD#SWPL-9652

Problem:
init_timer() function not exist in kernel4.19

Solution:
1) use setup_timer() to init timer in kernel4.9
2) use timer_setup() to init timer in kernel4.19

Verify:
Android P + U200

Change-Id: Ie9e12494a9b16eb6432a01cf8b503bae4c019023
Signed-off-by: Liqiang Jin <liqiang.jin@amlogic.com>
optee/log.c

index 45f0373b3995e4a619850f135051ddb00dba847b..bac6ae084f5ceb99394b77366ecc03b982c6c1ff 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/uaccess.h>
 #include <linux/sysfs.h>
 #include <linux/kthread.h>
+#include <generated/uapi/linux/version.h>
 
 #include "optee_smc.h"
 #include "optee_private.h"
@@ -269,7 +270,11 @@ static void log_buff_output(void)
                log_print_text(read_buff, len);
 }
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 34)
+static void log_timer_func(struct timer_list *timer)
+#else
 static void log_timer_func(unsigned long arg)
+#endif
 {
        log_buff_output();
        mod_timer(&optee_log_timer, jiffies + OPTEE_LOG_TIMER_INTERVAL * HZ);
@@ -306,9 +311,11 @@ int optee_log_init(struct tee_device *tee_dev, phys_addr_t shm_pa,
        }
 
        /* init timer */
-       init_timer(&optee_log_timer);
-       optee_log_timer.data = 0L;
-       optee_log_timer.function = log_timer_func;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 34)
+       timer_setup(&optee_log_timer, log_timer_func, 0);
+#else
+       setup_timer(&optee_log_timer, log_timer_func, 0);
+#endif
        optee_log_timer.expires = jiffies + HZ;
        add_timer(&optee_log_timer);