lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c3be75de-c399-473e-a4ff-725159392f4f@roeck-us.net>
Date: Mon, 6 Jan 2025 11:02:08 -0800
From: Guenter Roeck <linux@...ck-us.net>
To: Adrian DC <radian.dc@...il.com>, Jean Delvare <jdelvare@...e.com>,
 linux-hwmon@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] hwmon/adt7470: allow 'fan*_{min,max}' to be reset to
 '0'

On 1/5/25 11:55, Adrian DC wrote:
> Tested with the following script and values

The patch description is supposed to explain the reason for the changes,
not test results. Test results are useful, but only appropriate after "---".

Guenter

> ---
> 
> {
>    # Access hwmon
>    cd /sys/class/hwmon/hwmon1/
> 
>    # Set to 1 => 82
>    echo -n ' [TEST] Set to 1 : '
>    echo '1' >./fan1_max
>    cat ./fan1_max
> 
>    # Set to 1234 => 1234
>    echo -n ' [TEST] Set to 1234 : '
>    echo '1234' >./fan1_max
>    cat ./fan1_max
> 
>    # Reset to 0 => 0
>    echo -n ' [TEST] Set to 0 : '
>    echo '0' >./fan1_max
>    cat ./fan1_max
> }
> ---
> 
> Signed-off-by: Adrian DC <radian.dc@...il.com>
> ---
>   drivers/hwmon/adt7470.c | 10 +++++++---
>   1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c
> index dbee6926fa05..712bc41b4a0d 100644
> --- a/drivers/hwmon/adt7470.c
> +++ b/drivers/hwmon/adt7470.c
> @@ -662,11 +662,15 @@ static int adt7470_fan_write(struct device *dev, u32 attr, int channel, long val
>   	struct adt7470_data *data = dev_get_drvdata(dev);
>   	int err;
>   
> -	if (val <= 0)
> +	if (val < 0)
>   		return -EINVAL;
>   
> -	val = FAN_RPM_TO_PERIOD(val);
> -	val = clamp_val(val, 1, 65534);
> +	if (val) {
> +		val = FAN_RPM_TO_PERIOD(val);
> +		val = clamp_val(val, 1, 65534);
> +	} else {
> +		val = FAN_PERIOD_INVALID;
> +	}
>   
>   	switch (attr) {
>   	case hwmon_fan_min:


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ