* [PATCH] iio: mxs-lradc: Remove useless check in read_raw
@ 2013-07-02 0:08 Marek Vasut
2013-07-02 3:38 ` Otavio Salvador
` (2 more replies)
0 siblings, 3 replies; 18+ messages in thread
From: Marek Vasut @ 2013-07-02 0:08 UTC (permalink / raw)
To: linux-iio; +Cc: otavio, Marek Vasut, Jonathan Cameron, Fabio Estevam
The removed check in the read_raw implementation was always true,
therefore remove it.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
---
drivers/staging/iio/adc/mxs-lradc.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
index d92c97a..c318eb6 100644
--- a/drivers/staging/iio/adc/mxs-lradc.c
+++ b/drivers/staging/iio/adc/mxs-lradc.c
@@ -234,7 +234,6 @@ static int mxs_lradc_read_raw(struct iio_dev *iio_dev,
{
struct mxs_lradc *lradc = iio_priv(iio_dev);
int ret;
- unsigned long mask;
if (m != IIO_CHAN_INFO_RAW)
return -EINVAL;
@@ -243,12 +242,6 @@ static int mxs_lradc_read_raw(struct iio_dev *iio_dev,
if (chan->channel > LRADC_MAX_TOTAL_CHANS)
return -EINVAL;
- /* Validate the channel if it doesn't intersect with reserved chans. */
- bitmap_set(&mask, chan->channel, 1);
- ret = iio_validate_scan_mask_onehot(iio_dev, &mask);
- if (ret)
- return -EINVAL;
-
/*
* See if there is no buffered operation in progess. If there is, simply
* bail out. This can be improved to support both buffered and raw IO at
--
1.7.10.4
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH] iio: mxs-lradc: Remove useless check in read_raw 2013-07-02 0:08 [PATCH] iio: mxs-lradc: Remove useless check in read_raw Marek Vasut @ 2013-07-02 3:38 ` Otavio Salvador 2013-07-02 17:58 ` Marek Vasut 2013-07-02 9:19 ` Hector Palacios 2013-07-02 11:43 ` Alexandre Belloni 2 siblings, 1 reply; 18+ messages in thread From: Otavio Salvador @ 2013-07-02 3:38 UTC (permalink / raw) To: Marek Vasut; +Cc: linux-iio, Jonathan Cameron, Fabio Estevam On Mon, Jul 1, 2013 at 9:08 PM, Marek Vasut <marex@denx.de> wrote: > The removed check in the read_raw implementation was always true, > therefore remove it. > > Signed-off-by: Marek Vasut <marex@denx.de> > Cc: Jonathan Cameron <jic23@kernel.org> > Cc: Fabio Estevam <fabio.estevam@freescale.com> This fixes the driver for MX23 but why this code were add at first? -- Otavio Salvador O.S. Systems http://www.ossystems.com.br http://projetos.ossystems.com.br Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750 ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] iio: mxs-lradc: Remove useless check in read_raw 2013-07-02 3:38 ` Otavio Salvador @ 2013-07-02 17:58 ` Marek Vasut 0 siblings, 0 replies; 18+ messages in thread From: Marek Vasut @ 2013-07-02 17:58 UTC (permalink / raw) To: Otavio Salvador; +Cc: linux-iio, Jonathan Cameron, Fabio Estevam Dear Otavio Salvador, > On Mon, Jul 1, 2013 at 9:08 PM, Marek Vasut <marex@denx.de> wrote: > > The removed check in the read_raw implementation was always true, > > therefore remove it. > > > > Signed-off-by: Marek Vasut <marex@denx.de> > > Cc: Jonathan Cameron <jic23@kernel.org> > > Cc: Fabio Estevam <fabio.estevam@freescale.com> > > This fixes the driver for MX23 but why this code were add at first? Obviously because I wrote the code incorrectly. I appologize for the trouble. Jonathan, can we get this one into 3.10.1 maybe ? Best regards, Marek Vasut ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] iio: mxs-lradc: Remove useless check in read_raw 2013-07-02 0:08 [PATCH] iio: mxs-lradc: Remove useless check in read_raw Marek Vasut 2013-07-02 3:38 ` Otavio Salvador @ 2013-07-02 9:19 ` Hector Palacios 2013-07-02 11:43 ` Alexandre Belloni 2 siblings, 0 replies; 18+ messages in thread From: Hector Palacios @ 2013-07-02 9:19 UTC (permalink / raw) To: linux-iio Cc: public-linux-iio-u79uwXL29TY76Z2rM5mHXA, public-otavio-fKevB0iiKLMBZ+LybsDmbA, Jonathan Cameron, Fabio Estevam Dear Marek, On 07/02/2013 02:08 AM, Marek Vasut wrote: > The removed check in the read_raw implementation was always true, > therefore remove it. > > Signed-off-by: Marek Vasut <marex@denx.de> > Cc: Jonathan Cameron <jic23@kernel.org> > Cc: Fabio Estevam <fabio.estevam@freescale.com> > --- > drivers/staging/iio/adc/mxs-lradc.c | 7 ------- > 1 file changed, 7 deletions(-) > > diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c > index d92c97a..c318eb6 100644 > --- a/drivers/staging/iio/adc/mxs-lradc.c > +++ b/drivers/staging/iio/adc/mxs-lradc.c > @@ -234,7 +234,6 @@ static int mxs_lradc_read_raw(struct iio_dev *iio_dev, > { > struct mxs_lradc *lradc = iio_priv(iio_dev); > int ret; > - unsigned long mask; > > if (m != IIO_CHAN_INFO_RAW) > return -EINVAL; > @@ -243,12 +242,6 @@ static int mxs_lradc_read_raw(struct iio_dev *iio_dev, > if (chan->channel > LRADC_MAX_TOTAL_CHANS) > return -EINVAL; > > - /* Validate the channel if it doesn't intersect with reserved chans. */ > - bitmap_set(&mask, chan->channel, 1); > - ret = iio_validate_scan_mask_onehot(iio_dev, &mask); > - if (ret) > - return -EINVAL; > - > /* > * See if there is no buffered operation in progess. If there is, simply > * bail out. This can be improved to support both buffered and raw IO at > By "always true" you mean that it always entered the if and exited with -EINVAL, right? I just started to look at this driver on my MX28 platform and this check was always returning -EINVAL. With this patch I can now read the channels. Was this what was happening to you as well? Thank you, -- Héctor Palacios ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] iio: mxs-lradc: Remove useless check in read_raw 2013-07-02 0:08 [PATCH] iio: mxs-lradc: Remove useless check in read_raw Marek Vasut 2013-07-02 3:38 ` Otavio Salvador 2013-07-02 9:19 ` Hector Palacios @ 2013-07-02 11:43 ` Alexandre Belloni 2013-07-02 11:53 ` Otavio Salvador 2013-07-02 12:03 ` Marek Vasut 2 siblings, 2 replies; 18+ messages in thread From: Alexandre Belloni @ 2013-07-02 11:43 UTC (permalink / raw) To: Marek Vasut; +Cc: linux-iio, otavio, Jonathan Cameron, Fabio Estevam Dear Marek, I don't seem to be hitting that issue. I'm using 3.10rc7. Do you know how to reproduce it ? Regards, On 02/07/2013 02:08, Marek Vasut wrote: > The removed check in the read_raw implementation was always true, > therefore remove it. > > Signed-off-by: Marek Vasut <marex@denx.de> > Cc: Jonathan Cameron <jic23@kernel.org> > Cc: Fabio Estevam <fabio.estevam@freescale.com> > --- > drivers/staging/iio/adc/mxs-lradc.c | 7 ------- > 1 file changed, 7 deletions(-) > > diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c > index d92c97a..c318eb6 100644 > --- a/drivers/staging/iio/adc/mxs-lradc.c > +++ b/drivers/staging/iio/adc/mxs-lradc.c > @@ -234,7 +234,6 @@ static int mxs_lradc_read_raw(struct iio_dev *iio_dev, > { > struct mxs_lradc *lradc = iio_priv(iio_dev); > int ret; > - unsigned long mask; > > if (m != IIO_CHAN_INFO_RAW) > return -EINVAL; > @@ -243,12 +242,6 @@ static int mxs_lradc_read_raw(struct iio_dev *iio_dev, > if (chan->channel > LRADC_MAX_TOTAL_CHANS) > return -EINVAL; > > - /* Validate the channel if it doesn't intersect with reserved chans. */ > - bitmap_set(&mask, chan->channel, 1); > - ret = iio_validate_scan_mask_onehot(iio_dev, &mask); > - if (ret) > - return -EINVAL; > - > /* > * See if there is no buffered operation in progess. If there is, simply > * bail out. This can be improved to support both buffered and raw IO at > -- Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] iio: mxs-lradc: Remove useless check in read_raw 2013-07-02 11:43 ` Alexandre Belloni @ 2013-07-02 11:53 ` Otavio Salvador 2013-07-02 12:03 ` Marek Vasut 1 sibling, 0 replies; 18+ messages in thread From: Otavio Salvador @ 2013-07-02 11:53 UTC (permalink / raw) To: Alexandre Belloni; +Cc: Marek Vasut, linux-iio, Jonathan Cameron, Fabio Estevam On Tue, Jul 2, 2013 at 8:43 AM, Alexandre Belloni <alexandre.belloni@free-electrons.com> wrote: > I don't seem to be hitting that issue. I'm using 3.10rc7. Do you know > how to reproduce it ? I had this, but in MX23. It seems like a race as if I put some prints in this code area it works sometimes. -- Otavio Salvador O.S. Systems http://www.ossystems.com.br http://projetos.ossystems.com.br Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750 ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] iio: mxs-lradc: Remove useless check in read_raw 2013-07-02 11:43 ` Alexandre Belloni 2013-07-02 11:53 ` Otavio Salvador @ 2013-07-02 12:03 ` Marek Vasut 2013-07-02 12:49 ` Alexandre Belloni 1 sibling, 1 reply; 18+ messages in thread From: Marek Vasut @ 2013-07-02 12:03 UTC (permalink / raw) To: Alexandre Belloni; +Cc: linux-iio, otavio, Jonathan Cameron, Fabio Estevam Dear Alexandre Belloni, > Dear Marek, > > I don't seem to be hitting that issue. I'm using 3.10rc7. Do you know > how to reproduce it ? The check is just redundant, it's not a bug. > Regards, > > On 02/07/2013 02:08, Marek Vasut wrote: > > The removed check in the read_raw implementation was always true, > > therefore remove it. > > > > Signed-off-by: Marek Vasut <marex@denx.de> > > Cc: Jonathan Cameron <jic23@kernel.org> > > Cc: Fabio Estevam <fabio.estevam@freescale.com> > > --- > > > > drivers/staging/iio/adc/mxs-lradc.c | 7 ------- > > 1 file changed, 7 deletions(-) > > > > diff --git a/drivers/staging/iio/adc/mxs-lradc.c > > b/drivers/staging/iio/adc/mxs-lradc.c index d92c97a..c318eb6 100644 > > --- a/drivers/staging/iio/adc/mxs-lradc.c > > +++ b/drivers/staging/iio/adc/mxs-lradc.c > > @@ -234,7 +234,6 @@ static int mxs_lradc_read_raw(struct iio_dev > > *iio_dev, > > > > { > > > > struct mxs_lradc *lradc = iio_priv(iio_dev); > > int ret; > > > > - unsigned long mask; > > > > if (m != IIO_CHAN_INFO_RAW) > > > > return -EINVAL; > > > > @@ -243,12 +242,6 @@ static int mxs_lradc_read_raw(struct iio_dev > > *iio_dev, > > > > if (chan->channel > LRADC_MAX_TOTAL_CHANS) > > > > return -EINVAL; > > > > - /* Validate the channel if it doesn't intersect with reserved chans. */ > > - bitmap_set(&mask, chan->channel, 1); > > - ret = iio_validate_scan_mask_onehot(iio_dev, &mask); > > - if (ret) > > - return -EINVAL; > > - > > > > /* > > > > * See if there is no buffered operation in progess. If there is, > > simply * bail out. This can be improved to support both buffered and > > raw IO at Best regards, Marek Vasut ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] iio: mxs-lradc: Remove useless check in read_raw 2013-07-02 12:03 ` Marek Vasut @ 2013-07-02 12:49 ` Alexandre Belloni 2013-07-02 16:13 ` Marek Vasut 0 siblings, 1 reply; 18+ messages in thread From: Alexandre Belloni @ 2013-07-02 12:49 UTC (permalink / raw) To: Marek Vasut; +Cc: linux-iio, otavio, Jonathan Cameron, Fabio Estevam On 02/07/2013 14:03, Marek Vasut wrote: > Dear Alexandre Belloni, > >> Dear Marek, >> >> I don't seem to be hitting that issue. I'm using 3.10rc7. Do you know >> how to reproduce it ? > > The check is just redundant, it's not a bug. > Ok, that's what I understood first but then got confused by reports of it solving a bug. Thanks ! -- Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] iio: mxs-lradc: Remove useless check in read_raw 2013-07-02 12:49 ` Alexandre Belloni @ 2013-07-02 16:13 ` Marek Vasut 2013-07-02 16:37 ` Otavio Salvador 2013-07-02 17:19 ` Alexandre Belloni 0 siblings, 2 replies; 18+ messages in thread From: Marek Vasut @ 2013-07-02 16:13 UTC (permalink / raw) To: Alexandre Belloni; +Cc: linux-iio, otavio, Jonathan Cameron, Fabio Estevam Dear Alexandre Belloni, > On 02/07/2013 14:03, Marek Vasut wrote: > > Dear Alexandre Belloni, > > > >> Dear Marek, > >> > >> I don't seem to be hitting that issue. I'm using 3.10rc7. Do you know > >> how to reproduce it ? > > > > The check is just redundant, it's not a bug. > > Ok, that's what I understood first but then got confused by reports of > it solving a bug. It cannot solve a thing. If it does, then we have a problem. What kind of bug do you see ? How can I replicate it ? Can you send me a testcase? Best regards, Marek Vasut ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] iio: mxs-lradc: Remove useless check in read_raw 2013-07-02 16:13 ` Marek Vasut @ 2013-07-02 16:37 ` Otavio Salvador 2013-07-02 17:36 ` Marek Vasut 2013-07-02 17:19 ` Alexandre Belloni 1 sibling, 1 reply; 18+ messages in thread From: Otavio Salvador @ 2013-07-02 16:37 UTC (permalink / raw) To: Marek Vasut; +Cc: Alexandre Belloni, linux-iio, Jonathan Cameron, Fabio Estevam On Tue, Jul 2, 2013 at 1:13 PM, Marek Vasut <marex@denx.de> wrote: > Dear Alexandre Belloni, > >> On 02/07/2013 14:03, Marek Vasut wrote: >> > Dear Alexandre Belloni, >> > >> >> Dear Marek, >> >> >> >> I don't seem to be hitting that issue. I'm using 3.10rc7. Do you know >> >> how to reproduce it ? >> > >> > The check is just redundant, it's not a bug. >> >> Ok, that's what I understood first but then got confused by reports of >> it solving a bug. > > It cannot solve a thing. If it does, then we have a problem. > > What kind of bug do you see ? How can I replicate it ? Can you send me a > testcase? As I said this code sometimes work. If you put a printf before this call it sometimes work. So I think we have a race somewhere. When I were debugging this I found that when it works we have 10 active channels, it seems. -- Otavio Salvador O.S. Systems http://www.ossystems.com.br http://projetos.ossystems.com.br Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750 ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] iio: mxs-lradc: Remove useless check in read_raw 2013-07-02 16:37 ` Otavio Salvador @ 2013-07-02 17:36 ` Marek Vasut 2013-07-02 17:42 ` Otavio Salvador 0 siblings, 1 reply; 18+ messages in thread From: Marek Vasut @ 2013-07-02 17:36 UTC (permalink / raw) To: Otavio Salvador Cc: Alexandre Belloni, linux-iio, Jonathan Cameron, Fabio Estevam Dear Otavio Salvador, > On Tue, Jul 2, 2013 at 1:13 PM, Marek Vasut <marex@denx.de> wrote: > > Dear Alexandre Belloni, > > > >> On 02/07/2013 14:03, Marek Vasut wrote: > >> > Dear Alexandre Belloni, > >> > > >> >> Dear Marek, > >> >> > >> >> I don't seem to be hitting that issue. I'm using 3.10rc7. Do you know > >> >> how to reproduce it ? > >> > > >> > The check is just redundant, it's not a bug. > >> > >> Ok, that's what I understood first but then got confused by reports of > >> it solving a bug. > > > > It cannot solve a thing. If it does, then we have a problem. > > > > What kind of bug do you see ? How can I replicate it ? Can you send me a > > testcase? > > As I said this code sometimes work. If you put a printf before this > call it sometimes work. So I think we have a race somewhere. > > When I were debugging this I found that when it works we have 10 > active channels, it seems. Uh, the read_raw() should exit with -EBUSY, since the mutex_tryload() will fail iff buffered operation is in progress. Or what do you mean by having "10 active channels"? Best regards, Marek Vasut ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] iio: mxs-lradc: Remove useless check in read_raw 2013-07-02 17:36 ` Marek Vasut @ 2013-07-02 17:42 ` Otavio Salvador 2013-07-02 17:55 ` Marek Vasut 0 siblings, 1 reply; 18+ messages in thread From: Otavio Salvador @ 2013-07-02 17:42 UTC (permalink / raw) To: Marek Vasut; +Cc: Alexandre Belloni, linux-iio, Jonathan Cameron, Fabio Estevam On Tue, Jul 2, 2013 at 2:36 PM, Marek Vasut <marex@denx.de> wrote: > Dear Otavio Salvador, > >> On Tue, Jul 2, 2013 at 1:13 PM, Marek Vasut <marex@denx.de> wrote: >> > Dear Alexandre Belloni, >> > >> >> On 02/07/2013 14:03, Marek Vasut wrote: >> >> > Dear Alexandre Belloni, >> >> > >> >> >> Dear Marek, >> >> >> >> >> >> I don't seem to be hitting that issue. I'm using 3.10rc7. Do you know >> >> >> how to reproduce it ? >> >> > >> >> > The check is just redundant, it's not a bug. >> >> >> >> Ok, that's what I understood first but then got confused by reports of >> >> it solving a bug. >> > >> > It cannot solve a thing. If it does, then we have a problem. >> > >> > What kind of bug do you see ? How can I replicate it ? Can you send me a >> > testcase? >> >> As I said this code sometimes work. If you put a printf before this >> call it sometimes work. So I think we have a race somewhere. >> >> When I were debugging this I found that when it works we have 10 >> active channels, it seems. > > Uh, the read_raw() should exit with -EBUSY, since the mutex_tryload() will fail > iff buffered operation is in progress. Or what do you mean by having "10 active > channels"? The read_raw returned invalid. The onehot always returns false and I have 10 as mask comparing return. -- Otavio Salvador O.S. Systems http://www.ossystems.com.br http://projetos.ossystems.com.br Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750 ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] iio: mxs-lradc: Remove useless check in read_raw 2013-07-02 17:42 ` Otavio Salvador @ 2013-07-02 17:55 ` Marek Vasut 2013-07-03 9:25 ` Hector Palacios 0 siblings, 1 reply; 18+ messages in thread From: Marek Vasut @ 2013-07-02 17:55 UTC (permalink / raw) To: Otavio Salvador Cc: Alexandre Belloni, linux-iio, Jonathan Cameron, Fabio Estevam Dear Otavio Salvador, > On Tue, Jul 2, 2013 at 2:36 PM, Marek Vasut <marex@denx.de> wrote: > > Dear Otavio Salvador, > > > >> On Tue, Jul 2, 2013 at 1:13 PM, Marek Vasut <marex@denx.de> wrote: > >> > Dear Alexandre Belloni, > >> > > >> >> On 02/07/2013 14:03, Marek Vasut wrote: > >> >> > Dear Alexandre Belloni, > >> >> > > >> >> >> Dear Marek, > >> >> >> > >> >> >> I don't seem to be hitting that issue. I'm using 3.10rc7. Do you > >> >> >> know how to reproduce it ? > >> >> > > >> >> > The check is just redundant, it's not a bug. > >> >> > >> >> Ok, that's what I understood first but then got confused by reports > >> >> of it solving a bug. > >> > > >> > It cannot solve a thing. If it does, then we have a problem. > >> > > >> > What kind of bug do you see ? How can I replicate it ? Can you send me > >> > a testcase? > >> > >> As I said this code sometimes work. If you put a printf before this > >> call it sometimes work. So I think we have a race somewhere. > >> > >> When I were debugging this I found that when it works we have 10 > >> active channels, it seems. > > > > Uh, the read_raw() should exit with -EBUSY, since the mutex_tryload() > > will fail iff buffered operation is in progress. Or what do you mean by > > having "10 active channels"? > > The read_raw returned invalid. The onehot always returns false and I > have 10 as mask comparing return. Looking at the code. the bitmap_set() will set (1 << chan->channel) into "mask" var. The iio_validate_scan_mask_onehot is implemented like this: 688 bool iio_validate_scan_mask_onehot(struct iio_dev *indio_dev, 689 const unsigned long *mask) 690 { 691 return bitmap_weight(mask, indio_dev->masklength) == 1; 692 } So if mask _always_ has exactly one bit set, the iio_validate_scan_mask_onehot will always return 1. Aaaand ... now I see why it fixes a bug for you. if (ret) return -EINVAL; This stuff above will always be if (1) so will always return -EINVAL. Dang! Best regards, Marek Vasut ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] iio: mxs-lradc: Remove useless check in read_raw 2013-07-02 17:55 ` Marek Vasut @ 2013-07-03 9:25 ` Hector Palacios 2013-07-03 11:38 ` Marek Vasut 0 siblings, 1 reply; 18+ messages in thread From: Hector Palacios @ 2013-07-03 9:25 UTC (permalink / raw) To: Marek Vasut, Alexandre Belloni, linux-iio@vger.kernel.org, fabio.estevam@freescale.com, jic23 Dear Marek, On 07/02/2013 07:55 PM, Marek Vasut wrote: > Dear Otavio Salvador, > >> On Tue, Jul 2, 2013 at 2:36 PM, Marek Vasut <marex-ynQEQJNshbs@public.gmane.org> wrote: >>> Dear Otavio Salvador, >>> >>>> On Tue, Jul 2, 2013 at 1:13 PM, Marek Vasut <marex-ynQEQJNshbs@public.gmane.org> wrote: >>>>> Dear Alexandre Belloni, >>>>> >>>>>> On 02/07/2013 14:03, Marek Vasut wrote: >>>>>>> Dear Alexandre Belloni, >>>>>>> >>>>>>>> Dear Marek, >>>>>>>> >>>>>>>> I don't seem to be hitting that issue. I'm using 3.10rc7. Do you >>>>>>>> know how to reproduce it ? >>>>>>> >>>>>>> The check is just redundant, it's not a bug. >>>>>> >>>>>> Ok, that's what I understood first but then got confused by reports >>>>>> of it solving a bug. >>>>> >>>>> It cannot solve a thing. If it does, then we have a problem. >>>>> >>>>> What kind of bug do you see ? How can I replicate it ? Can you send me >>>>> a testcase? >>>> >>>> As I said this code sometimes work. If you put a printf before this >>>> call it sometimes work. So I think we have a race somewhere. >>>> >>>> When I were debugging this I found that when it works we have 10 >>>> active channels, it seems. >>> >>> Uh, the read_raw() should exit with -EBUSY, since the mutex_tryload() >>> will fail iff buffered operation is in progress. Or what do you mean by >>> having "10 active channels"? >> >> The read_raw returned invalid. The onehot always returns false and I >> have 10 as mask comparing return. > > Looking at the code. > > the bitmap_set() will set (1 << chan->channel) into "mask" var. > > The iio_validate_scan_mask_onehot is implemented like this: > > 688 bool iio_validate_scan_mask_onehot(struct iio_dev *indio_dev, > 689 const unsigned long *mask) > 690 { > 691 return bitmap_weight(mask, indio_dev->masklength) == 1; > 692 } > > So if mask _always_ has exactly one bit set, the iio_validate_scan_mask_onehot > will always return 1. Aaaand ... now I see why it fixes a bug for you. > > if (ret) > return -EINVAL; > > This stuff above will always be if (1) so will always return -EINVAL. Dang! Yes, this was exactly what was happening on my MX28 when trying to read one channel. Now, after the different comments I'm confused, was this a bug that your patch solved or was I doing something wrong? Best regards, -- Hector Palacios ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] iio: mxs-lradc: Remove useless check in read_raw 2013-07-03 9:25 ` Hector Palacios @ 2013-07-03 11:38 ` Marek Vasut 2013-07-03 13:58 ` Hector Palacios 0 siblings, 1 reply; 18+ messages in thread From: Marek Vasut @ 2013-07-03 11:38 UTC (permalink / raw) To: Hector Palacios Cc: Alexandre Belloni, linux-iio@vger.kernel.org, fabio.estevam@freescale.com, jic23 Dear Hector Palacios, > Dear Marek, > > On 07/02/2013 07:55 PM, Marek Vasut wrote: > > Dear Otavio Salvador, > > > >> On Tue, Jul 2, 2013 at 2:36 PM, Marek Vasut <marex- ynQEQJNshbs@public.gmane.org> wrote: > >>> Dear Otavio Salvador, > >>> > >>>> On Tue, Jul 2, 2013 at 1:13 PM, Marek Vasut <marex- ynQEQJNshbs@public.gmane.org> wrote: > >>>>> Dear Alexandre Belloni, > >>>>> > >>>>>> On 02/07/2013 14:03, Marek Vasut wrote: > >>>>>>> Dear Alexandre Belloni, > >>>>>>> > >>>>>>>> Dear Marek, > >>>>>>>> > >>>>>>>> I don't seem to be hitting that issue. I'm using 3.10rc7. Do you > >>>>>>>> know how to reproduce it ? > >>>>>>> > >>>>>>> The check is just redundant, it's not a bug. > >>>>>> > >>>>>> Ok, that's what I understood first but then got confused by reports > >>>>>> of it solving a bug. > >>>>> > >>>>> It cannot solve a thing. If it does, then we have a problem. > >>>>> > >>>>> What kind of bug do you see ? How can I replicate it ? Can you send > >>>>> me a testcase? > >>>> > >>>> As I said this code sometimes work. If you put a printf before this > >>>> call it sometimes work. So I think we have a race somewhere. > >>>> > >>>> When I were debugging this I found that when it works we have 10 > >>>> active channels, it seems. > >>> > >>> Uh, the read_raw() should exit with -EBUSY, since the mutex_tryload() > >>> will fail iff buffered operation is in progress. Or what do you mean by > >>> having "10 active channels"? > >> > >> The read_raw returned invalid. The onehot always returns false and I > >> have 10 as mask comparing return. > > > > Looking at the code. > > > > the bitmap_set() will set (1 << chan->channel) into "mask" var. > > > > The iio_validate_scan_mask_onehot is implemented like this: > > > > 688 bool iio_validate_scan_mask_onehot(struct iio_dev *indio_dev, > > 689 const unsigned long *mask) > > 690 { > > 691 return bitmap_weight(mask, indio_dev->masklength) == 1; > > 692 } > > > > So if mask _always_ has exactly one bit set, the > > iio_validate_scan_mask_onehot will always return 1. Aaaand ... now I see > > why it fixes a bug for you. > > > > if (ret) > > > > return -EINVAL; > > > > This stuff above will always be if (1) so will always return -EINVAL. > > Dang! > > Yes, this was exactly what was happening on my MX28 when trying to read one > channel. Now, after the different comments I'm confused, was this a bug > that your patch solved or was I doing something wrong? This patch accidentally (in completely unintended way) solved a bug, yes. But the main idea was to just remove redundant code. Best regards, Marek Vasut ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] iio: mxs-lradc: Remove useless check in read_raw 2013-07-03 11:38 ` Marek Vasut @ 2013-07-03 13:58 ` Hector Palacios 2013-07-03 19:26 ` Jonathan Cameron 0 siblings, 1 reply; 18+ messages in thread From: Hector Palacios @ 2013-07-03 13:58 UTC (permalink / raw) To: Marek Vasut Cc: Alexandre Belloni, linux-iio@vger.kernel.org, fabio.estevam@freescale.com, jic23@kernel.org Dear Marek, On 07/03/2013 01:38 PM, Marek Vasut wrote: > Dear Hector Palacios, > >> Dear Marek, >> >> On 07/02/2013 07:55 PM, Marek Vasut wrote: >>> Dear Otavio Salvador, >>> >>>> On Tue, Jul 2, 2013 at 2:36 PM, Marek Vasut <marex- > ynQEQJNshbs@public.gmane.org> wrote: >>>>> Dear Otavio Salvador, >>>>> >>>>>> On Tue, Jul 2, 2013 at 1:13 PM, Marek Vasut <marex- > ynQEQJNshbs@public.gmane.org> wrote: >>>>>>> Dear Alexandre Belloni, >>>>>>> >>>>>>>> On 02/07/2013 14:03, Marek Vasut wrote: >>>>>>>>> Dear Alexandre Belloni, >>>>>>>>> >>>>>>>>>> Dear Marek, >>>>>>>>>> >>>>>>>>>> I don't seem to be hitting that issue. I'm using 3.10rc7. Do you >>>>>>>>>> know how to reproduce it ? >>>>>>>>> >>>>>>>>> The check is just redundant, it's not a bug. >>>>>>>> >>>>>>>> Ok, that's what I understood first but then got confused by reports >>>>>>>> of it solving a bug. >>>>>>> >>>>>>> It cannot solve a thing. If it does, then we have a problem. >>>>>>> >>>>>>> What kind of bug do you see ? How can I replicate it ? Can you send >>>>>>> me a testcase? >>>>>> >>>>>> As I said this code sometimes work. If you put a printf before this >>>>>> call it sometimes work. So I think we have a race somewhere. >>>>>> >>>>>> When I were debugging this I found that when it works we have 10 >>>>>> active channels, it seems. >>>>> >>>>> Uh, the read_raw() should exit with -EBUSY, since the mutex_tryload() >>>>> will fail iff buffered operation is in progress. Or what do you mean by >>>>> having "10 active channels"? >>>> >>>> The read_raw returned invalid. The onehot always returns false and I >>>> have 10 as mask comparing return. >>> >>> Looking at the code. >>> >>> the bitmap_set() will set (1 << chan->channel) into "mask" var. >>> >>> The iio_validate_scan_mask_onehot is implemented like this: >>> >>> 688 bool iio_validate_scan_mask_onehot(struct iio_dev *indio_dev, >>> 689 const unsigned long *mask) >>> 690 { >>> 691 return bitmap_weight(mask, indio_dev->masklength) == 1; >>> 692 } >>> >>> So if mask _always_ has exactly one bit set, the >>> iio_validate_scan_mask_onehot will always return 1. Aaaand ... now I see >>> why it fixes a bug for you. >>> >>> if (ret) >>> >>> return -EINVAL; >>> >>> This stuff above will always be if (1) so will always return -EINVAL. >>> Dang! >> >> Yes, this was exactly what was happening on my MX28 when trying to read one >> channel. Now, after the different comments I'm confused, was this a bug >> that your patch solved or was I doing something wrong? > > This patch accidentally (in completely unintended way) solved a bug, yes. But > the main idea was to just remove redundant code. Maybe you should then amend the commit message to make clear that it solves a bug. Best regards, -- Hector Palacios ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] iio: mxs-lradc: Remove useless check in read_raw 2013-07-03 13:58 ` Hector Palacios @ 2013-07-03 19:26 ` Jonathan Cameron 0 siblings, 0 replies; 18+ messages in thread From: Jonathan Cameron @ 2013-07-03 19:26 UTC (permalink / raw) To: Hector Palacios Cc: Marek Vasut, Alexandre Belloni, linux-iio@vger.kernel.org, fabio.estevam@freescale.com On 07/03/2013 02:58 PM, Hector Palacios wrote: > Dear Marek, > > On 07/03/2013 01:38 PM, Marek Vasut wrote: >> Dear Hector Palacios, >> >>> Dear Marek, >>> >>> On 07/02/2013 07:55 PM, Marek Vasut wrote: >>>> Dear Otavio Salvador, >>>> >>>>> On Tue, Jul 2, 2013 at 2:36 PM, Marek Vasut <marex- >> ynQEQJNshbs@public.gmane.org> wrote: >>>>>> Dear Otavio Salvador, >>>>>> >>>>>>> On Tue, Jul 2, 2013 at 1:13 PM, Marek Vasut <marex- >> ynQEQJNshbs@public.gmane.org> wrote: >>>>>>>> Dear Alexandre Belloni, >>>>>>>> >>>>>>>>> On 02/07/2013 14:03, Marek Vasut wrote: >>>>>>>>>> Dear Alexandre Belloni, >>>>>>>>>> >>>>>>>>>>> Dear Marek, >>>>>>>>>>> >>>>>>>>>>> I don't seem to be hitting that issue. I'm using 3.10rc7. Do you >>>>>>>>>>> know how to reproduce it ? >>>>>>>>>> >>>>>>>>>> The check is just redundant, it's not a bug. >>>>>>>>> >>>>>>>>> Ok, that's what I understood first but then got confused by reports >>>>>>>>> of it solving a bug. >>>>>>>> >>>>>>>> It cannot solve a thing. If it does, then we have a problem. >>>>>>>> >>>>>>>> What kind of bug do you see ? How can I replicate it ? Can you send >>>>>>>> me a testcase? >>>>>>> >>>>>>> As I said this code sometimes work. If you put a printf before this >>>>>>> call it sometimes work. So I think we have a race somewhere. >>>>>>> >>>>>>> When I were debugging this I found that when it works we have 10 >>>>>>> active channels, it seems. >>>>>> >>>>>> Uh, the read_raw() should exit with -EBUSY, since the mutex_tryload() >>>>>> will fail iff buffered operation is in progress. Or what do you mean by >>>>>> having "10 active channels"? >>>>> >>>>> The read_raw returned invalid. The onehot always returns false and I >>>>> have 10 as mask comparing return. >>>> >>>> Looking at the code. >>>> >>>> the bitmap_set() will set (1 << chan->channel) into "mask" var. >>>> >>>> The iio_validate_scan_mask_onehot is implemented like this: >>>> >>>> 688 bool iio_validate_scan_mask_onehot(struct iio_dev *indio_dev, >>>> 689 const unsigned long *mask) >>>> 690 { >>>> 691 return bitmap_weight(mask, indio_dev->masklength) == 1; >>>> 692 } >>>> >>>> So if mask _always_ has exactly one bit set, the >>>> iio_validate_scan_mask_onehot will always return 1. Aaaand ... now I see >>>> why it fixes a bug for you. >>>> >>>> if (ret) >>>> >>>> return -EINVAL; >>>> >>>> This stuff above will always be if (1) so will always return -EINVAL. >>>> Dang! >>> >>> Yes, this was exactly what was happening on my MX28 when trying to read one >>> channel. Now, after the different comments I'm confused, was this a bug >>> that your patch solved or was I doing something wrong? >> >> This patch accidentally (in completely unintended way) solved a bug, yes. But >> the main idea was to just remove redundant code. > > Maybe you should then amend the commit message to make clear that it solves a bug. Definitely. I'll apply a version that mentions the bug in the commit comment to a branch that will hopefully be applied just after rc1 then can be picked up by stable as appropriate. Jonathan > > Best regards, > -- > Hector Palacios > -- > To unsubscribe from this list: send the line "unsubscribe linux-iio" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] iio: mxs-lradc: Remove useless check in read_raw 2013-07-02 16:13 ` Marek Vasut 2013-07-02 16:37 ` Otavio Salvador @ 2013-07-02 17:19 ` Alexandre Belloni 1 sibling, 0 replies; 18+ messages in thread From: Alexandre Belloni @ 2013-07-02 17:19 UTC (permalink / raw) To: Marek Vasut; +Cc: linux-iio, otavio, Jonathan Cameron, Fabio Estevam Hi, On 02/07/2013 18:13, Marek Vasut wrote: > Dear Alexandre Belloni, > >> On 02/07/2013 14:03, Marek Vasut wrote: >>> Dear Alexandre Belloni, >>> >>>> Dear Marek, >>>> >>>> I don't seem to be hitting that issue. I'm using 3.10rc7. Do you know >>>> how to reproduce it ? >>> >>> The check is just redundant, it's not a bug. >> >> Ok, that's what I understood first but then got confused by reports of >> it solving a bug. > > It cannot solve a thing. If it does, then we have a problem. > > What kind of bug do you see ? How can I replicate it ? Can you send me a > testcase? > It doesn't solve anything on my side, I never saw any issue with that code. I was surprised by those reports though: http://marc.info/?l=linux-iio&m=137275710622191&w=2 http://marc.info/?l=linux-iio&m=137273629716559&w=2 Hector and Otavio seem to be the ones with an issue ;) -- Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com ^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2013-07-03 19:26 UTC | newest] Thread overview: 18+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-07-02 0:08 [PATCH] iio: mxs-lradc: Remove useless check in read_raw Marek Vasut 2013-07-02 3:38 ` Otavio Salvador 2013-07-02 17:58 ` Marek Vasut 2013-07-02 9:19 ` Hector Palacios 2013-07-02 11:43 ` Alexandre Belloni 2013-07-02 11:53 ` Otavio Salvador 2013-07-02 12:03 ` Marek Vasut 2013-07-02 12:49 ` Alexandre Belloni 2013-07-02 16:13 ` Marek Vasut 2013-07-02 16:37 ` Otavio Salvador 2013-07-02 17:36 ` Marek Vasut 2013-07-02 17:42 ` Otavio Salvador 2013-07-02 17:55 ` Marek Vasut 2013-07-03 9:25 ` Hector Palacios 2013-07-03 11:38 ` Marek Vasut 2013-07-03 13:58 ` Hector Palacios 2013-07-03 19:26 ` Jonathan Cameron 2013-07-02 17:19 ` Alexandre Belloni
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.