From patchwork Wed Jul 5 03:35:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Colberg, Peter" X-Patchwork-Id: 115924 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp1608543vqx; Tue, 4 Jul 2023 20:54:42 -0700 (PDT) X-Google-Smtp-Source: APBJJlFv6kXBI062K4kRbEbo8itjAkm14wUIttwOtTr4BPRV0ZZ4WK/psGfXgFuKS7HvI58SWB1L X-Received: by 2002:a17:90a:ea81:b0:262:f99b:a530 with SMTP id h1-20020a17090aea8100b00262f99ba530mr15376376pjz.34.1688529282422; Tue, 04 Jul 2023 20:54:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688529282; cv=none; d=google.com; s=arc-20160816; b=o9L76oJj3V0MBr73IvuTOi87UcOCMHmcSPAVlfavqRsOb4BCoBlR1R/I1CXn9zZUk2 SUHJXVAyjmqq0qOJoF4c/wGQJFFekGsgauls+fSuofyD/5qxQSBujRr97rBY9Wo5UYSW LuBg4jSZubsgxLpFnxbL92Lfwt5HH5zeO63AsZ1Cg174PsalIZphPAnDUR2vytT7A3wL ymwakXWzGKLTCAFpmgK+Tw+b5GfRkE1iCDodcBx2gdf3MrOK5iAbyC32pfdUa7O+IjKz b7ASIwgC5p/oDCFcD9iDp1R7S36lrxvIC1o7D+6SZHcAaVYol5Yw0MFEndH4HSmXZKTM JTnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=SBo4J/tZu/d9R1u8bFQGCSshoiOXAjBiT8g6LP3LLUQ=; fh=EfGfCvONN/iD38dbDQNrJIeZsDkYD/SurJ3mZhpSxv8=; b=tbncEyQtWSN8K2pk7KBdr91HjV8dsJqMe9Z9/dkoYfyPRGChEbwYFjklc61jFP/zhG RsvRK6wSExNSY2h2UDRqM/azezycWe2dk4d4db1fUWheRWGaa1nuNjRFcIu52cHBuP8q 55cjaNjK8Vfh0omgb+CAJviwpv4OOjYIU5O5jEVBX+3jz0rh7aoK4hxztwEnWTcBOg7x zHXk9B3/xHLkSFR3Egx8iZzFh1MTnmRkK6CYdtHuRmoVP+7WsiW5s1lCgkEH7HMWgqlS U4AE/D+KFuol0t6JBJC/xHUWxxF/1+j+Mhinc5p41U/RDSlQEWQ7KWGvwyViwmIuEy1J 9a9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Zc5RwB/k"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gt7-20020a17090af2c700b00263cdc45e8bsi732460pjb.87.2023.07.04.20.54.26; Tue, 04 Jul 2023 20:54:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Zc5RwB/k"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230297AbjGEDgT (ORCPT + 99 others); Tue, 4 Jul 2023 23:36:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229449AbjGEDgR (ORCPT ); Tue, 4 Jul 2023 23:36:17 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE96310D5; Tue, 4 Jul 2023 20:36:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1688528176; x=1720064176; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=41pwSXKy2GbjS/fl5NCKHCzIRlKAfNX3B77kR9+h2ZM=; b=Zc5RwB/kIhmSuxU2Fq6c76IVajhHk0NXndBE5UJpA0uLrYChWsuBUyoj pUxAYNr/Iz+CuUtjbBgQWAtwXxoEn+x4RkXLL8JaTxgmugEWEvVdOUDAn dbztbZI88lArUgGXudrWkz/lmae1/DWVVR3OcKCoPxlLzsOtalHVdi0HO lSsKbRVyxCFPIn0CPfvGdGnZ8yGmxZoWWFMQGREwRMe+UnLQi4wh9Uv5+ +7+JaFDIP4ZnoMIrxoxvDRmBn6CRYC1pMXofwhklz5fWLoLDxQry/fxO+ GPUuoFava/oiO7254ruI/gH4sRjkw8KNtThsmdR0It9sfoR3GW/Mksmw2 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10761"; a="366723065" X-IronPort-AV: E=Sophos;i="6.01,181,1684825200"; d="scan'208";a="366723065" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jul 2023 20:36:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10761"; a="809098517" X-IronPort-AV: E=Sophos;i="6.01,181,1684825200"; d="scan'208";a="809098517" Received: from scc823097.zsc7.intel.com ([10.148.153.229]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jul 2023 20:36:15 -0700 From: Peter Colberg To: Wu Hao , Tom Rix , Moritz Fischer , Xu Yilun , linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andy Shevchenko , tianfei.zhang@intel.com, russell.h.weight@intel.com, matthew.gerlach@linux.intel.com, marpagan@redhat.com, lgoncalv@redhat.com, Peter Colberg Subject: [PATCH] fpga: dfl: fme: use SI unit prefix macros Date: Tue, 4 Jul 2023 23:35:48 -0400 Message-Id: <20230705033548.10737-1-peter.colberg@intel.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770551280808428318?= X-GMAIL-MSGID: =?utf-8?q?1770551280808428318?= Substitute SI prefixes MILLI for temperature and MICRO for power, which are exported via the hwmon sysfs interface in m°C and ųW, respectively. Suggested-by: Andy Shevchenko Signed-off-by: Peter Colberg Reviewed-by: Andy Shevchenko Acked-by: Xu Yilun --- drivers/fpga/dfl-fme-main.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/fpga/dfl-fme-main.c b/drivers/fpga/dfl-fme-main.c index bcb5d34b3b82..3dcf990bd261 100644 --- a/drivers/fpga/dfl-fme-main.c +++ b/drivers/fpga/dfl-fme-main.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include "dfl.h" @@ -231,19 +232,19 @@ static int thermal_hwmon_read(struct device *dev, enum hwmon_sensor_types type, switch (attr) { case hwmon_temp_input: v = readq(feature->ioaddr + FME_THERM_RDSENSOR_FMT1); - *val = (long)(FIELD_GET(FPGA_TEMPERATURE, v) * 1000); + *val = (long)(FIELD_GET(FPGA_TEMPERATURE, v) * MILLI); break; case hwmon_temp_max: v = readq(feature->ioaddr + FME_THERM_THRESHOLD); - *val = (long)(FIELD_GET(TEMP_THRESHOLD1, v) * 1000); + *val = (long)(FIELD_GET(TEMP_THRESHOLD1, v) * MILLI); break; case hwmon_temp_crit: v = readq(feature->ioaddr + FME_THERM_THRESHOLD); - *val = (long)(FIELD_GET(TEMP_THRESHOLD2, v) * 1000); + *val = (long)(FIELD_GET(TEMP_THRESHOLD2, v) * MILLI); break; case hwmon_temp_emergency: v = readq(feature->ioaddr + FME_THERM_THRESHOLD); - *val = (long)(FIELD_GET(TRIP_THRESHOLD, v) * 1000); + *val = (long)(FIELD_GET(TRIP_THRESHOLD, v) * MILLI); break; case hwmon_temp_max_alarm: v = readq(feature->ioaddr + FME_THERM_THRESHOLD); @@ -382,15 +383,15 @@ static int power_hwmon_read(struct device *dev, enum hwmon_sensor_types type, switch (attr) { case hwmon_power_input: v = readq(feature->ioaddr + FME_PWR_STATUS); - *val = (long)(FIELD_GET(PWR_CONSUMED, v) * 1000000); + *val = (long)(FIELD_GET(PWR_CONSUMED, v) * MICRO); break; case hwmon_power_max: v = readq(feature->ioaddr + FME_PWR_THRESHOLD); - *val = (long)(FIELD_GET(PWR_THRESHOLD1, v) * 1000000); + *val = (long)(FIELD_GET(PWR_THRESHOLD1, v) * MICRO); break; case hwmon_power_crit: v = readq(feature->ioaddr + FME_PWR_THRESHOLD); - *val = (long)(FIELD_GET(PWR_THRESHOLD2, v) * 1000000); + *val = (long)(FIELD_GET(PWR_THRESHOLD2, v) * MICRO); break; case hwmon_power_max_alarm: v = readq(feature->ioaddr + FME_PWR_THRESHOLD); @@ -415,7 +416,7 @@ static int power_hwmon_write(struct device *dev, enum hwmon_sensor_types type, int ret = 0; u64 v; - val = clamp_val(val / 1000000, 0, PWR_THRESHOLD_MAX); + val = clamp_val(val / MICRO, 0, PWR_THRESHOLD_MAX); mutex_lock(&pdata->lock);