DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Huisong Li <lihuisong@huawei.com>
To: <anatoly.burakov@intel.com>, <sivaprasad.tummala@amd.com>
Cc: <dev@dpdk.org>, <thomas@monjalon.net>,
	<stephen@networkplumber.org>, <fengchengwen@huawei.com>,
	<yangxingui@huawei.com>, <zhanjie9@hisilicon.com>,
	 <lihuisong@huawei.com>
Subject: [PATCH 1/3] power: move power state structure to power cpufreq header
Date: Sat, 9 May 2026 16:45:01 +0800	[thread overview]
Message-ID: <20260509084503.2917038-2-lihuisong@huawei.com> (raw)
In-Reply-To: <20260509084503.2917038-1-lihuisong@huawei.com>

The "enum power_state" structure is defined by each cpufreq driver.
So move it to power_cpufreq.h to facilitate maintenance.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
 drivers/power/acpi/acpi_cpufreq.c                 |  7 -------
 drivers/power/amd_pstate/amd_pstate_cpufreq.c     |  7 -------
 drivers/power/cppc/cppc_cpufreq.c                 |  7 -------
 drivers/power/intel_pstate/intel_pstate_cpufreq.c |  8 --------
 lib/power/power_cpufreq.h                         | 10 ++++++++++
 5 files changed, 10 insertions(+), 29 deletions(-)

diff --git a/drivers/power/acpi/acpi_cpufreq.c b/drivers/power/acpi/acpi_cpufreq.c
index 81a5e3f6ea..21991af36a 100644
--- a/drivers/power/acpi/acpi_cpufreq.c
+++ b/drivers/power/acpi/acpi_cpufreq.c
@@ -31,13 +31,6 @@
 #define IA32_PERF_CTL     0x199
 #define CORE_TURBO_DISABLE_BIT ((uint64_t)1<<32)
 
-enum power_state {
-	POWER_IDLE = 0,
-	POWER_ONGOING,
-	POWER_USED,
-	POWER_UNKNOWN
-};
-
 /**
  * Power info per lcore.
  */
diff --git a/drivers/power/amd_pstate/amd_pstate_cpufreq.c b/drivers/power/amd_pstate/amd_pstate_cpufreq.c
index 95495bff7d..318f8c00e1 100644
--- a/drivers/power/amd_pstate/amd_pstate_cpufreq.c
+++ b/drivers/power/amd_pstate/amd_pstate_cpufreq.c
@@ -35,13 +35,6 @@
 #define POWER_AMD_PSTATE_DRIVER "amd-pstate"
 #define BUS_FREQ     1000	/* khz */
 
-enum power_state {
-	POWER_IDLE = 0,
-	POWER_ONGOING,
-	POWER_USED,
-	POWER_UNKNOWN
-};
-
 /**
  * Power info per lcore.
  */
diff --git a/drivers/power/cppc/cppc_cpufreq.c b/drivers/power/cppc/cppc_cpufreq.c
index 3cd4165c83..e3ba9bb60a 100644
--- a/drivers/power/cppc/cppc_cpufreq.c
+++ b/drivers/power/cppc/cppc_cpufreq.c
@@ -39,13 +39,6 @@
 #define POWER_CPPC_DRIVER "cppc_cpufreq"
 #define BUS_FREQ     100000
 
-enum power_state {
-	POWER_IDLE = 0,
-	POWER_ONGOING,
-	POWER_USED,
-	POWER_UNKNOWN
-};
-
 /**
  * Power info per lcore.
  */
diff --git a/drivers/power/intel_pstate/intel_pstate_cpufreq.c b/drivers/power/intel_pstate/intel_pstate_cpufreq.c
index 8e27570e3c..22a1b4465a 100644
--- a/drivers/power/intel_pstate/intel_pstate_cpufreq.c
+++ b/drivers/power/intel_pstate/intel_pstate_cpufreq.c
@@ -41,14 +41,6 @@
 		"/sys/devices/system/cpu/intel_pstate/turbo_pct"
 #define POWER_PSTATE_DRIVER "intel_pstate"
 
-
-enum power_state {
-	POWER_IDLE = 0,
-	POWER_ONGOING,
-	POWER_USED,
-	POWER_UNKNOWN
-};
-
 struct __rte_cache_aligned pstate_power_info {
 	unsigned int lcore_id;               /**< Logical core id */
 	uint32_t freqs[RTE_MAX_LCORE_FREQS]; /**< Frequency array */
diff --git a/lib/power/power_cpufreq.h b/lib/power/power_cpufreq.h
index fb0b7feb82..41bfaed7bb 100644
--- a/lib/power/power_cpufreq.h
+++ b/lib/power/power_cpufreq.h
@@ -18,6 +18,16 @@
 
 #define RTE_POWER_DRIVER_NAMESZ 24
 
+/**
+ * Power state of cpufreq driver
+ */
+enum power_state {
+	POWER_IDLE = 0,
+	POWER_ONGOING,
+	POWER_USED,
+	POWER_UNKNOWN
+};
+
 /**
  * Initialize power management for a specific lcore. If rte_power_set_env() has
  * not been called then an auto-detect of the environment will start and
-- 
2.33.0


  reply	other threads:[~2026-05-09  8:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-09  8:45 [PATCH 0/3] power: some cleancode for cpufreq library Huisong Li
2026-05-09  8:45 ` Huisong Li [this message]
2026-05-09  8:45 ` [PATCH 2/3] power: unify decimal format macro for strtoul Huisong Li
2026-05-09  8:45 ` [PATCH 3/3] power: use common decimal macro definition Huisong Li
2026-05-11  1:10 ` [PATCH 0/3] power: some cleancode for cpufreq library fengchengwen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260509084503.2917038-2-lihuisong@huawei.com \
    --to=lihuisong@huawei.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=fengchengwen@huawei.com \
    --cc=sivaprasad.tummala@amd.com \
    --cc=stephen@networkplumber.org \
    --cc=thomas@monjalon.net \
    --cc=yangxingui@huawei.com \
    --cc=zhanjie9@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox