Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5385947yba; Tue, 30 Apr 2019 13:59:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqzCD4sEd4LaE0YUErtaiIEm8hfgvNSGojo7JYnZEgkeD5EmeAK+7EPQcfSkTwZLudTRBwQz X-Received: by 2002:a63:fc43:: with SMTP id r3mr68115479pgk.44.1556657987698; Tue, 30 Apr 2019 13:59:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556657987; cv=none; d=google.com; s=arc-20160816; b=u4f7tBz8zbopjNCEOkpPL3w6xoXh7ulqjGH5v53xPjOKDwCqmfZLAM0RheNzn/wMHT Dda4gpHPb4Tk+9y6t49b7UgGCNUr3J85l/U7nZZVmKPjlwbLh/13PjtFeLi4yHH0vH2G XeJry9ggb9/rIEnwhjZxWxeKtU8GmXrk5erWorgEHLG0pi2uUmdPGJOdDkedMsHedM/m +tlr0ymvA8BPCqOzxHF50VrKMnozVskmvjMDH0ck8Pyikzh9kZivpyUP30rVndmJS8dZ UD7no2hUs04JSFpbaRDrAC0b2AsL1/4+/PEkPnfmHwxHl+MYla9eKLAWdZXuT2yvOdJC iIGg== 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=w/ZY9LTiyXKRM2OFIeRR1GiI8yAd/kYfgFgfki8il0s=; b=eHEGryIlSmJLFkqFymTC6el72eSaMLVRvEVh1Dr43myXz2olpTV9376uVeg8mLGbfZ PMW1spzzfuiHYKobmX7q1CNc6T5i/1ar4ShayunpdTSNzB5lBWBCvKPcggzaigVyd1oI DtgioXnmIZ9T1vuibIugu9y/vuumsMvrZrgzJKp0pNnCUcsVc05LMy/rjX4bR8QEFroM GEbAhE9IsXSvhWy87Mwz9n1NHmAH+cOJI6cYqKGDHjN7HYHStM0QxFC5l/LG6t2oWaNc XUtsLSJljR42tg5mHDqD+b1TIVIFk2D/eB5zZeI6I2SRx5EtTBQBBwV60a1d5vVhKd13 G/XA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=YtJt6pfF; 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 a36si37505126pgb.165.2019.04.30.13.59.31; Tue, 30 Apr 2019 13:59:47 -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=YtJt6pfF; 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 S1727508AbfD3U5B (ORCPT + 99 others); Tue, 30 Apr 2019 16:57:01 -0400 Received: from mail-io1-f66.google.com ([209.85.166.66]:41311 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727245AbfD3U4Z (ORCPT ); Tue, 30 Apr 2019 16:56:25 -0400 Received: by mail-io1-f66.google.com with SMTP id r10so13452415ioc.8; Tue, 30 Apr 2019 13:56:25 -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=w/ZY9LTiyXKRM2OFIeRR1GiI8yAd/kYfgFgfki8il0s=; b=YtJt6pfFzExu2nn2LD/pkgzdudwBDuE9TUPd9cJOxZbchHajih+IO9O2DlwWaCge8C vrkIQHu3PXCNJroWsn2EKTyqnZs1lZt9GDmUMILlmp7LelLOpoWJyhV8dcE9vlizJ19N woTX8yMwAUWG5+cublTU0hJeSToDwqWSQTZSFHfuE5EdS+BDRIsIsTksACKYCP94PFQt +EK8VSoBqV19fmYDF42i7XdigDYg5k0rEG1FkkuEc/VhcUFzaqMEwqbJESKImL/zEI0l qT8MQiXa6+aQXeytm0s5b8vjtCu7GYrJbv7CcjaF9jclweaI+PpBUnF3iZHEGBsLSJ0a ljCw== 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=w/ZY9LTiyXKRM2OFIeRR1GiI8yAd/kYfgFgfki8il0s=; b=FdAshPbIlgkXeCD7mpRQP+Qf4mJVELFw3h2qIIXgyFtnJ+69/h/Y1wSBgO6O/bWts2 i/YjUpgJIAar3Bm8JfPG+9BGo3IcWZZsEVBLmhf1MhfXRlvHTtomSRGJ6HZethwey6OF xAHnGqXg6Ez7Ut+E6U/vSM0UjpqLHSNzbHOUqkgmr4NJf7NSeEY43jybDTa9/zfebezH JRXYlwDqWE6IiYsol0XE82wfzs2CkgJo79K4cna/ZdT+/j+/cKBosi1X+sP64v93oPjR iu+oOgIqTwQJZodngnlFJd+Ps5xJiUL3vf+UwkjM4jmnJ9kriNf0E3uADN2PzMYgHjDK wdCA== X-Gm-Message-State: APjAAAVsDBb9h4r+9uEvVythR4YB1ttZbxJ/Fbsf4HsUNbKQ0R/EUSD7 SjCkBI8KEMDV9d57VfhCj1A= X-Received: by 2002:a6b:ee13:: with SMTP id i19mr6970437ioh.113.1556657784833; Tue, 30 Apr 2019 13:56:24 -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 s7sm9799349ioo.17.2019.04.30.13.56.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Apr 2019 13:56:24 -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 08/14] powercap/intel_rapl: Simplify rapl_find_package() Date: Tue, 30 Apr 2019 16:55:53 -0400 Message-Id: X-Mailer: git-send-email 2.18.0-rc0 In-Reply-To: <75386dff62ee869eb7357dff1e60dfd9b3e68023.1553624867.git.len.brown@intel.com> References: <75386dff62ee869eb7357dff1e60dfd9b3e68023.1553624867.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 6cdb2c14eee4..8b2f3631aba6 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) { @@ -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_domain(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_domain(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_domain(cpu); if (!rp) return 0; -- 2.18.0-rc0