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: <aGHj6Ki7YjyIMh5X@dev-linux>
Date: Sun, 29 Jun 2025 18:10:00 -0700
From: Sukrut Bellary <sbellary@...libre.com>
To: Jonathan Cameron <jic23@...nel.org>
Cc: David Lechner <dlechner@...libre.com>, Rob Herring <robh@...nel.org>,
	Krzysztof Kozlowski <krzk+dt@...nel.org>,
	Conor Dooley <conor+dt@...nel.org>,
	Matti Vaittinen <mazziesaccount@...il.com>,
	Nuno Sá <nuno.sa@...log.com>,
	Andy Shevchenko <andy@...nel.org>,
	Angelo Compagnucci <angelo.compagnucci@...il.com>,
	Nishanth Menon <nm@...com>, linux-iio@...r.kernel.org,
	devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 2/5] iio: adc: ti-adc128s052: Use shift and realbits

On Sun, Jun 29, 2025 at 05:26:55PM +0100, Jonathan Cameron wrote:
> On Sat, 28 Jun 2025 13:01:53 -0700
> 
> > > > +		.type = IIO_VOLTAGE,					\
> > > > +		.indexed = 1,						\
> > > > +		.channel = (num),					\
> > > > +		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),		\
> > > > +		.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),	\
> > > > +		.scan_index = (num),					\
> > > > +		.scan_type = {						\
> > > > +			.sign = 'u',					\
> > > > +			.realbits = (real_bits),			\
> > > > +			.storagebits = 16,				\
> > > > +			.shift = (12 - real_bits),			\
> > > > +		},							\
> > > >  	}
> > > >  
> > > > +#define ADC128_VOLTAGE_CHANNEL(num) _ADC128_VOLTAGE_CHANNEL(num, 12)  
> > > 
> > > I wonder if it would be clearer to just have the 12 explicit in each entry
> > > and skip this two levels of macro thing?
> > >  
> > Do you mean to pass realbits to
> > ADC128_VOLTAGE_CHANNEL/_ADC128_VOLTAGE_CHANNEL as e.g.,
> > 
> > static const struct iio_chan_spec adc122s021_channels[] = {
> >         ADC128_VOLTAGE_CHANNEL(0, 12),
> >         ADC128_VOLTAGE_CHANNEL(1, 12),
> > };
> > 
> > I think we added 2nd level macros as ADC082_VOLTAGE_CHANNEL,
> > ADC102_VOLTAGE_CHANNEL, etc., to have a visual distinction for a different
> > part nos.
> 
> I think as we can have lots of parts with each resolution that will
> end up confusing.
> 
> > But I am ok if you prefer ADC128_VOLTAGE_CHANNEL with a second parameter
> > as real_bits.
> 
> I think that's going to be easier to follow.
>
Ok, I will change it in v5.

> Jonathan
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ