Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3324226imj; Tue, 19 Feb 2019 01:13:43 -0800 (PST) X-Google-Smtp-Source: AHgI3IYvB9yHymsUkGNJh9xGLO/ngkEtZ3hH3KpKSEIO3xWSSC8nYSJSVaQHQa6KX3e/aEKCALvd X-Received: by 2002:a63:6605:: with SMTP id a5mr1839086pgc.372.1550567623331; Tue, 19 Feb 2019 01:13:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550567623; cv=none; d=google.com; s=arc-20160816; b=A/U00U35s2LU7RImJb0F7si3krWUyep+UdTCw65ibISpi/8MgRx13rUVR8MY2bLLqC hz2j7TERVIoVjFD8tge7VqhYZX4qqGovqL7deBGyQEOE90T6+xmhrDx/UPE4WhqWGlR7 qHWVQKQ1jMOQLABxULObiTlh26TXO4Y+mbpxAW+9R1aMUjuRA4gvQvlsNMOrMSsZA025 ZeMgbZr941mn5uS/A1C30+BVyfMOkFQiu+a9mR8eY58IBTLt3iiGCHVNWb2vL/tKAJLi fmttZWX+O6KQBQ+E53xz4K4etiTIRZOuIrOOB2fYawdKxRqZP/HQ3TeddkpYTOqtpabn 68Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=fpZqX8ZhanD8VsrfzSWpgGhHEmCBLY3UZTMgd9EGn4k=; b=hr+uP1vBH2ZmJwockvmnnAnXO2YRudWw0gZhQWEcb3zWJMGLuE7TC9iysapYgvHT6W XF+nyJXnuDme8TWCdldj9p2f8wrouetZCeF7zXOK4U2SiJv3FniF+NHDTDiVSfsaFRLI ZogIvYdb3zjWtwdRztl6x6gyNCZNck4n5cbVOt40s3aNkybMLfsfhMZ441SeoUlvPiEg 2muhoUiL+EPQPY1sEQ3/M6wZZGTQgFqsFgTHSjJIOzFMVEoufZGo+069vxmfV29l1XE2 OU5D5ylCYkYUaE54sUCVmlcXm0xrvr9Y5HA14RePhWdR7RdYRn4ebTuhp2WGV8eaiBKw eTeQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i11si7257813plt.280.2019.02.19.01.13.28; Tue, 19 Feb 2019 01:13:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727819AbfBSJLu (ORCPT + 99 others); Tue, 19 Feb 2019 04:11:50 -0500 Received: from mail-ot1-f66.google.com ([209.85.210.66]:42641 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725765AbfBSJLu (ORCPT ); Tue, 19 Feb 2019 04:11:50 -0500 Received: by mail-ot1-f66.google.com with SMTP id i5so32954989oto.9; Tue, 19 Feb 2019 01:11:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fpZqX8ZhanD8VsrfzSWpgGhHEmCBLY3UZTMgd9EGn4k=; b=d0YTGPGd+w9Qi1yWlHvQF5dg9Hg+MGt1fh25hUb7TVtcKic19MYg37t63WmlYBLNY+ pRR0PGHbfxAkysy6OQ5UvhJJKm2w174ZHIA8ujVw5+hX8rRxxvhfpKDwacS/Zr+6ldm5 TMTil2yE6m6038hv12tGt2CG+meglUavZuHKMXZjMm1VrsGnu/n+DXa2Bkdvc2jV4+9n sqS55Uc9aNg3Y6hN7oopoxVmF/Dhi1juQqYLFb0BDUmimWAPN9hI6RFvNhxKWMr+3EgB O/+G8ZC/KS37ipb+1XJc5D98/PNkRx1omFhlow4OMzhDHCAWWcoLz+j5l9RzKV46vQM6 66zA== X-Gm-Message-State: AHQUAuaWj6SA0CaoKbK2z+GgWrsYGZ4QuQMzmXF82QHeZ6vASZPZn5t1 9GTbVhaNAkkdMR+VBVIKhWwYhSCv8k9MA3mFY1Cpldrw X-Received: by 2002:a9d:5e8c:: with SMTP id f12mr17626418otl.343.1550567508944; Tue, 19 Feb 2019 01:11:48 -0800 (PST) MIME-Version: 1.0 References: <635b2bf8b1151a191cd9299276b75791a818c0c2.1550545163.git.len.brown@intel.com> In-Reply-To: From: "Rafael J. Wysocki" Date: Tue, 19 Feb 2019 10:11:37 +0100 Message-ID: Subject: Re: [PATCH 07/11] powercap/intel_rapl: simplify rapl_find_package() To: Len Brown Cc: "the arch/x86 maintainers" , Linux Kernel Mailing List , Zhang Rui , Len Brown , Linux PM Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 19, 2019 at 4:41 AM Len Brown wrote: > > From: Zhang Rui > > 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 > Signed-off-by: Len Brown > Cc: linux-pm@vger.kernel.org > Signed-off-by: Len Brown Acked-by: Rafael J. Wysocki > --- > 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 >