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 <ryanl@motorola.com>
Reviewed-by: Guobin Zhang <zhanggb@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
xizx 2020-07-17 18:32:36 +08:00 • committed by Zhenxin Xi
commit f72a6ed083
2 changed files with 12 additions and 2 deletions

View file

@ -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
obj-m += watchdogtest.o
KBUILD_EXTRA_SYMBOLS += $(KBUILD_OUTPUT)/Module.symvers

View file

@ -17,6 +17,7 @@
#include <linux/debugfs.h>
#include <linux/kallsyms.h>
#include <soc/qcom/watchdog.h>
#include <linux/version.h>
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;