powercap: intel_rapl: Change primitive order
authorZhang Rui <rui.zhang@intel.com>
Wed, 19 Apr 2023 02:44:11 +0000 (10:44 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 24 May 2023 16:46:19 +0000 (18:46 +0200)
commit045610c383bd6b740bb7e7c780d6f7729249e60d
treece53e9c4e85e00d2adc29fa19624a163b56cb1d0
parent11edbe5c66d624e2e1eec8929d3668d76a574c3b
powercap: intel_rapl: Change primitive order

The same set of operations are shared by different Powert Limits,
including Power Limit get/set, Power Limit enable/disable, clamping
enable/disable, time window get/set, and max power get/set, etc.

But the same operation for different Power Limit has different
primitives because they use different registers/register bits.

A lot of dirty/duplicate code was introduced to handle this difference.

Instead of using hardcoded primitive name directly, using Power Limit id
+ operation type is much cleaner.

For this sense, move POWER_LIMIT1/POWER_LIMIT2/POWER_LIMIT4 to the
beginning of enum rapl_primitives so that they can be reused as
Power Limit ids.

No functional change.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Tested-by: Wang Wendy <wendy.wang@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/powercap/intel_rapl_common.c
include/linux/intel_rapl.h