From f72a6ed083cb48a7324d421339b4c81ed2bb5647 Mon Sep 17 00:00:00 2001 From: xizx Date: Fri, 17 Jul 2020 18:32:36 +0800 Subject: [PATCH] watchdogtest: fix kallsyms_lookup_name issue in GKI 5.4 kallsyms_lookup_name is not exported in kernel 5.4 and the driver should work for qcom , samsung and MTK, so use a specially way to distinguish it. Change-Id: Ic9d89a1af48b4e03481f2aaf38f3bf5dbdafc2cd Reviewed-on: https://gerrit.mot.com/1689258 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Ryan Lattrel Reviewed-by: Guobin Zhang Submit-Approved: Jira Key --- drivers/watchdogtest/Kbuild | 5 +++-- drivers/watchdogtest/watchdogtest.c | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/watchdogtest/Kbuild b/drivers/watchdogtest/Kbuild index d8eee6e505d0..4b499571a86f 100644 --- a/drivers/watchdogtest/Kbuild +++ b/drivers/watchdogtest/Kbuild @@ -1,5 +1,6 @@ # add -Wall to try to catch everything we can. EXTRA_CFLAGS += -Wall -EXTRA_CFLAGS += -I$(TOP)/motorola/kernel/modules/include +EXTRA_CFLAGS += -I$(ANDROID_BUILD_TOP)/motorola/kernel/modules/include -obj-m += watchdogtest.o \ No newline at end of file +obj-m += watchdogtest.o +KBUILD_EXTRA_SYMBOLS += $(KBUILD_OUTPUT)/Module.symvers diff --git a/drivers/watchdogtest/watchdogtest.c b/drivers/watchdogtest/watchdogtest.c index db60fd205ad5..1bc434a13f58 100644 --- a/drivers/watchdogtest/watchdogtest.c +++ b/drivers/watchdogtest/watchdogtest.c @@ -17,6 +17,7 @@ #include #include #include +#include static struct dentry *dbgfs_fire_softlockup; static struct dentry *dbgfs_fire_watchdog; @@ -71,7 +72,15 @@ static int watchdog_test_init(void) dbgfs_fire_watchdog = debugfs_create_file("fire_watchdog_reset", 0200, NULL, NULL, &fire_watchdog_reset_fops); +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,4,0) trigger_wdog_bite = (void *)kallsyms_lookup_name("msm_trigger_wdog_bite"); +#else +#ifdef CONFIG_ARCH_QCOM + trigger_wdog_bite = msm_trigger_wdog_bite; +#else + trigger_wdog_bite = NULL; +#endif +#endif if (!trigger_wdog_bite) printk(KERN_ERR "Failed to get msm_trigger_wdog_bite address\n"); return 0;