Skip to content

Commit 2605e4a

Browse files
Lifeng Zhengrafaeljw
authored andcommitted
ACPI: CPPC: Modify cppc_get_auto_sel_caps() to cppc_get_auto_sel()
Modify cppc_get_auto_sel_caps() to cppc_get_auto_sel(). Using a cppc_perf_caps to carry the value is unnecessary. Add a check to ensure the pointer 'enable' is not null. Reviewed-by: Pierre Gondois <[email protected]> Signed-off-by: Lifeng Zheng <[email protected]> Reviewed-by: Mario Limonciello <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent ab482f1 commit 2605e4a

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

drivers/acpi/cppc_acpi.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1602,23 +1602,27 @@ int cppc_set_epp_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls, bool enable)
16021602
EXPORT_SYMBOL_GPL(cppc_set_epp_perf);
16031603

16041604
/**
1605-
* cppc_get_auto_sel_caps - Read autonomous selection register.
1606-
* @cpunum : CPU from which to read register.
1607-
* @perf_caps : struct where autonomous selection register value is updated.
1605+
* cppc_get_auto_sel() - Read autonomous selection register.
1606+
* @cpu: CPU from which to read register.
1607+
* @enable: Return address.
16081608
*/
1609-
int cppc_get_auto_sel_caps(int cpunum, struct cppc_perf_caps *perf_caps)
1609+
int cppc_get_auto_sel(int cpu, bool *enable)
16101610
{
16111611
u64 auto_sel;
16121612
int ret;
16131613

1614-
ret = cppc_get_reg_val(cpunum, AUTO_SEL_ENABLE, &auto_sel);
1614+
if (enable == NULL)
1615+
return -EINVAL;
1616+
1617+
ret = cppc_get_reg_val(cpu, AUTO_SEL_ENABLE, &auto_sel);
16151618
if (ret)
16161619
return ret;
16171620

1618-
perf_caps->auto_sel = (bool)auto_sel;
1621+
*enable = (bool)auto_sel;
1622+
16191623
return 0;
16201624
}
1621-
EXPORT_SYMBOL_GPL(cppc_get_auto_sel_caps);
1625+
EXPORT_SYMBOL_GPL(cppc_get_auto_sel);
16221626

16231627
/**
16241628
* cppc_set_auto_sel - Write autonomous selection register.

drivers/cpufreq/amd-pstate.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,7 @@ static int shmem_init_perf(struct amd_cpudata *cpudata)
417417
struct cppc_perf_caps cppc_perf;
418418
union perf_cached perf = READ_ONCE(cpudata->perf);
419419
u64 numerator;
420+
bool auto_sel;
420421

421422
int ret = cppc_get_perf_caps(cpudata->cpu, &cppc_perf);
422423
if (ret)
@@ -438,7 +439,7 @@ static int shmem_init_perf(struct amd_cpudata *cpudata)
438439
if (cppc_state == AMD_PSTATE_ACTIVE)
439440
return 0;
440441

441-
ret = cppc_get_auto_sel_caps(cpudata->cpu, &cppc_perf);
442+
ret = cppc_get_auto_sel(cpudata->cpu, &auto_sel);
442443
if (ret) {
443444
pr_warn("failed to get auto_sel, ret: %d\n", ret);
444445
return 0;

include/acpi/cppc_acpi.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ extern int cpc_read_ffh(int cpunum, struct cpc_reg *reg, u64 *val);
159159
extern int cpc_write_ffh(int cpunum, struct cpc_reg *reg, u64 val);
160160
extern int cppc_get_epp_perf(int cpunum, u64 *epp_perf);
161161
extern int cppc_set_epp_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls, bool enable);
162-
extern int cppc_get_auto_sel_caps(int cpunum, struct cppc_perf_caps *perf_caps);
162+
extern int cppc_get_auto_sel(int cpu, bool *enable);
163163
extern int cppc_set_auto_sel(int cpu, bool enable);
164164
extern int amd_get_highest_perf(unsigned int cpu, u32 *highest_perf);
165165
extern int amd_get_boost_ratio_numerator(unsigned int cpu, u64 *numerator);
@@ -229,11 +229,11 @@ static inline int cppc_get_epp_perf(int cpunum, u64 *epp_perf)
229229
{
230230
return -EOPNOTSUPP;
231231
}
232-
static inline int cppc_set_auto_sel(int cpu, bool enable)
232+
static inline int cppc_get_auto_sel(int cpu, bool *enable)
233233
{
234234
return -EOPNOTSUPP;
235235
}
236-
static inline int cppc_get_auto_sel_caps(int cpunum, struct cppc_perf_caps *perf_caps)
236+
static inline int cppc_set_auto_sel(int cpu, bool enable)
237237
{
238238
return -EOPNOTSUPP;
239239
}

0 commit comments

Comments
 (0)