Linux-FPGA Archive mirror
 help / color / mirror / Atom feed
From: Xu Yilun <yilun.xu@intel.com>
To: Peter Colberg <peter.colberg@intel.com>
Cc: Wu Hao <hao.wu@intel.com>, Tom Rix <trix@redhat.com>,
	Moritz Fischer <mdf@kernel.org>,
	linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	tianfei.zhang@intel.com, russell.h.weight@intel.com,
	matthew.gerlach@linux.intel.com, marpagan@redhat.com,
	lgoncalv@redhat.com
Subject: Re: [PATCH] fpga: dfl: fme: use SI unit prefix macros
Date: Mon, 10 Jul 2023 14:40:43 +0800	[thread overview]
Message-ID: <ZKun6/YT4qGQ26Y1@yilunxu-OptiPlex-7050> (raw)
In-Reply-To: <20230705033548.10737-1-peter.colberg@intel.com>

On 2023-07-04 at 23:35:48 -0400, Peter Colberg wrote:
> 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 <andriy.shevchenko@linux.intel.com>
> Signed-off-by: Peter Colberg <peter.colberg@intel.com>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Acked-by: Xu Yilun <yilun.xu@intel.com>

Applied.

> ---
>  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 <linux/kernel.h>
>  #include <linux/module.h>
>  #include <linux/uaccess.h>
> +#include <linux/units.h>
>  #include <linux/fpga-dfl.h>
>  
>  #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);
>  
> -- 
> 2.28.0
> 

      reply	other threads:[~2023-07-10  6:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-05  3:35 [PATCH] fpga: dfl: fme: use SI unit prefix macros Peter Colberg
2023-07-10  6:40 ` Xu Yilun [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZKun6/YT4qGQ26Y1@yilunxu-OptiPlex-7050 \
    --to=yilun.xu@intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=hao.wu@intel.com \
    --cc=lgoncalv@redhat.com \
    --cc=linux-fpga@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marpagan@redhat.com \
    --cc=matthew.gerlach@linux.intel.com \
    --cc=mdf@kernel.org \
    --cc=peter.colberg@intel.com \
    --cc=russell.h.weight@intel.com \
    --cc=tianfei.zhang@intel.com \
    --cc=trix@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).