Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2955362yba; Mon, 6 May 2019 14:30:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqz4C0p1YWYLSckm7GfnBIqEmDKtMlKO8VvQq8GElFgE1MoqD7SoTT4AATBGk8OaiFAh6oau X-Received: by 2002:a63:5953:: with SMTP id j19mr35017069pgm.260.1557178241003; Mon, 06 May 2019 14:30:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557178240; cv=none; d=google.com; s=arc-20160816; b=O8Q2C+ci/QmwknaLCgRNb8NhAz+vCD6+2NmHqNxxq7kBodqiyEwWPzf9XUoAAnh4zO JbfmnhfxouXeK99XG9i7Nm9OJXA1fapqz1ji3e556b5FXymSvSuz1VYruopL/EcGmOzx 44DWKb++BiJSgzRFbFuuJPmIVakMf2KrMcWn0Y5rtWcGGEnwEgqZB3VithImh5k9VDLM H6NL4CbBKn1nT6KcDljL9fPwcJTeFThRnOIwjE/puOE7OrZ/p5bNp3GfzOUEE6MZKC2Y OB0RKL1XzI4iKG0rRHXS7+oBZSX2M3VHeS67/1qXfuWqLZRcSlq0/NvZ6DGc+RjM29sp KqVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=ovDsv1zygxqsz+aM2MZ2wBAE8qWaN9gCYdGAVIqjCpQ=; b=usjDYaAHjllfO1nv029VzOZuuxoAUYCsYWsks2HmtiNc+MZQvVjw6XL3I1mVGPcceE W20z9pwfuvOPmuH8GwEwsaJJRGg1Jg6R1Az/kn9bWTB+itH6JJlDdz4JeZCT9st/3t7o luHzPdnFsPCQs1Xdjc6/DgCL5U/w+ngq67EzSDdzAVbMj8jJgQH3djPSdsVD+uoyuT1N q51hME5AcdwEbVip1js7wurJgSeyH+P7M3DBExPjjh67exXaVwg9D0aEOZyEg/v+BwOy NOqn/sVJ1+7We9zyoYYc3Cu357JKESqTzKhBMJon6VcVkbYpAMG+KR8uz27XJyzcBJQF 3d0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=pKRGEef3; 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 i4si9799554pfa.218.2019.05.06.14.30.25; Mon, 06 May 2019 14:30:40 -0700 (PDT) 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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=pKRGEef3; 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 S1726960AbfEFV0m (ORCPT + 99 others); Mon, 6 May 2019 17:26:42 -0400 Received: from mail-it1-f195.google.com ([209.85.166.195]:39967 "EHLO mail-it1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726916AbfEFV0h (ORCPT ); Mon, 6 May 2019 17:26:37 -0400 Received: by mail-it1-f195.google.com with SMTP id g71so7288216ita.5; Mon, 06 May 2019 14:26:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :reply-to:organization; bh=ovDsv1zygxqsz+aM2MZ2wBAE8qWaN9gCYdGAVIqjCpQ=; b=pKRGEef334uc2GHUkzQaEKu5z/YZvsJ8RobXHE2ryI+6Iq3iCtjiKVL1AJlIikT/6S dSr6SVoc9GtPRPDhjoqgqeKuBYpm0tW6yVExYb0rNZnqLgPAzkLEXe8hg+6CDR4xTA4z h97rvW0CBHjgwzgcfuE2ygFsEGS/OnqFS6zlJB6xwlwsZyRguec7FNkTpL0kZ65xTC9O 8Q/T70t/5usSp/cADqkuusoD/38rsTmxFtuTj+e2UWMRATTKM2toCbjewu85mIdEiQ8A Z5jFssrCRuqh0tGB4FALwk5rhVG8WFKk5oPktIcK7ojjsEf+KCgoyVq7PGSVUkFq7T0Q 3NGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:reply-to:organization; bh=ovDsv1zygxqsz+aM2MZ2wBAE8qWaN9gCYdGAVIqjCpQ=; b=Ei2cd5UYiNt89JoL5nXUwU2EtWrdTeiQK7W6//szDUeM1vg1LUw0/hfgYoij/x42O9 NpXoVZ7A4KUHV9iWON7HIOpj2gDMAEGMx+y+YaJzPCRavS69/2SOfU2UtNdfnvH7oDFf av/YFwZStkun01xgyH8VwP69emNy/Z8kBUVEsRIhl+7DZBD/OsfjXRy8PwvvmquCLLvA iQznLByixewQdsLmR5cKxJ0Jcu+IpLxo4Upu0KnCMBBPI7JwXXFRMt+49WhCHpP274IA pS2+clymXYSPSmU/LDM/yfJUmRppiFjzOBml+wlkSEvjBJ446Db1d1HmGgB0bbwcO7V1 YnOg== X-Gm-Message-State: APjAAAVIQc0MWEEx6CuO7wa9HJFEN8H6BBIwPTJIMNmdYgXwZT1etKlu vKKzBpGhJKD4JNwzLVep9Ts= X-Received: by 2002:a24:c4c4:: with SMTP id v187mr19473543itf.66.1557177996763; Mon, 06 May 2019 14:26:36 -0700 (PDT) Received: from nuc8.lan (h69-131-112-51.cntcnh.dsl.dynamic.tds.net. [69.131.112.51]) by smtp.gmail.com with ESMTPSA id v25sm4268009ioh.81.2019.05.06.14.26.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 May 2019 14:26:36 -0700 (PDT) From: Len Brown To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Zhang Rui , Len Brown , linux-pm@vger.kernel.org Subject: [PATCH 09/22] powercap/intel_rapl: Simplify rapl_find_package() Date: Mon, 6 May 2019 17:26:04 -0400 Message-Id: X-Mailer: git-send-email 2.18.0-rc0 In-Reply-To: <6f53f0e494d743c79e18f6e3a98085711e6ddd0c.1557177585.git.len.brown@intel.com> References: <6f53f0e494d743c79e18f6e3a98085711e6ddd0c.1557177585.git.len.brown@intel.com> Reply-To: Len Brown Organization: Intel Open Source Technology Center Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zhang Rui Syntax only, no functional or semantic change. Simplify how the code to discover a package is called. Rename find_package_by_id() to rapl_find_package_domain() Signed-off-by: Zhang Rui Signed-off-by: Len Brown Acked-by: Rafael J. Wysocki Cc: linux-pm@vger.kernel.org --- 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 4347f15165f8..3c3c0c23180b 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_domain(int cpu) { + int id = topology_physical_package_id(cpu); struct rapl_package *rp; list_for_each_entry(rp, &rapl_packages, plist) { @@ -1300,7 +1301,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_domain(0); power_zone = powercap_register_zone(&rd->power_zone, control_type, "psys", NULL, @@ -1456,8 +1457,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; @@ -1466,7 +1468,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 */ @@ -1497,12 +1499,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_domain(cpu); if (!rp) { - rp = rapl_add_package(cpu, pkgid); + rp = rapl_add_package(cpu); if (IS_ERR(rp)) return PTR_ERR(rp); } @@ -1512,11 +1513,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_domain(cpu); if (!rp) return 0; -- 2.18.0-rc0