From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id F3FB2A05FE for ; Mon, 18 Mar 2019 12:57:11 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 846124C9C; Mon, 18 Mar 2019 12:57:00 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 712403572 for ; Mon, 18 Mar 2019 12:56:55 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Mar 2019 04:56:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,493,1544515200"; d="scan'208";a="142963747" Received: from mhajkowx-mobl.ger.corp.intel.com ([10.104.12.180]) by orsmga002.jf.intel.com with ESMTP; 18 Mar 2019 04:56:53 -0700 From: Hajkowski To: david.hunt@intel.com Cc: dev@dpdk.org, Marcin Hajkowski Date: Mon, 18 Mar 2019 12:56:46 +0100 Message-Id: <20190318115647.14784-3-marcinx.hajkowski@intel.com> X-Mailer: git-send-email 2.20.1.windows.1 In-Reply-To: <20190318115647.14784-1-marcinx.hajkowski@intel.com> References: <20190318115647.14784-1-marcinx.hajkowski@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 3/4] power: reset function pointers on unset env X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190318115646.jKDWzwKuBwawXaqn86EGO-id5rnvjenDrj44Z5kPUvg@z> From: Marcin Hajkowski Set all power environment related function pointers to NULL when unset is being made. Signed-off-by: Marcin Hajkowski --- lib/librte_power/rte_power.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/lib/librte_power/rte_power.c b/lib/librte_power/rte_power.c index ed701087d..6b7722727 100644 --- a/lib/librte_power/rte_power.c +++ b/lib/librte_power/rte_power.c @@ -27,6 +27,22 @@ rte_power_freq_change_t rte_power_freq_enable_turbo; rte_power_freq_change_t rte_power_freq_disable_turbo; rte_power_get_capabilities_t rte_power_get_capabilities; +static void +reset_power_function_ptrs(void) +{ + rte_power_freqs = NULL; + rte_power_get_freq = NULL; + rte_power_set_freq = NULL; + rte_power_freq_up = NULL; + rte_power_freq_down = NULL; + rte_power_freq_max = NULL; + rte_power_freq_min = NULL; + rte_power_turbo_status = NULL; + rte_power_freq_enable_turbo = NULL; + rte_power_freq_disable_turbo = NULL; + rte_power_get_capabilities = NULL; +} + int rte_power_set_env(enum power_management_env env) { @@ -85,8 +101,10 @@ rte_power_set_env(enum power_management_env env) if (ret == 0) global_default_env = env; - else + else { global_default_env = PM_ENV_NOT_SET; + reset_power_function_ptrs(); + } rte_spinlock_unlock(&global_env_cfg_lock); return ret; @@ -97,6 +115,7 @@ rte_power_unset_env(void) { rte_spinlock_lock(&global_env_cfg_lock); global_default_env = PM_ENV_NOT_SET; + reset_power_function_ptrs(); rte_spinlock_unlock(&global_env_cfg_lock); } -- 2.17.2