summaryrefslogtreecommitdiffstats
path: root/drivers/powercap/intel_rapl_common.c
diff options
context:
space:
mode:
authorYunfeng Ye <yeyunfeng@huawei.com>2021-01-23 05:06:07 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2021-02-12 16:53:01 +0100
commit88ffce95764603e13eda4be003ec919e124ec365 (patch)
treeaf59e560c1cc371e9175d28f5a7b18a7d2b84c5f /drivers/powercap/intel_rapl_common.c
parentcca26b66efc1e92c10701087aca4895530660b85 (diff)
downloadlinux-stable-88ffce95764603e13eda4be003ec919e124ec365.tar.gz
linux-stable-88ffce95764603e13eda4be003ec919e124ec365.tar.bz2
linux-stable-88ffce95764603e13eda4be003ec919e124ec365.zip
powercap: intel_rapl: Use topology interface in rapl_add_package()
It's not a good idea to access phys_proc_id and cpu_die_id directly. Use topology_physical_package_id(cpu) and topology_die_id(cpu) instead. Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com> [ rjw: Changelog edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/powercap/intel_rapl_common.c')
-rw-r--r--drivers/powercap/intel_rapl_common.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/powercap/intel_rapl_common.c b/drivers/powercap/intel_rapl_common.c
index f0799837c2dd..b6c7bedf517e 100644
--- a/drivers/powercap/intel_rapl_common.c
+++ b/drivers/powercap/intel_rapl_common.c
@@ -1310,7 +1310,6 @@ struct rapl_package *rapl_add_package(int cpu, struct rapl_if_priv *priv)
{
int id = topology_logical_die_id(cpu);
struct rapl_package *rp;
- struct cpuinfo_x86 *c = &cpu_data(cpu);
int ret;
if (!rapl_defaults)
@@ -1327,10 +1326,11 @@ struct rapl_package *rapl_add_package(int cpu, struct rapl_if_priv *priv)
if (topology_max_die_per_package() > 1)
snprintf(rp->name, PACKAGE_DOMAIN_NAME_LENGTH,
- "package-%d-die-%d", c->phys_proc_id, c->cpu_die_id);
+ "package-%d-die-%d",
+ topology_physical_package_id(cpu), topology_die_id(cpu));
else
snprintf(rp->name, PACKAGE_DOMAIN_NAME_LENGTH, "package-%d",
- c->phys_proc_id);
+ topology_physical_package_id(cpu));
/* check if the package contains valid domains */
if (rapl_detect_domains(rp, cpu) || rapl_defaults->check_unit(rp, cpu)) {