From 029db3fc5e5592982add7df05800a15cc072f5fa Mon Sep 17 00:00:00 2001 From: Len Brown Date: Wed, 6 May 2026 10:00:00 -0400 Subject: [PATCH] x86_energy_perf_policy: Cleanup: Define BCLK_MHZ Replace the hardcoded value 100 with a named symbolic constant BCLK_MHZ in ratio_2_sysfs_khz() to document the assumed bus clock frequency. Assisted-by: GitHub-Copilot:Claude-Sonnet-4.6 Signed-off-by: Len Brown --- .../x86/x86_energy_perf_policy/x86_energy_perf_policy.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c b/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c index 5fb6b0883e55..0a67b6f5381c 100644 --- a/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c +++ b/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c @@ -37,6 +37,10 @@ /* Maximum HWP activity window duration in microseconds */ #define HWP_WINDOW_MAX_USEC 1270000000U +/* Nominal bus clock frequency in MHz - assumed for all HWP systems */ +#define BCLK_MHZ 100 +#define KHZ_PER_MHZ 1000 + struct msr_hwp_cap { unsigned char highest; unsigned char guaranteed; @@ -1163,7 +1167,7 @@ int print_pkg_msrs(int pkg) */ int ratio_2_sysfs_khz(int ratio) { - int bclk_khz = 100 * 1000; /* 100,000 KHz = 100 MHz */ + int bclk_khz = BCLK_MHZ * KHZ_PER_MHZ; /* Convert MHz to KHz */ return ratio * bclk_khz; }