[PATCH 2/3] power: unify decimal format macro for strtoul

Huisong Li lihuisong at huawei.com
Sat May 9 10:45:02 CEST 2026


Unify and move POWER_CONVERT_TO_DECIMAL definition to common header
file to facilitate the use of drivers and library.

Signed-off-by: Huisong Li <lihuisong at huawei.com>
---
 drivers/power/acpi/acpi_cpufreq.c             | 1 -
 drivers/power/amd_pstate/amd_pstate_cpufreq.c | 2 --
 drivers/power/cppc/cppc_cpufreq.c             | 2 --
 lib/power/power_common.c                      | 1 -
 lib/power/power_common.h                      | 2 ++
 5 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/power/acpi/acpi_cpufreq.c b/drivers/power/acpi/acpi_cpufreq.c
index 21991af36a..875c66336d 100644
--- a/drivers/power/acpi/acpi_cpufreq.c
+++ b/drivers/power/acpi/acpi_cpufreq.c
@@ -14,7 +14,6 @@
 #include "power_common.h"
 
 #define STR_SIZE     1024
-#define POWER_CONVERT_TO_DECIMAL 10
 
 #define POWER_GOVERNOR_USERSPACE "userspace"
 #define POWER_SYSFILE_AVAIL_FREQ \
diff --git a/drivers/power/amd_pstate/amd_pstate_cpufreq.c b/drivers/power/amd_pstate/amd_pstate_cpufreq.c
index 318f8c00e1..bc67981d71 100644
--- a/drivers/power/amd_pstate/amd_pstate_cpufreq.c
+++ b/drivers/power/amd_pstate/amd_pstate_cpufreq.c
@@ -16,8 +16,6 @@
 #define FREQ_ROUNDING_DELTA 500
 #define ROUND_FREQ_TO_N_1000 1000
 
-#define POWER_CONVERT_TO_DECIMAL 10
-
 #define POWER_GOVERNOR_USERSPACE "userspace"
 #define POWER_SYSFILE_SETSPEED   \
 		"/sys/devices/system/cpu/cpu%u/cpufreq/scaling_setspeed"
diff --git a/drivers/power/cppc/cppc_cpufreq.c b/drivers/power/cppc/cppc_cpufreq.c
index e3ba9bb60a..9ae25bad27 100644
--- a/drivers/power/cppc/cppc_cpufreq.c
+++ b/drivers/power/cppc/cppc_cpufreq.c
@@ -20,8 +20,6 @@
  */
 #define UNIT_DIFF 10000
 
-#define POWER_CONVERT_TO_DECIMAL 10
-
 #define POWER_GOVERNOR_USERSPACE "userspace"
 #define POWER_SYSFILE_SETSPEED   \
 		"/sys/devices/system/cpu/cpu%u/cpufreq/scaling_setspeed"
diff --git a/lib/power/power_common.c b/lib/power/power_common.c
index 2da034e9d0..da22a4d160 100644
--- a/lib/power/power_common.c
+++ b/lib/power/power_common.c
@@ -21,7 +21,6 @@ RTE_LOG_REGISTER_DEFAULT(rte_power_logtype, INFO);
 		"/sys/devices/system/cpu/cpu%u/cpufreq/scaling_driver"
 #define POWER_SYSFILE_GOVERNOR  \
 		"/sys/devices/system/cpu/cpu%u/cpufreq/scaling_governor"
-#define POWER_CONVERT_TO_DECIMAL 10
 
 RTE_EXPORT_INTERNAL_SYMBOL(cpufreq_check_scaling_driver)
 int
diff --git a/lib/power/power_common.h b/lib/power/power_common.h
index 3f56b1103d..e2d5b68a17 100644
--- a/lib/power/power_common.h
+++ b/lib/power/power_common.h
@@ -23,6 +23,8 @@ extern int rte_power_logtype;
 #define POWER_DEBUG_LOG(...)
 #endif
 
+#define POWER_CONVERT_TO_DECIMAL 10
+
 /* check if scaling driver matches one we want */
 __rte_internal
 int cpufreq_check_scaling_driver(const char *driver);
-- 
2.33.0



More information about the dev mailing list