Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powercap/intel_rapl: Simplify rapl_find_package()

Simplify how the code to discover a package is called. Rename
find_package_by_id() to rapl_find_package_domain()

Syntax only, no functional or semantic change.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: linux-pm@vger.kernel.org
Link: https://lkml.kernel.org/r/ae3d1903407fd6e3684234b674f4f0e62c2ab54c.1557769318.git.len.brown@intel.com

authored by

Zhang Rui and committed by
Thomas Gleixner
aadf7b38 212bf4fd

+9 -9
+9 -9
drivers/powercap/intel_rapl.c
··· 264 264 static struct rapl_domain *platform_rapl_domain; /* Platform (PSys) domain */ 265 265 266 266 /* caller to ensure CPU hotplug lock is held */ 267 - static struct rapl_package *find_package_by_id(int id) 267 + static struct rapl_package *rapl_find_package_domain(int cpu) 268 268 { 269 + int id = topology_physical_package_id(cpu); 269 270 struct rapl_package *rp; 270 271 271 272 list_for_each_entry(rp, &rapl_packages, plist) { ··· 1301 1300 rd->rpl[0].name = pl1_name; 1302 1301 rd->rpl[1].prim_id = PL2_ENABLE; 1303 1302 rd->rpl[1].name = pl2_name; 1304 - rd->rp = find_package_by_id(0); 1303 + rd->rp = rapl_find_package_domain(0); 1305 1304 1306 1305 power_zone = powercap_register_zone(&rd->power_zone, control_type, 1307 1306 "psys", NULL, ··· 1457 1456 } 1458 1457 1459 1458 /* called from CPU hotplug notifier, hotplug lock held */ 1460 - static struct rapl_package *rapl_add_package(int cpu, int pkgid) 1459 + static struct rapl_package *rapl_add_package(int cpu) 1461 1460 { 1461 + int id = topology_physical_package_id(cpu); 1462 1462 struct rapl_package *rp; 1463 1463 int ret; 1464 1464 ··· 1468 1466 return ERR_PTR(-ENOMEM); 1469 1467 1470 1468 /* add the new package to the list */ 1471 - rp->id = pkgid; 1469 + rp->id = id; 1472 1470 rp->lead_cpu = cpu; 1473 1471 1474 1472 /* check if the package contains valid domains */ ··· 1499 1497 */ 1500 1498 static int rapl_cpu_online(unsigned int cpu) 1501 1499 { 1502 - int pkgid = topology_physical_package_id(cpu); 1503 1500 struct rapl_package *rp; 1504 1501 1505 - rp = find_package_by_id(pkgid); 1502 + rp = rapl_find_package_domain(cpu); 1506 1503 if (!rp) { 1507 - rp = rapl_add_package(cpu, pkgid); 1504 + rp = rapl_add_package(cpu); 1508 1505 if (IS_ERR(rp)) 1509 1506 return PTR_ERR(rp); 1510 1507 } ··· 1513 1512 1514 1513 static int rapl_cpu_down_prep(unsigned int cpu) 1515 1514 { 1516 - int pkgid = topology_physical_package_id(cpu); 1517 1515 struct rapl_package *rp; 1518 1516 int lead_cpu; 1519 1517 1520 - rp = find_package_by_id(pkgid); 1518 + rp = rapl_find_package_domain(cpu); 1521 1519 if (!rp) 1522 1520 return 0; 1523 1521