From patchwork Mon Jul 24 17:43:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 13325156 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 A70D4C0015E for ; Mon, 24 Jul 2023 17:44:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231745AbjGXRoh (ORCPT ); Mon, 24 Jul 2023 13:44:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230287AbjGXRoD (ORCPT ); Mon, 24 Jul 2023 13:44:03 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C5FC199F; Mon, 24 Jul 2023 10:44:00 -0700 (PDT) Message-ID: <20230724172843.988600888@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1690220638; 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=CslJ+Xs2tAisZ7a4ZqDrI1gRhP1PqFVCqCsoM4wylLI=; b=R2wnfNQmqunLRY9XPRWZg+VJw3KkrEOy42EITG+7Nz9+T0sJ6IwMAswXMV+NJYWPf9MyMd QTE6xm1vDiMz7ZXLx7/ISd32xcTS3GKMjMp+MQqqJ3FSXOmRRtm8MaceBKqbPnQJQ4UAub RQX/v14hTjdZI4A41NwNuoClA0M4y9P0QLX8HsXM18Eg4KAviW2gmcZba34D7rvSe9C7nM iXobfegv5hhHmpGMdwtnm4ndfMNUdVMgGU9dXE81ogAm2vGQ12lQEA71H4PMGIJOF57LDX w6pT2xtPTP0WfAe9tSP9yV0y2BbQAGFT3CL2IedsbcUnIEFzOIvFZO/IrW9b3g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1690220638; 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=CslJ+Xs2tAisZ7a4ZqDrI1gRhP1PqFVCqCsoM4wylLI=; b=7QbHM3qHvKAKOdgO+brAqUON4uCmq5hCWTk4SrwJ50NA5zPUME/eAvnAQTCjC6+RhSXwFH m9OpPsbrFwyslvAQ== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Tom Lendacky , Andrew Cooper , Arjan van de Ven , linux-hwmon@vger.kernel.org, Jean Delvare , Huang Rui , Guenter Roeck , "James E.J. Bottomley" , Dick Kennedy , James Smart , "Martin K. Petersen" , linux-scsi@vger.kernel.org, Steve Wahl , Mike Travis , Dimitri Sivanich , Russ Anderson Subject: [patch 05/29] hwmon: (fam15h_power) Use topology_core_id() References: <20230724155329.474037902@linutronix.de> MIME-Version: 1.0 Date: Mon, 24 Jul 2023 19:43:58 +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 Cc: linux-hwmon@vger.kernel.org Cc: Jean Delvare Cc: Huang Rui Cc: Guenter Roeck Acked-by: Guenter Roeck --- 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]);