All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Gabriele Mazzotta <gabriele.mzt@gmail.com>
Cc: knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net,
	marxin.liska@gmail.com, marex@denx.de, rui.zhang@intel.com,
	linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org
Subject: Re: [PATCH] iio: acpi: Add ACPI0008 Ambient Light Sensor
Date: Sat, 02 May 2015 12:22:00 +0100	[thread overview]
Message-ID: <5544B358.1060208@kernel.org> (raw)
In-Reply-To: <10033848.82LkUmdQLq@xps13>

On 01/05/15 17:12, Gabriele Mazzotta wrote:
> Hi,
> 
> probably this is not completely related to this driver, but I
> noticed something while testing it.
> 
> When I load acpi-als, /sys/bus/iio/devices/iio:device0/buffer/enable
> is 0. If I try to set it to 1, I get the following error:
> "Buffer not started: buffer parameter update failed (-22)"
> 
> After I got the error, I can successfully toggle "enable".
> 
> What I found is that the first time iio_request_update_kfifo() is
> called, __iio_allocate_kfifo() gets called. Since bytes_per_datum
> is 0 (as set iio_compute_scan_bytes()), it returns -EINVAL and so
> does iio_request_update_kfifo(), causing the error above.
> 
> Subsequent calls of iio_request_update_kfifo() will return 0 as
> update_needed is false, so "enable" can be toggled with no errors.
> 
> Isn't there something wrong here?
Definitely looks like it!

Thanks for pointing this out.  Anyhow, the issue is exactly what you've
identified; the line below the __iio_allocate_kfifo clears the
update needed whether or not it succeeded.  Clearly it should not
be doing that if a failure has occurred.

Would you mind submitting a fix patch for this?
Simply checking ret before setting updateneeded to false
should do the job.

Thanks,

Jonathan

 
> 
> Regards,
> Gabriele
> 


  reply	other threads:[~2015-05-02 11:22 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-29 11:27 [PATCH] iio: acpi: Add ACPI0008 Ambient Light Sensor Gabriele Mazzotta
2015-04-29 11:51 ` Gabriele Mazzotta
2015-04-29 14:33   ` Marek Vasut
2015-04-29 15:36     ` Gabriele Mazzotta
2015-04-30  9:44       ` Marek Vasut
2015-04-30 11:27         ` Gabriele Mazzotta
2015-04-30 11:30           ` Marek Vasut
2015-04-30 12:24 ` Daniel Baluta
2015-04-30 19:14   ` Gabriele Mazzotta
2015-04-30 20:33 ` Paul Bolle
2015-04-30 20:58   ` Marek Vasut
2015-05-01 16:12 ` Gabriele Mazzotta
2015-05-01 16:12   ` Gabriele Mazzotta
2015-05-02 11:22   ` Jonathan Cameron [this message]
2015-05-02 11:25 ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5544B358.1060208@kernel.org \
    --to=jic23@kernel.org \
    --cc=gabriele.mzt@gmail.com \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marex@denx.de \
    --cc=marxin.liska@gmail.com \
    --cc=pmeerw@pmeerw.net \
    --cc=rui.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.