Re: [PATCH 7/7] iio: adis_buffer: update device page after changing it

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

 



On Thu, Apr 15, 2021 at 10:58 AM Sa, Nuno <Nuno.Sa@xxxxxxxxxx> wrote:
>
>
>
> > -----Original Message-----
> > From: Alexandru Ardelean <ardeleanalex@xxxxxxxxx>
> > Sent: Wednesday, April 14, 2021 9:39 AM
> > To: Sa, Nuno <Nuno.Sa@xxxxxxxxxx>
> > Cc: linux-iio <linux-iio@xxxxxxxxxxxxxxx>; Jonathan Cameron
> > <jic23@xxxxxxxxxx>; Hennerich, Michael
> > <Michael.Hennerich@xxxxxxxxxx>; Lars-Peter Clausen
> > <lars@xxxxxxxxxx>
> > Subject: Re: [PATCH 7/7] iio: adis_buffer: update device page after
> > changing it
> >
> > [External]
> >
> > On Tue, Apr 13, 2021 at 5:45 PM Nuno Sa <nuno.sa@xxxxxxxxxx>
> > wrote:
> > >
> > > With commit 41f2770a07e0 ("iio: adis_buffer: don't push data to
> > buffers on
> > > failure"), we return if 'spi_sync()' fails which would leave
> > > 'adis->current_page' in an incoherent state. Hence, set this variable
> > > right after we change the device page.
> > >
> > > Signed-off-by: Nuno Sa <nuno.sa@xxxxxxxxxx>
> > > ---
> > >  drivers/iio/imu/adis_buffer.c | 6 +++---
> > >  1 file changed, 3 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/iio/imu/adis_buffer.c
> > b/drivers/iio/imu/adis_buffer.c
> > > index 73790b71102b..aa37981c28f1 100644
> > > --- a/drivers/iio/imu/adis_buffer.c
> > > +++ b/drivers/iio/imu/adis_buffer.c
> > > @@ -142,6 +142,8 @@ static irqreturn_t adis_trigger_handler(int irq,
> > void *p)
> > >                                 dev_err(&adis->spi->dev, "Failed to change device
> > page: %d\n", ret);
> > >                                 goto irq_done;
> > >                         }
> > > +
> > > +                       adis->current_page = 0;
> >
> > If the above spi_write() fails, this adis->current_page isn't reset.
> > Maybe reset this as the first thing in this if block?
> >
>
> If the 'spi_write()' fails it means that we could not change to page0,
> so we should not update the current_page...

ack



[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