From patchwork Fri Jul 28 12:12:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 13331788 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66F1EC001E0 for ; Fri, 28 Jul 2023 12:13:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234882AbjG1MND (ORCPT ); Fri, 28 Jul 2023 08:13:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234849AbjG1MMv (ORCPT ); Fri, 28 Jul 2023 08:12:51 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CFD526BC; Fri, 28 Jul 2023 05:12:50 -0700 (PDT) Message-ID: <20230728120929.944578301@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1690546369; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=W37gGs0lCrcES4uNg1Zl0+g2c0hE6iWg5mZxC7Tosgc=; b=LOYZuo50rp6pzKVY1Fnas4hlljh8Dcx+O7JxDpCZVwY11odiab00Z6zUTMe+C4rORSDShX Av7wImZZKDcpWsxz3EkDneqXmmnUZ9Iejm33NVM0rAFEtQyelifeUwUha2v7ye+T4FRXfs LfsXr5/faRsUZXuIId3JcEZtF4HkhhQQBnomZe4DKT/Lab0wyfg90a+uu2pJxO7/lp8tL1 dkSoME+zzHBeiccBod+V90gGSV8C3Tp/3MIDMBFioEm9MkDrSvpqQm575nG+ajbIrf18TA EUnfcb1aaj4cWghdBfukHif7u9I4JsSNY8MP1z8ybxlEhaOp/FRIJCrdsMPNXQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1690546369; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=W37gGs0lCrcES4uNg1Zl0+g2c0hE6iWg5mZxC7Tosgc=; b=a6l8K8mqvplkdOJM9DVMpMo/hwRXJORjx2hRIi6zSgLhEApv/7A8+HtV7z6NdaPzjKqpot V/O2k2hBSmH97IDw== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Tom Lendacky , Andrew Cooper , Arjan van de Ven , Guenter Roeck , linux-hwmon@vger.kernel.org, Jean Delvare , Huang Rui , "James E.J. Bottomley" , Dick Kennedy , James Smart , "Martin K. Petersen" , linux-scsi@vger.kernel.org, Juergen Gross , Steve Wahl , Mike Travis , Dimitri Sivanich , Russ Anderson Subject: [patch v2 05/38] hwmon: (fam15h_power) Use topology_core_id() References: <20230728105650.565799744@linutronix.de> MIME-Version: 1.0 Date: Fri, 28 Jul 2023 14:12:48 +0200 (CEST) Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Use the provided topology helper function instead of fiddling in cpu_data. Signed-off-by: Thomas Gleixner Acked-by: Guenter Roeck Cc: linux-hwmon@vger.kernel.org Cc: Jean Delvare Cc: Huang Rui --- drivers/hwmon/fam15h_power.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) --- a/drivers/hwmon/fam15h_power.c +++ b/drivers/hwmon/fam15h_power.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -134,15 +135,13 @@ static DEVICE_ATTR_RO(power1_crit); static void do_read_registers_on_cu(void *_data) { struct fam15h_power_data *data = _data; - int cpu, cu; - - cpu = smp_processor_id(); + int cu; /* * With the new x86 topology modelling, cpu core id actually * is compute unit id. */ - cu = cpu_data(cpu).cpu_core_id; + cu = topology_core_id(smp_processor_id()); rdmsrl_safe(MSR_F15H_CU_PWR_ACCUMULATOR, &data->cu_acc_power[cu]); rdmsrl_safe(MSR_F15H_PTSC, &data->cpu_sw_pwr_ptsc[cu]);