Re: [PATCH v3 2/9] iio: adc: add the ti-ads1262 driver

Jonathan Cameron <[email protected]>
Newsgroups org.kernel.vger.linux-iio,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-gpio,org.kernel.vger.linux-kernel
Message-ID <20260817212557.2d90d8f7@jic23-huawei>
On Mon, 17 Aug 2026 11:22:23 +0300
Andy Shevchenko <[email protected]> wrote:

> On Sun, Aug 16, 2026 at 10:30:29PM +0100, Jonathan Cameron wrote:
> > On Fri, 07 Aug 2026 22:58:24 -0500
> > Kurt Borja <[email protected]> wrote:  
> 
> ...
> 
> > > +static const struct reg_default ads1262_reg_defaults[] = {
> > > +	{ ADS1262_INTERFACE_REG,
> > > +	  FIELD_PREP_CONST(ADS1262_INTERFACE_STATUS_MASK, true) |
> > > +	  FIELD_PREP_CONST(ADS1262_INTERFACE_CRC_MASK, true) },
> > > +	{ ADS1262_MODE0_REG,		0x00 },
> > > +	{ ADS1262_MODE1_REG,
> > > +	  FIELD_PREP_CONST(ADS1262_MODE1_FILTER_MASK, ADS1262_FILTER_FIR) },
> > > +	{ ADS1262_MODE2_REG,
> > > +	  FIELD_PREP_CONST(ADS1262_MODE2_DR_MASK, ADS1262_DR_20_SPS) },
> > > +	{ ADS1262_INPMUX_REG,
> > > +	  FIELD_PREP_CONST(ADS1262_INPMUX_MUXN_MASK, ADS1262_INPMUX_AIN1) },
> > > +	{ ADS1262_IDACMUX_REG,
> > > +	  FIELD_PREP_CONST(ADS1262_IDACMUX_MUX2_MASK, ADS1262_IDACMUX_NO_CONN) |
> > > +	  FIELD_PREP_CONST(ADS1262_IDACMUX_MUX1_MASK, ADS1262_IDACMUX_NO_CONN) },
> > > +	{ ADS1262_IDACMAG_REG,		0x00 },
> > > +	{ ADS1262_REFMUX_REG,		0x00 },
> > > +	{ ADS1262_TDACP_REG,		0x00 },
> > > +	{ ADS1262_TDACN_REG,		0x00 },
> > > +	{ ADS1262_GPIOCON_REG,		0x00 },
> > > +	{ ADS1262_GPIODIR_REG,		0x00 },
> > > +	{ ADS1262_ADC2CFG_REG,		0x00 },
> > > +	{ ADS1262_ADC2MUX_REG,
> > > +	  FIELD_PREP_CONST(ADS1262_ADC2MUX_MUXN2_MASK, ADS1262_INPMUX_AIN1) },
> > > +};  
> > I'm not particularly keen on this formatting from a readability point of view.
> > Maybe using named intializers would help:
> > 
> > static const struct reg_default ads1262_reg_defaults[] = {
> > 	{ 
> > 		.reg = ADS1262_INTERFACE_REG,
> > 		.def = FIELD_PREP_CONST(ADS1262_INTERFACE_STATUS_MASK, true) |
> > 		       FIELD_PREP_CONST(ADS1262_INTERFACE_CRC_MASK, true),  
> 
> And looking at this, this has not to be booleans! Please, use proper integers
> instead (I think 1 is what you wanted).

Gah - I didn't noticed that at all!

Good spot.

> 
> > //extra indent fine here for readability reasons if we end up with some long lines
> > 	},
> > 	{ .reg = ADS1262_MODE0_REG, .def = 0x00 },
> > etc or just maybe use the more open form of the first element for all of them.
> > burns a bunch of lines, but is easy to read.   
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.