]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ACPI: CPPC: Optimize cppc_get_perf()
authorLifeng Zheng <zhenglifeng1@huawei.com>
Fri, 11 Apr 2025 09:38:49 +0000 (17:38 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 30 Apr 2025 20:01:30 +0000 (22:01 +0200)
commit45f3763a2122553e548fa0430b77605dc23f00cc
treef9d4b4ac700a930a41e24ffde24987de84f807ef
parente3d7935a6c6138da51626d2b956a079dd0e6671b
ACPI: CPPC: Optimize cppc_get_perf()

Optimize cppc_get_perf() with three changes:

 1. Change the error kind to "no such device" when pcc_ss_id < 0, as
    other register value getting functions.

 2. Add a check to ensure the pointer 'perf' is no null.

 3. Add a check to verify if the register is supported to be read before
    using it. The logic is:

    (1) If the register is of the integer type, check whether the
        register is optional and its value is 0. If yes, the register
        is not supported.

    (2) If the register is of other types, a null one is not supported.

 4. Return the result of cpc_read() instead of 0.

Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
Signed-off-by: Lifeng Zheng <zhenglifeng1@huawei.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://patch.msgid.link/20250411093855.982491-3-zhenglifeng1@huawei.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/cppc_acpi.c