[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130816211312.GB2528@gmail.com>
Date: Fri, 16 Aug 2013 22:13:29 +0100
From: "Zubair Lutfullah :" <zubair.lutfullah@...il.com>
To: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc: Zubair Lutfullah <zubair.lutfullah@...il.com>, jic23@....ac.uk,
dmitry.torokhov@...il.com, linux-iio@...r.kernel.org,
linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
gregkh@...uxfoundation.org, Russ.Dill@...com
Subject: Re: [PATCH 4/4] iio: ti_am335x_adc: Add continuous sampling and
trigger support
On Fri, Aug 16, 2013 at 03:25:49PM +0200, Sebastian Andrzej Siewior wrote:
> * Zubair Lutfullah | 2013-08-13 21:05:03 [+0100]:
>
> >diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
> >index 3ceac3e..0d7e313 100644
> >--- a/drivers/iio/adc/ti_am335x_adc.c
> >+++ b/drivers/iio/adc/ti_am335x_adc.c
> >@@ -141,58 +350,51 @@ static int tiadc_read_raw(struct iio_dev *indio_dev,
> > {
> …
> >+ if (iio_buffer_enabled(indio_dev))
> >+ return -EBUSY;
> >+ else {
>
> You can drop else so you lose one ident level.
>
Noted.
> >+ unsigned long timeout = jiffies + usecs_to_jiffies
> >+ (IDLE_TIMEOUT * adc_dev->channels);
>
> What computing this once? ->channels is assigned at probe time.
>
The timeout depends on number of SW enabled channels.
Hence the calculation. In this read_raw, one channel is to be
read.
However, all channels are sampled. And the one that the
userspace requires is pushed to user.
> >+ /* Wait for ADC sequencer to complete sampling */
> >+ while (tiadc_readl(adc_dev, REG_ADCFSM) & SEQ_STATUS) {
> >+ if (time_after(jiffies, timeout))
> >+ return -EAGAIN;
>
> You should check the condition after the timeout occured once again. It
> is possible that the task performing the read has been pushed away by a
> higher prio task (or preempted incase this sounds like a bully) and
> after it got back on the cpu the timeout occured but the condition is
> valid and no reason for -EAGAIN.
>
> Sebastian
Interesting catch. I'll look into it.
Thanks for pointing it out.
Zubair
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists