]> git.ipfire.org Git - thirdparty/linux.git/commit
cpufreq: CPPC: Add generic helpers for sysfs show/store
authorSumit Gupta <sumitg@nvidia.com>
Tue, 20 Jan 2026 14:56:15 +0000 (20:26 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 28 Jan 2026 18:10:50 +0000 (19:10 +0100)
commit4a1cf5ed51b1b6049d7771d2e77789b99dafc8ae
treee178ccbb389e03bb17e73c9134dcce373fbe31a4
parentb753c3204d7b0e9bef956b64425709a9c40246fe
cpufreq: CPPC: Add generic helpers for sysfs show/store

Add generic helper functions for u64 sysfs attributes that follow the
common pattern of calling CPPC get/set APIs:
 - cppc_cpufreq_sysfs_show_u64(): reads value and handles -EOPNOTSUPP
 - cppc_cpufreq_sysfs_store_u64(): parses input and calls set function

Add CPPC_CPUFREQ_ATTR_RW_U64() macro to generate show/store functions
using these helpers, reducing boilerplate for simple attributes.

Convert auto_act_window and energy_performance_preference_val to use
the new macro.

No functional changes.

Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
Reviewed-by: Lifeng Zheng <zhenglifeng1@huawei.com>
[ rjw: Retained empty code line after a conditional ]
Link: https://patch.msgid.link/20260120145623.2959636-2-sumitg@nvidia.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/cppc_cpufreq.c