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] [day] [month] [year] [list]
Message-ID: <20200924144708.GA191738@roeck-us.net>
Date:   Thu, 24 Sep 2020 07:47:08 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     Chris Packham <chris.packham@...iedtelesis.co.nz>
Cc:     jdelvare@...e.com, linux-hwmon@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] hwmon: (adm9240) Use loops to avoid duplicated code

Hi Chris,

On Thu, Sep 24, 2020 at 08:51:00PM +1200, Chris Packham wrote:
> Use loops for reading temp_max and initialising FAN_MIN/TEMP_MAX rather
> than duplicating code.
> 
> Signed-off-by: Chris Packham <chris.packham@...iedtelesis.co.nz>

Series applied (and module tested).

Thanks a lot for the clean submission.

Guenter

> ---
>  drivers/hwmon/adm9240.c | 24 ++++++++++++------------
>  1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/hwmon/adm9240.c b/drivers/hwmon/adm9240.c
> index 496d47490e10..f95dde1b9c7f 100644
> --- a/drivers/hwmon/adm9240.c
> +++ b/drivers/hwmon/adm9240.c
> @@ -223,10 +223,10 @@ static struct adm9240_data *adm9240_update_device(struct device *dev)
>  			data->fan_min[i] = i2c_smbus_read_byte_data(client,
>  					ADM9240_REG_FAN_MIN(i));
>  		}
> -		data->temp_max[0] = i2c_smbus_read_byte_data(client,
> -				ADM9240_REG_TEMP_MAX(0));
> -		data->temp_max[1] = i2c_smbus_read_byte_data(client,
> -				ADM9240_REG_TEMP_MAX(1));
> +		for (i = 0; i < 2; i++) {
> +			data->temp_max[i] = i2c_smbus_read_byte_data(client,
> +					ADM9240_REG_TEMP_MAX(i));
> +		}
>  
>  		/* read fan divs and 5-bit VID */
>  		i = i2c_smbus_read_byte_data(client, ADM9240_REG_VID_FAN_DIV);
> @@ -687,14 +687,14 @@ static void adm9240_init_client(struct i2c_client *client)
>  			i2c_smbus_write_byte_data(client,
>  					ADM9240_REG_IN_MAX(i), 255);
>  		}
> -		i2c_smbus_write_byte_data(client,
> -				ADM9240_REG_FAN_MIN(0), 255);
> -		i2c_smbus_write_byte_data(client,
> -				ADM9240_REG_FAN_MIN(1), 255);
> -		i2c_smbus_write_byte_data(client,
> -				ADM9240_REG_TEMP_MAX(0), 127);
> -		i2c_smbus_write_byte_data(client,
> -				ADM9240_REG_TEMP_MAX(1), 127);
> +		for (i = 0; i < 2; i++) {
> +			i2c_smbus_write_byte_data(client,
> +					ADM9240_REG_FAN_MIN(i), 255);
> +		}
> +		for (i = 0; i < 2; i++) {
> +			i2c_smbus_write_byte_data(client,
> +					ADM9240_REG_TEMP_MAX(i), 127);
> +		}
>  
>  		/* start measurement cycle */
>  		i2c_smbus_write_byte_data(client, ADM9240_REG_CONFIG, 1);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ