From: rui guo Date: Tue, 28 Dec 2021 10:32:34 +0000 (+0800) Subject: log: Test fly audio,9 fail by Initial audio tone not detected [1/1] X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c20939b37f15742e21d75a50362ee01462e22261;p=GitHub%2FLineageOS%2FG12%2Fandroid_hardware_amlogic_kernel-modules_optee.git log: Test fly audio,9 fail by Initial audio tone not detected [1/1] PD#SWPL-64462 Problem: log_timer_func timer takes a long time Solution: log_timer_func is move to the workqueue Verify: Android Q + S905X4 + kernel_4.9 Android S + S905X4 + kernel_5.4 Change-Id: I88485a50242b8ad5843d4f03c191943325ddb7fd Signed-off-by: rui guo --- diff --git a/optee/log.c b/optee/log.c index 5f348e3..247f142 100644 --- a/optee/log.c +++ b/optee/log.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "optee_smc.h" #include "optee_private.h" @@ -57,6 +58,9 @@ static uint8_t line_buff[OPTEE_LOG_LINE_MAX]; static uint32_t looped = 0; static void *g_shm_va; +struct delayed_work log_work; +static struct workqueue_struct *log_workqueue; + static bool init_shm(phys_addr_t shm_pa, uint32_t shm_size) { struct arm_smccc_res smccc; @@ -282,14 +286,12 @@ 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 +static void do_log_timer(struct work_struct *work) { log_buff_output(); - mod_timer(&optee_log_timer, jiffies + OPTEE_LOG_TIMER_INTERVAL * HZ); + if (queue_delayed_work(log_workqueue, &log_work, OPTEE_LOG_TIMER_INTERVAL * HZ) == 0) { + pr_err("%s:%d Failed to join the workqueue\n", __func__, __LINE__); + } } int optee_log_init(struct tee_device *tee_dev, phys_addr_t shm_pa, @@ -322,14 +324,12 @@ int optee_log_init(struct tee_device *tee_dev, phys_addr_t shm_pa, goto err; } - /* init timer */ -#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); + /* init workqueue */ + log_workqueue = create_singlethread_workqueue("tee-log-wq"); + INIT_DELAYED_WORK(&log_work,do_log_timer); + if (queue_delayed_work(log_workqueue, &log_work, OPTEE_LOG_TIMER_INTERVAL * HZ) == 0) { + pr_err("%s:%d Failed to join the workqueue.\n", __func__, __LINE__); + } err: return rc;