Re: [PATCH v3 13/15] iio: adc: stm32-adc: convert to device properties

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 6 Aug 2022 19:15:38 +0100
Jonathan Cameron <jic23@xxxxxxxxxx> wrote:

> On Fri, 15 Jul 2022 14:29:01 +0200
> Nuno Sá <nuno.sa@xxxxxxxxxx> wrote:
> 
> > Make the conversion to firmware agnostic device properties. As part of
> > the conversion the IIO inkern interface 'of_xlate()' is also converted to
> > 'fwnode_xlate()'. The goal is to completely drop 'of_xlate' and hence OF
> > dependencies from IIO.
> > 
> > Signed-off-by: Nuno Sá <nuno.sa@xxxxxxxxxx>
> > Reviewed-by: Andy Shevchenko <andy.shevchenko@xxxxxxxxx>  
> One query below. Otherwise LGTM (not that's true of the other patches I haven't
> comment on at all)
> 
> > @@ -1885,8 +1887,12 @@ static int stm32_adc_get_legacy_chan_count(struct iio_dev *indio_dev, struct stm
> >  		num_channels += ret;
> >  	}
> >  
> > -	ret = of_property_count_elems_of_size(node, "st,adc-diff-channels",
> > -					      sizeof(struct stm32_adc_diff_channel));
> > +	/*
> > +	 * each st,adc-diff-channels is a group of 2 u32 so we divide @ret
> > +	 * to get the *real* number of channels.
> > +	 */
> > +	ret = device_property_count_u32(dev, "st,adc-diff-channels");  
> 
> I think this can return an error code which should probably be handled.
> More than possible that was true of original code though...
> 
> If it can't return an error for some reason I'm missing perhaps a
> comment to explain why.

Given this was only outstanding question I stuck a conservative

if (ret < 0)
	return ret;
here whilst applying.

> 
> > +	ret /= (int)(sizeof(struct stm32_adc_diff_channel) / sizeof(u32));
> >  	if (ret > adc_info->max_channels) {
> >  		dev_err(&indio_dev->dev, "Bad st,adc-diff-channels?\n");
> >  		return -EINVAL;  





[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux