diff options
author | Guan-Yu Lin <guanyulin@google.com> | 2023-10-03 16:46:25 +0800 |
---|---|---|
committer | Alex Iacobucci <alexiacobucci@google.com> | 2023-10-20 14:32:13 +0000 |
commit | 99149e030fd89ed64f6c610a951a0ded2fd7798e (patch) | |
tree | fc4bcf998a71ce19cf5b757e97ac7b861ccba042 | |
parent | 27afab4e39d0b0de6e8d27caeea9d9d7795fc4a8 (diff) | |
download | aoc-99149e030fd89ed64f6c610a951a0ded2fd7798e.tar.gz |
aoc: sync aoc_module_parameters
Change the struct of aoc_moldule_parameters so that we can access the
up-to-date value all the times.
Bug: 303187479
Test: trigger AoC SSR multiple times by aocutil reset
Change-Id: I6f5d8cc27560049273cf32d08ce42964349eac5b
Signed-off-by: Guan-Yu Lin <guanyulin@google.com>
(cherry picked from commit 01fbb47b203b19d46890270475196320b4b30ca3)
-rw-r--r-- | aoc.c | 15 | ||||
-rw-r--r-- | aoc.h | 6 | ||||
-rw-r--r-- | aoc_v1.c | 4 |
3 files changed, 11 insertions, 14 deletions
@@ -111,7 +111,11 @@ static bool aoc_panic_on_req_timeout = true; module_param(aoc_panic_on_req_timeout, bool, 0644); MODULE_PARM_DESC(aoc_panic_on_req_timeout, "Enable kernel panic when aoc_req times out."); -static struct aoc_module_parameters *aoc_module_params; +static struct aoc_module_parameters aoc_module_params = { + .aoc_autoload_firmware = &aoc_autoload_firmware, + .aoc_disable_restart = &aoc_disable_restart, + .aoc_panic_on_req_timeout = &aoc_panic_on_req_timeout, +}; static int aoc_core_suspend(struct device *dev); static int aoc_core_resume(struct device *dev); @@ -1867,7 +1871,7 @@ err_coredump: mutex_lock(&aoc_service_lock); aoc_take_offline(prvdata); - restart_rc = aoc_watchdog_restart(prvdata, aoc_module_params); + restart_rc = aoc_watchdog_restart(prvdata, &aoc_module_params); if (restart_rc == AOC_RESTART_DISABLED_RC) { dev_info(prvdata->dev, "aoc subsystem restart is disabled\n"); } else if (restart_rc) { @@ -2268,13 +2272,6 @@ static int aoc_platform_probe(struct platform_device *pdev) int ret; int rc; int i; - struct aoc_module_parameters module_params = { - .aoc_autoload_firmware = aoc_autoload_firmware, - .aoc_disable_restart = aoc_disable_restart, - .aoc_panic_on_req_timeout = aoc_panic_on_req_timeout - }; - - aoc_module_params = &module_params; if (aoc_platform_device != NULL) { dev_err(dev, @@ -182,9 +182,9 @@ struct aoc_prvdata { }; struct aoc_module_parameters { - bool aoc_autoload_firmware; - bool aoc_disable_restart; - bool aoc_panic_on_req_timeout; + bool *aoc_autoload_firmware; + bool *aoc_disable_restart; + bool *aoc_panic_on_req_timeout; }; #define AOC_DEVICE(_d) container_of((_d), struct aoc_service_dev, dev) @@ -132,7 +132,7 @@ int aoc_watchdog_restart(struct aoc_prvdata *prvdata, if (!pcu) return -ENODEV; - if (aoc_module_params->aoc_disable_restart) + if (*(aoc_module_params->aoc_disable_restart)) return AOC_RESTART_DISABLED_RC; aoc_reset_successful = false; @@ -172,7 +172,7 @@ int aoc_watchdog_restart(struct aoc_prvdata *prvdata, } } - if (aoc_req_rc && aoc_module_params->aoc_panic_on_req_timeout) { + if (aoc_req_rc && *(aoc_module_params->aoc_panic_on_req_timeout)) { dev_err(prvdata->dev, "timed out too many times waiting for aoc_ack, triggering kernel panic\n"); panic("AoC kernel panic: timed out waiting for aoc_ack"); } |