From 92cf50aea8cbab234d79284b0a6aeec55607bef6 Mon Sep 17 00:00:00 2001 From: Chanwoo Choi Date: Fri, 16 Mar 2018 13:56:48 +0900 Subject: [PATCH] pass: cpuhp: Fix error when exiting the CPUHP module If resource configuration doesn't specify the use of CPUHP, pass_cpuhp_init() have to be skipped. But, the commit eac3132aeb70 ("pass: cpuhp: Replace legacy monitoring with RESMON (Resource Monitor)") didn't handle it rightly. If CPU h/w resource doesn't use the CPUHP governor (radiation or step cpuhp governor), have to skip the exit sequence of CPUHP. Change-Id: I2c97873eebfa1e441807b615637786ebda5ed8b8 Fixes: eac3132aeb70 ("pass: cpuhp: Replace legacy monitoring with RESMON (Resource Monitor) Signed-off-by: Chanwoo Choi --- src/pass/pass-cpuhp.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/pass/pass-cpuhp.c b/src/pass/pass-cpuhp.c index df10e96..5d55091 100644 --- a/src/pass/pass-cpuhp.c +++ b/src/pass/pass-cpuhp.c @@ -467,6 +467,21 @@ int pass_cpuhp_exit(struct pass_resource *res) if (!res) return -EINVAL; + /* + * FIXME: The h/w resource configuration specifies the gov_type. + * When gov_type is either PASS_GOV_STEP(2) or PASS_GOV_RADIATION(3), + * CPUHP should be enabled. On later, each PASS module have to define + * the separate property in configuration which indicates either this + * module is used or not. + */ + switch (res->config_data.gov_type) { + case PASS_GOV_STEP: + case PASS_GOV_RADIATION: + break; + default: + return 0; + }; + cpuhp = &res->cpuhp; if (!cpuhp->governor || !cpuhp->governor->exit) -- 2.7.4