From patchwork Wed Aug 2 10:21:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 13338024 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 F238CC00528 for ; Wed, 2 Aug 2023 10:21:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233784AbjHBKVr (ORCPT ); Wed, 2 Aug 2023 06:21:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232728AbjHBKVR (ORCPT ); Wed, 2 Aug 2023 06:21:17 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33C8A2720; Wed, 2 Aug 2023 03:21:10 -0700 (PDT) Message-ID: <20230802101933.104722355@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1690971669; 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=F+C9H0DtgncTnkKKBoGxFVPsR6sHb0qwuu7W+vof+Q/fWU0keEEA+c/rOi4bZSuoDiaiXP oYt/1oPQsa8rXyPAUwBncl1m7T/6ut3RVLIuIxsC2nMsxHJdLdMpz9SCzWoBW9I4rJrjt2 BoBpbBoBA0LSCLnAY+5EX6gNiTiK62C7Drb7EQV+gqf+XYzYr73P6OD1OpTDAygwQBX4cd BFxZi2MYFacfwyZuB3UynU1qPO14p72U2rUpWDBwOL5advuWSVgXeIiBt79x23CEHVDjBD xdjcA6e7bNRdpjwDfHuSacW44OECgcf35t5mYoDfv1Coh3aMgGVSFKYVUm8rKg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1690971669; 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=aR/ClK7pK4d9Nw2NUuBu457SIW7LhYP+u61EVLZ0/hmwVXpsc9Nc7pYCjXgLciQPL8W47x UEnwG0GlNyzhmhBA== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Tom Lendacky , Andrew Cooper , Arjan van de Ven , Huang Rui , Juergen Gross , Dimitri Sivanich , Michael Kelley , Wei Liu , Guenter Roeck , linux-hwmon@vger.kernel.org, Jean Delvare Subject: [patch V3 07/40] hwmon: (fam15h_power) Use topology_core_id() References: <20230802101635.459108805@linutronix.de> MIME-Version: 1.0 Date: Wed, 2 Aug 2023 12:21:08 +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]);