[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0i1LigqFyg3tFrcOyJRehJyKJOyn7CSePOok=q+3zewpg@mail.gmail.com>
Date: Tue, 19 Feb 2019 10:11:37 +0100
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Len Brown <lenb@...nel.org>
Cc: "the arch/x86 maintainers" <x86@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Zhang Rui <rui.zhang@...el.com>,
Len Brown <len.brown@...el.com>,
Linux PM <linux-pm@...r.kernel.org>
Subject: Re: [PATCH 07/11] powercap/intel_rapl: simplify rapl_find_package()
On Tue, Feb 19, 2019 at 4:41 AM Len Brown <lenb@...nel.org> wrote:
>
> From: Zhang Rui <rui.zhang@...el.com>
>
> Simplify how the code to discover a package is called.
> Rename find_package_by_id() to rapl_find_package()
>
> No functional change.
>
> Signed-off-by: Zhang Rui <rui.zhang@...el.com>
> Signed-off-by: Len Brown <len.brown@...el.com>
> Cc: linux-pm@...r.kernel.org
> Signed-off-by: Len Brown <len.brown@...el.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> ---
> drivers/powercap/intel_rapl.c | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/powercap/intel_rapl.c b/drivers/powercap/intel_rapl.c
> index 6cdb2c14eee4..6057d9695fed 100644
> --- a/drivers/powercap/intel_rapl.c
> +++ b/drivers/powercap/intel_rapl.c
> @@ -264,8 +264,9 @@ static struct powercap_control_type *control_type; /* PowerCap Controller */
> static struct rapl_domain *platform_rapl_domain; /* Platform (PSys) domain */
>
> /* caller to ensure CPU hotplug lock is held */
> -static struct rapl_package *find_package_by_id(int id)
> +static struct rapl_package *rapl_find_package(int cpu)
> {
> + int id = topology_physical_package_id(cpu);
> struct rapl_package *rp;
>
> list_for_each_entry(rp, &rapl_packages, plist) {
> @@ -1298,7 +1299,7 @@ static int __init rapl_register_psys(void)
> rd->rpl[0].name = pl1_name;
> rd->rpl[1].prim_id = PL2_ENABLE;
> rd->rpl[1].name = pl2_name;
> - rd->rp = find_package_by_id(0);
> + rd->rp = rapl_find_package(0);
>
> power_zone = powercap_register_zone(&rd->power_zone, control_type,
> "psys", NULL,
> @@ -1454,8 +1455,9 @@ static void rapl_remove_package(struct rapl_package *rp)
> }
>
> /* called from CPU hotplug notifier, hotplug lock held */
> -static struct rapl_package *rapl_add_package(int cpu, int pkgid)
> +static struct rapl_package *rapl_add_package(int cpu)
> {
> + int id = topology_physical_package_id(cpu);
> struct rapl_package *rp;
> int ret;
>
> @@ -1464,7 +1466,7 @@ static struct rapl_package *rapl_add_package(int cpu, int pkgid)
> return ERR_PTR(-ENOMEM);
>
> /* add the new package to the list */
> - rp->id = pkgid;
> + rp->id = id;
> rp->lead_cpu = cpu;
>
> /* check if the package contains valid domains */
> @@ -1495,12 +1497,11 @@ static struct rapl_package *rapl_add_package(int cpu, int pkgid)
> */
> static int rapl_cpu_online(unsigned int cpu)
> {
> - int pkgid = topology_physical_package_id(cpu);
> struct rapl_package *rp;
>
> - rp = find_package_by_id(pkgid);
> + rp = rapl_find_package(cpu);
> if (!rp) {
> - rp = rapl_add_package(cpu, pkgid);
> + rp = rapl_add_package(cpu);
> if (IS_ERR(rp))
> return PTR_ERR(rp);
> }
> @@ -1510,11 +1511,10 @@ static int rapl_cpu_online(unsigned int cpu)
>
> static int rapl_cpu_down_prep(unsigned int cpu)
> {
> - int pkgid = topology_physical_package_id(cpu);
> struct rapl_package *rp;
> int lead_cpu;
>
> - rp = find_package_by_id(pkgid);
> + rp = rapl_find_package(cpu);
> if (!rp)
> return 0;
>
> --
> 2.18.0-rc0
>
Powered by blists - more mailing lists