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: <1f75ef1e-6efa-4148-a387-c4b10783b477@roeck-us.net>
Date:   Sun, 12 Mar 2023 10:42:15 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     Leonard Anderweit <leonard.anderweit@...il.com>
Cc:     linux-hwmon@...r.kernel.org,
        Aleksa Savic <savicaleksa83@...il.com>,
        Jack Doan <me@...kdoan.com>, Jean Delvare <jdelvare@...e.com>,
        Jonathan Corbet <corbet@....net>, linux-doc@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/6] hwmon: (aquacomputer_d5next) Support writing
 multiple control values at once

On Tue, Feb 14, 2023 at 11:02:17PM +0100, Leonard Anderweit wrote:
> Add new function aqc_set_ctrl_vals() to support changing multiple control
> values at once while sending only one control report.
> 
> Signed-off-by: Leonard Anderweit <leonard.anderweit@...il.com>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/aquacomputer_d5next.c | 29 ++++++++++++++++++-----------
>  1 file changed, 18 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/hwmon/aquacomputer_d5next.c b/drivers/hwmon/aquacomputer_d5next.c
> index babfd998e70c..f0c036d38e91 100644
> --- a/drivers/hwmon/aquacomputer_d5next.c
> +++ b/drivers/hwmon/aquacomputer_d5next.c
> @@ -574,9 +574,9 @@ static int aqc_get_ctrl_val(struct aqc_data *priv, int offset, long *val, int ty
>  	return ret;
>  }
>  
> -static int aqc_set_ctrl_val(struct aqc_data *priv, int offset, long val, int type)
> +static int aqc_set_ctrl_vals(struct aqc_data *priv, int *offsets, long *vals, int *types, int len)
>  {
> -	int ret;
> +	int ret, i;
>  
>  	mutex_lock(&priv->mutex);
>  
> @@ -584,15 +584,17 @@ static int aqc_set_ctrl_val(struct aqc_data *priv, int offset, long val, int typ
>  	if (ret < 0)
>  		goto unlock_and_return;
>  
> -	switch (type) {
> -	case AQC_BE16:
> -		put_unaligned_be16((s16)val, priv->buffer + offset);
> -		break;
> -	case AQC_8:
> -		priv->buffer[offset] = (u8)val;
> -		break;
> -	default:
> -		ret = -EINVAL;
> +	for (i = 0; i < len; i++) {
> +		switch (types[i]) {
> +		case AQC_BE16:
> +			put_unaligned_be16((s16)vals[i], priv->buffer + offsets[i]);
> +			break;
> +		case AQC_8:
> +			priv->buffer[offsets[i]] = (u8)vals[i];
> +			break;
> +		default:
> +			ret = -EINVAL;
> +		}
>  	}
>  
>  	if (ret < 0)
> @@ -605,6 +607,11 @@ static int aqc_set_ctrl_val(struct aqc_data *priv, int offset, long val, int typ
>  	return ret;
>  }
>  
> +static int aqc_set_ctrl_val(struct aqc_data *priv, int offset, long val, int type)
> +{
> +	return aqc_set_ctrl_vals(priv, &offset, &val, &type, 1);
> +}
> +
>  static umode_t aqc_is_visible(const void *data, enum hwmon_sensor_types type, u32 attr, int channel)
>  {
>  	const struct aqc_data *priv = data;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ