Re: [PATCH] iio: amplifiers: ad8366: move channel init before iio_device_register()

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

 



On Mon, 21 May 2018 17:10:00 +0200
Lars-Peter Clausen <lars@xxxxxxxxxx> wrote:

> Patch looks good, but remember to put the maintainer and reviewers on the
> recipient list. Otherwise there is a risk that the patch gets lost.
> 
> On 05/21/2018 08:40 AM, Alexandru Ardelean wrote:
> > Otherwise a race condition can occur, where userspace can start operations
> > before the channels have been properly initialized.
> > 
> > Signed-off-by: Alexandru Ardelean <alexandru.ardelean@xxxxxxxxxx>
Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to play with it.

Thanks,

Jonathan

> > ---
> >  drivers/iio/amplifiers/ad8366.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/iio/amplifiers/ad8366.c b/drivers/iio/amplifiers/ad8366.c
> > index 43667866321e..0138337aedd1 100644
> > --- a/drivers/iio/amplifiers/ad8366.c
> > +++ b/drivers/iio/amplifiers/ad8366.c
> > @@ -161,12 +161,14 @@ static int ad8366_probe(struct spi_device *spi)
> >  	indio_dev->channels = ad8366_channels;
> >  	indio_dev->num_channels = ARRAY_SIZE(ad8366_channels);
> >  
> > +	ret = ad8366_write(indio_dev, 0 , 0);
> > +	if (ret < 0)
> > +		goto error_disable_reg;
> > +
> >  	ret = iio_device_register(indio_dev);
> >  	if (ret)
> >  		goto error_disable_reg;
> >  
> > -	ad8366_write(indio_dev, 0, 0);
> > -
> >  	return 0;
> >  
> >  error_disable_reg:
> >   
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux