[dpdk-dev,v1,2/4] power: clean up of acpi files

Message ID 20171128105654.7733-2-marko.kovacevic@intel.com
State Superseded, archived
Headers show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Marko Kovacevic Nov. 28, 2017, 10:56 a.m.
Signed-off-by: Marko Kovacevic <marko.kovacevic@intel.com>

---
   V1: Clean up of acpi files
---
 lib/librte_power/Makefile                          |  2 +-
 ...e_power_acpi_cpufreq.c => power_acpi_cpufreq.c} | 32 +++++++++++-----------
 ...e_power_acpi_cpufreq.h => power_acpi_cpufreq.h} | 28 +++++++++----------
 lib/librte_power/rte_power.c                       | 28 +++++++++----------
 4 files changed, 45 insertions(+), 45 deletions(-)
 rename lib/librte_power/{rte_power_acpi_cpufreq.c => power_acpi_cpufreq.c} (94%)
 rename lib/librte_power/{rte_power_acpi_cpufreq.h => power_acpi_cpufreq.h} (88%)

Patch

diff --git a/lib/librte_power/Makefile b/lib/librte_power/Makefile
index 1b1491d..bf5a55e 100644
--- a/lib/librte_power/Makefile
+++ b/lib/librte_power/Makefile
@@ -42,7 +42,7 @@  EXPORT_MAP := rte_power_version.map
 LIBABIVER := 1
 
 # all source are stored in SRCS-y
-SRCS-$(CONFIG_RTE_LIBRTE_POWER) := rte_power.c rte_power_acpi_cpufreq.c
+SRCS-$(CONFIG_RTE_LIBRTE_POWER) := rte_power.c power_acpi_cpufreq.c
 SRCS-$(CONFIG_RTE_LIBRTE_POWER) += rte_power_kvm_vm.c guest_channel.c
 
 # install this header file
diff --git a/lib/librte_power/rte_power_acpi_cpufreq.c b/lib/librte_power/power_acpi_cpufreq.c
similarity index 94%
rename from lib/librte_power/rte_power_acpi_cpufreq.c
rename to lib/librte_power/power_acpi_cpufreq.c
index 618bf45..165ec97 100644
--- a/lib/librte_power/rte_power_acpi_cpufreq.c
+++ b/lib/librte_power/power_acpi_cpufreq.c
@@ -44,7 +44,7 @@ 
 #include <rte_memcpy.h>
 #include <rte_atomic.h>
 
-#include "rte_power_acpi_cpufreq.h"
+#include "power_acpi_cpufreq.h"
 #include "rte_power_common.h"
 
 #ifdef RTE_LIBRTE_POWER_DEBUG
@@ -311,7 +311,7 @@  power_init_for_setting_freq(struct rte_power_info *pi)
 }
 
 int
-rte_power_acpi_cpufreq_init(unsigned int lcore_id)
+power_acpi_cpufreq_init(unsigned int lcore_id)
 {
 	struct rte_power_info *pi;
 
@@ -352,7 +352,7 @@  rte_power_acpi_cpufreq_init(unsigned int lcore_id)
 	}
 
 	/* Set freq to max by default */
-	if (rte_power_acpi_cpufreq_freq_max(lcore_id) < 0) {
+	if (power_acpi_cpufreq_freq_max(lcore_id) < 0) {
 		RTE_LOG(ERR, POWER, "Cannot set frequency of lcore %u "
 				"to max\n", lcore_id);
 		goto fail;
@@ -419,7 +419,7 @@  power_set_governor_original(struct rte_power_info *pi)
 }
 
 int
-rte_power_acpi_cpufreq_exit(unsigned int lcore_id)
+power_acpi_cpufreq_exit(unsigned int lcore_id)
 {
 	struct rte_power_info *pi;
 
@@ -461,7 +461,7 @@  rte_power_acpi_cpufreq_exit(unsigned int lcore_id)
 }
 
 uint32_t
-rte_power_acpi_cpufreq_freqs(unsigned lcore_id, uint32_t *freqs, uint32_t num)
+power_acpi_cpufreq_freqs(unsigned int lcore_id, uint32_t *freqs, uint32_t num)
 {
 	struct rte_power_info *pi;
 
@@ -481,7 +481,7 @@  rte_power_acpi_cpufreq_freqs(unsigned lcore_id, uint32_t *freqs, uint32_t num)
 }
 
 uint32_t
-rte_power_acpi_cpufreq_get_freq(unsigned int lcore_id)
+power_acpi_cpufreq_get_freq(unsigned int lcore_id)
 {
 	if (lcore_id >= RTE_MAX_LCORE) {
 		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
@@ -492,7 +492,7 @@  rte_power_acpi_cpufreq_get_freq(unsigned int lcore_id)
 }
 
 int
-rte_power_acpi_cpufreq_set_freq(unsigned lcore_id, uint32_t index)
+power_acpi_cpufreq_set_freq(unsigned int lcore_id, uint32_t index)
 {
 	if (lcore_id >= RTE_MAX_LCORE) {
 		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
@@ -503,7 +503,7 @@  rte_power_acpi_cpufreq_set_freq(unsigned lcore_id, uint32_t index)
 }
 
 int
-rte_power_acpi_cpufreq_freq_down(unsigned int lcore_id)
+power_acpi_cpufreq_freq_down(unsigned int lcore_id)
 {
 	struct rte_power_info *pi;
 
@@ -521,7 +521,7 @@  rte_power_acpi_cpufreq_freq_down(unsigned int lcore_id)
 }
 
 int
-rte_power_acpi_cpufreq_freq_up(unsigned int lcore_id)
+power_acpi_cpufreq_freq_up(unsigned int lcore_id)
 {
 	struct rte_power_info *pi;
 
@@ -539,7 +539,7 @@  rte_power_acpi_cpufreq_freq_up(unsigned int lcore_id)
 }
 
 int
-rte_power_acpi_cpufreq_freq_max(unsigned int lcore_id)
+power_acpi_cpufreq_freq_max(unsigned int lcore_id)
 {
 	if (lcore_id >= RTE_MAX_LCORE) {
 		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
@@ -561,7 +561,7 @@  rte_power_acpi_cpufreq_freq_max(unsigned int lcore_id)
 }
 
 int
-rte_power_acpi_cpufreq_freq_min(unsigned int lcore_id)
+power_acpi_cpufreq_freq_min(unsigned int lcore_id)
 {
 	struct rte_power_info *pi;
 
@@ -578,7 +578,7 @@  rte_power_acpi_cpufreq_freq_min(unsigned int lcore_id)
 
 
 int
-rte_power_acpi_turbo_status(unsigned int lcore_id)
+power_acpi_turbo_status(unsigned int lcore_id)
 {
 	struct rte_power_info *pi;
 
@@ -594,7 +594,7 @@  rte_power_acpi_turbo_status(unsigned int lcore_id)
 
 
 int
-rte_power_acpi_enable_turbo(unsigned int lcore_id)
+power_acpi_enable_turbo(unsigned int lcore_id)
 {
 	struct rte_power_info *pi;
 
@@ -616,7 +616,7 @@  rte_power_acpi_enable_turbo(unsigned int lcore_id)
 	}
 
 	/* Max may have changed, so call to max function */
-	if (rte_power_acpi_cpufreq_freq_max(lcore_id) < 0) {
+	if (power_acpi_cpufreq_freq_max(lcore_id) < 0) {
 		RTE_LOG(ERR, POWER,
 			"Failed to set frequency of lcore %u to max\n",
 			lcore_id);
@@ -627,7 +627,7 @@  rte_power_acpi_enable_turbo(unsigned int lcore_id)
 }
 
 int
-rte_power_acpi_disable_turbo(unsigned int lcore_id)
+power_acpi_disable_turbo(unsigned int lcore_id)
 {
 	struct rte_power_info *pi;
 
@@ -642,7 +642,7 @@  rte_power_acpi_disable_turbo(unsigned int lcore_id)
 
 	if ((pi->turbo_available) && (pi->curr_idx <= 1)) {
 		/* Try to set freq to max by default coming out of turbo */
-		if (rte_power_acpi_cpufreq_freq_max(lcore_id) < 0) {
+		if (power_acpi_cpufreq_freq_max(lcore_id) < 0) {
 			RTE_LOG(ERR, POWER,
 				"Failed to set frequency of lcore %u to max\n",
 				lcore_id);
diff --git a/lib/librte_power/rte_power_acpi_cpufreq.h b/lib/librte_power/power_acpi_cpufreq.h
similarity index 88%
rename from lib/librte_power/rte_power_acpi_cpufreq.h
rename to lib/librte_power/power_acpi_cpufreq.h
index bc20dfd..3933fc4 100644
--- a/lib/librte_power/rte_power_acpi_cpufreq.h
+++ b/lib/librte_power/power_acpi_cpufreq.h
@@ -31,8 +31,8 @@ 
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef _RTE_POWER_ACPI_CPUFREQ_H
-#define _RTE_POWER_ACPI_CPUFREQ_H
+#ifndef _POWER_ACPI_CPUFREQ_H
+#define _POWER_ACPI_CPUFREQ_H
 
 /**
  * @file
@@ -60,7 +60,7 @@  extern "C" {
  *  - 0 on success.
  *  - Negative on error.
  */
-int rte_power_acpi_cpufreq_init(unsigned lcore_id);
+int power_acpi_cpufreq_init(unsigned int lcore_id);
 
 /**
  * Exit power management on a specific lcore. It will set the governor to which
@@ -73,7 +73,7 @@  int rte_power_acpi_cpufreq_init(unsigned lcore_id);
  *  - 0 on success.
  *  - Negative on error.
  */
-int rte_power_acpi_cpufreq_exit(unsigned lcore_id);
+int power_acpi_cpufreq_exit(unsigned int lcore_id);
 
 /**
  * Get the available frequencies of a specific lcore. The return value will be
@@ -92,7 +92,7 @@  int rte_power_acpi_cpufreq_exit(unsigned lcore_id);
  * @return
  *  The number of available frequencies.
  */
-uint32_t rte_power_acpi_cpufreq_freqs(unsigned lcore_id, uint32_t *freqs,
+uint32_t power_acpi_cpufreq_freqs(unsigned int lcore_id, uint32_t *freqs,
 		uint32_t num);
 
 /**
@@ -106,7 +106,7 @@  uint32_t rte_power_acpi_cpufreq_freqs(unsigned lcore_id, uint32_t *freqs,
  * @return
  *  The current index of available frequencies.
  */
-uint32_t rte_power_acpi_cpufreq_get_freq(unsigned lcore_id);
+uint32_t power_acpi_cpufreq_get_freq(unsigned int lcore_id);
 
 /**
  * Set the new frequency for a specific lcore by indicating the index of
@@ -123,7 +123,7 @@  uint32_t rte_power_acpi_cpufreq_get_freq(unsigned lcore_id);
  *  - 0 on success without frequency changed.
  *  - Negative on error.
  */
-int rte_power_acpi_cpufreq_set_freq(unsigned lcore_id, uint32_t index);
+int power_acpi_cpufreq_set_freq(unsigned int lcore_id, uint32_t index);
 
 /**
  * Scale up the frequency of a specific lcore according to the available
@@ -138,7 +138,7 @@  int rte_power_acpi_cpufreq_set_freq(unsigned lcore_id, uint32_t index);
  *  - 0 on success without frequency changed.
  *  - Negative on error.
  */
-int rte_power_acpi_cpufreq_freq_up(unsigned lcore_id);
+int power_acpi_cpufreq_freq_up(unsigned int lcore_id);
 
 /**
  * Scale down the frequency of a specific lcore according to the available
@@ -153,7 +153,7 @@  int rte_power_acpi_cpufreq_freq_up(unsigned lcore_id);
  *  - 0 on success without frequency changed.
  *  - Negative on error.
  */
-int rte_power_acpi_cpufreq_freq_down(unsigned lcore_id);
+int power_acpi_cpufreq_freq_down(unsigned int lcore_id);
 
 /**
  * Scale up the frequency of a specific lcore to the highest according to the
@@ -168,7 +168,7 @@  int rte_power_acpi_cpufreq_freq_down(unsigned lcore_id);
  *  - 0 on success without frequency changed.
  *  - Negative on error.
  */
-int rte_power_acpi_cpufreq_freq_max(unsigned lcore_id);
+int power_acpi_cpufreq_freq_max(unsigned int lcore_id);
 
 /**
  * Scale down the frequency of a specific lcore to the lowest according to the
@@ -183,7 +183,7 @@  int rte_power_acpi_cpufreq_freq_max(unsigned lcore_id);
  *  - 0 on success without frequency changed.
  *  - Negative on error.
  */
-int rte_power_acpi_cpufreq_freq_min(unsigned lcore_id);
+int power_acpi_cpufreq_freq_min(unsigned int lcore_id);
 
 /**
  * Get the turbo status of a specific lcore.
@@ -197,7 +197,7 @@  int rte_power_acpi_cpufreq_freq_min(unsigned lcore_id);
  *  - 0 Turbo Boost is disabled on this lcore.
  *  - Negative on error.
  */
-int rte_power_acpi_turbo_status(unsigned int lcore_id);
+int power_acpi_turbo_status(unsigned int lcore_id);
 
 /**
  * Enable Turbo Boost on a specific lcore.
@@ -210,7 +210,7 @@  int rte_power_acpi_turbo_status(unsigned int lcore_id);
  *  - 0 Turbo Boost is enabled successfully on this lcore.
  *  - Negative on error.
  */
-int rte_power_acpi_enable_turbo(unsigned int lcore_id);
+int power_acpi_enable_turbo(unsigned int lcore_id);
 
 /**
  * Disable Turbo Boost on a specific lcore.
@@ -223,7 +223,7 @@  int rte_power_acpi_enable_turbo(unsigned int lcore_id);
  *  - 0 Turbo Boost disabled successfully on this lcore.
  *  - Negative on error.
  */
-int rte_power_acpi_disable_turbo(unsigned int lcore_id);
+int power_acpi_disable_turbo(unsigned int lcore_id);
 
 #ifdef __cplusplus
 }
diff --git a/lib/librte_power/rte_power.c b/lib/librte_power/rte_power.c
index e7f35cf..db6f4a9 100644
--- a/lib/librte_power/rte_power.c
+++ b/lib/librte_power/rte_power.c
@@ -34,7 +34,7 @@ 
 #include <rte_atomic.h>
 
 #include "rte_power.h"
-#include "rte_power_acpi_cpufreq.h"
+#include "power_acpi_cpufreq.h"
 #include "rte_power_kvm_vm.h"
 #include "rte_power_common.h"
 
@@ -61,16 +61,16 @@  rte_power_set_env(enum power_management_env env)
 		return 0;
 	}
 	if (env == PM_ENV_ACPI_CPUFREQ) {
-		rte_power_freqs = rte_power_acpi_cpufreq_freqs;
-		rte_power_get_freq = rte_power_acpi_cpufreq_get_freq;
-		rte_power_set_freq = rte_power_acpi_cpufreq_set_freq;
-		rte_power_freq_up = rte_power_acpi_cpufreq_freq_up;
-		rte_power_freq_down = rte_power_acpi_cpufreq_freq_down;
-		rte_power_freq_min = rte_power_acpi_cpufreq_freq_min;
-		rte_power_freq_max = rte_power_acpi_cpufreq_freq_max;
-		rte_power_turbo_status = rte_power_acpi_turbo_status;
-		rte_power_freq_enable_turbo = rte_power_acpi_enable_turbo;
-		rte_power_freq_disable_turbo = rte_power_acpi_disable_turbo;
+		rte_power_freqs = power_acpi_cpufreq_freqs;
+		rte_power_get_freq = power_acpi_cpufreq_get_freq;
+		rte_power_set_freq = power_acpi_cpufreq_set_freq;
+		rte_power_freq_up = power_acpi_cpufreq_freq_up;
+		rte_power_freq_down = power_acpi_cpufreq_freq_down;
+		rte_power_freq_min = power_acpi_cpufreq_freq_min;
+		rte_power_freq_max = power_acpi_cpufreq_freq_max;
+		rte_power_turbo_status = power_acpi_turbo_status;
+		rte_power_freq_enable_turbo = power_acpi_enable_turbo;
+		rte_power_freq_disable_turbo = power_acpi_disable_turbo;
 	} else if (env == PM_ENV_KVM_VM) {
 		rte_power_freqs = rte_power_kvm_vm_freqs;
 		rte_power_get_freq = rte_power_kvm_vm_get_freq;
@@ -111,7 +111,7 @@  rte_power_init(unsigned int lcore_id)
 	int ret = -1;
 
 	if (global_default_env == PM_ENV_ACPI_CPUFREQ) {
-		return rte_power_acpi_cpufreq_init(lcore_id);
+		return power_acpi_cpufreq_init(lcore_id);
 	}
 	if (global_default_env == PM_ENV_KVM_VM) {
 		return rte_power_kvm_vm_init(lcore_id);
@@ -119,7 +119,7 @@  rte_power_init(unsigned int lcore_id)
 	/* Auto detect Environment */
 	RTE_LOG(INFO, POWER, "Attempting to initialise ACPI cpufreq power "
 			"management...\n");
-	ret = rte_power_acpi_cpufreq_init(lcore_id);
+	ret = power_acpi_cpufreq_init(lcore_id);
 	if (ret == 0) {
 		rte_power_set_env(PM_ENV_ACPI_CPUFREQ);
 		goto out;
@@ -141,7 +141,7 @@  int
 rte_power_exit(unsigned int lcore_id)
 {
 	if (global_default_env == PM_ENV_ACPI_CPUFREQ)
-		return rte_power_acpi_cpufreq_exit(lcore_id);
+		return power_acpi_cpufreq_exit(lcore_id);
 	if (global_default_env == PM_ENV_KVM_VM)
 		return rte_power_kvm_vm_exit(lcore_id);