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: <20241130191138.6305f23c@jic23-huawei>
Date: Sat, 30 Nov 2024 19:11:38 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: Guillaume Ranquet <granquet@...libre.com>
Cc: Lars-Peter Clausen <lars@...afoo.de>, Michael Hennerich
 <Michael.Hennerich@...log.com>, linux-iio@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/2] iio: adc: ad7173: add calibration support

On Wed, 27 Nov 2024 10:06:13 +0100
Guillaume Ranquet <granquet@...libre.com> wrote:

> The ad7173 family of chips has up to four calibration modes.
> 
> Internal zero scale: removes ADC core offset errors.
> Internal full scale: removes ADC core gain errors.
> System zero scale: reduces offset error to the order of channel noise.
> System full scale: reduces gain error to the order of channel noise.
> 
> All voltage channels will undergo an internal zero/full scale
> calibration at bootup.
> 
> System zero/full scale can be done after bootup using the newly created
> iio interface 'sys_calibration' and 'sys_calibration_mode'
> 
> Signed-off-by: Guillaume Ranquet <granquet@...libre.com>


>  static const struct iio_chan_spec ad7173_temp_iio_channel_template = {
> @@ -1213,6 +1329,7 @@ static int ad7173_fw_parse_channel_config(struct iio_dev *indio_dev)
>  	struct iio_chan_spec *chan_arr, *chan;
>  	unsigned int ain[AD7173_NO_AINS_PER_CHANNEL], chan_index = 0;
>  	int ref_sel, ret, num_channels;
> +	u8 *calib_mode;
>  
>  	num_channels = device_get_child_node_count(dev);
>  
> @@ -1240,8 +1357,14 @@ static int ad7173_fw_parse_channel_config(struct iio_dev *indio_dev)
>  	if (!chans_st_arr)
>  		return -ENOMEM;
>  
> +	calib_mode = devm_kcalloc(dev, st->num_channels, sizeof(*st->syscalib_mode),
> +				  GFP_KERNEL);
As it is per channel, can we put it in struct ad7173_channel?

This driver already has a lot of small allocations. Avoiding an extra one would nice!

> +	if (!calib_mode)
> +		return -ENOMEM;
> +
>  	indio_dev->channels = chan_arr;
>  	st->channels = chans_st_arr;
> +	st->syscalib_mode = calib_mode;
>  
>  	if (st->info->has_temp) {
>  		chan_arr[chan_index] = ad7173_temp_iio_channel_template;
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ