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: <20250607181530.33d4972b@jic23-huawei>
Date: Sat, 7 Jun 2025 18:15:30 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Marcelo Schmitt <marcelo.schmitt@...log.com>
Cc: <linux-iio@...r.kernel.org>, <devicetree@...r.kernel.org>,
 <linux-gpio@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
 <lars@...afoo.de>, <Michael.Hennerich@...log.com>, <dlechner@...libre.com>,
 <nuno.sa@...log.com>, <andy@...nel.org>, <robh@...nel.org>,
 <krzk+dt@...nel.org>, <conor+dt@...nel.org>, <linus.walleij@...aro.org>,
 <brgl@...ev.pl>, <marcelo.schmitt1@...il.com>
Subject: Re: [PATCH v4 10/11] iio: adc: ad4170: Add support for weigh scale
 and RTD sensors

On Mon, 2 Jun 2025 08:40:01 -0300
Marcelo Schmitt <marcelo.schmitt@...log.com> wrote:

> The AD4170 design has features to aid interfacing with weigh scale and RTD
> sensors that are expected to be setup with external circuitry for proper
> sensor operation. A key characteristic of those sensors is that the circuit
> they are in must be excited with a pair of signals. The external circuit
> can be excited either by voltage supply or by AD4170 excitation signals.
> The sensor can then be read through a different pair of lines that are
> connected to AD4170 ADC.
> 
> Configure AD4170 to handle external circuit sensors.
> 
> Signed-off-by: Marcelo Schmitt <marcelo.schmitt@...log.com>
Trivial comments inline.


> +static int ad4170_validate_excitation_pins(struct ad4170_state *st,
> +					   u32 *exc_pins, int num_exc_pins)
> +{
> +	unsigned int i;
> +	int ret;
> +
> +	for (i = 0; i < num_exc_pins; i++) {
> +		unsigned int pin = exc_pins[i];
Is the local variable useful?  
		ret = ad4170_validate_excitation_pin(st, exc_pins[i]);
seems equally readable.

> +
> +		ret = ad4170_validate_excitation_pin(st, pin);
> +		if (ret)
> +			return ret;
> +	}
> +	return 0;
> +}
>


>  static int ad4170_parse_reference(struct ad4170_state *st,
>  				  struct fwnode_handle *child,
>  				  struct ad4170_setup *setup)
> @@ -1803,8 +2268,9 @@ static int ad4170_parse_channel_node(struct iio_dev *indio_dev,
>  	struct ad4170_chan_info *chan_info;
>  	struct ad4170_setup *setup;
>  	struct iio_chan_spec *chan;
> +	unsigned int ref_select;
> +	unsigned int s_type;
>  	unsigned int ch_reg;
> -	u8 ref_select;
Why the change of type?


>  	bipolar = fwnode_property_read_bool(child, "bipolar");
>  	setup->afe |= FIELD_PREP(AD4170_AFE_BIPOLAR_MSK, bipolar);
>  	if (bipolar)
> @@ -1843,11 +2327,11 @@ static int ad4170_parse_channel_node(struct iio_dev *indio_dev,
>  	else
>  		chan->scan_type.sign = 'u';
>  
> -	ref_select = FIELD_GET(AD4170_AFE_REF_SELECT_MSK, setup->afe);
>  	ret = ad4170_validate_channel(st, chan);
>  	if (ret < 0)
>  		return ret;
>  
> +	ref_select = FIELD_GET(AD4170_AFE_REF_SELECT_MSK, setup->afe);

Can we do it in the patch that introduced the code rather than moving it here?

>  	ret = ad4170_get_input_range(st, chan, ch_reg, ref_select);
>  	if (ret < 0)
>  		return dev_err_probe(dev, ret, "Invalid input config\n");

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ