From: Lukas Wunner <lukas@wunner.de>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Mathias Duckeck <m.duckeck@kunbus.de>,
Phil Elwell <phil@raspberrypi.org>,
"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>
Subject: Re: [PATCH 2/4] gpio: Introduce ->get_multiple callback
Date: Sun, 27 Aug 2017 19:34:59 +0200 [thread overview]
Message-ID: <20170827173459.GB13399@wunner.de> (raw)
In-Reply-To: <CACRpkdYfHGHNGKKMs+Yqhfeyhs=L0G4K_6OYneDG1RkNpxLXkA@mail.gmail.com>
On Wed, Aug 23, 2017 at 09:38:21AM +0200, Linus Walleij wrote:
> On Mon, Aug 21, 2017 at 3:12 PM, Lukas Wunner <lukas@wunner.de> wrote:
> > SPI-attached GPIO controllers typically read out all inputs in one go.
> > If callers desire the values of multipe inputs, ideally a single readout
> > should take place to return the desired values. However the current
> > driver API only offers a ->get callback but no ->get_multiple (unlike
> > ->set_multiple, which is present). Thus, to read multiple inputs, a
> > full readout needs to be performed for every single value (barring
> > driver-internal caching), which is inefficient.
> >
> > In fact, the lack of a ->get_multiple callback has been bemoaned
> > repeatedly by the gpio subsystem maintainer:
> > http://www.spinics.net/lists/linux-gpio/msg10571.html
> > http://www.spinics.net/lists/devicetree/msg121734.html
> >
> > Introduce the missing callback. Add corresponding consumer functions
> > such as gpiod_get_array_value(). Amend linehandle_ioctl() to take
> > advantage of the newly added infrastructure.
>
> Could you please patch
> Documentation/gpio/consumer.txt
> to mention the new functions as well?
Missed that, will fix in v2. There is an oddity in that document
in that it claims gpiod_get_value() / gpiod_set_value() do not return
errors. The kerneldoc in gpiolib.c and driver.h says otherwise,
it allows the get functions to return a negative errno. Now what?
Here are the two occurrences of the false claim in consumer.txt:
It should be checked, since the get/set calls don't return errors
and since misconfiguration is possible.
The get/set calls do not return errors because "invalid GPIO"
should have been reported earlier from gpiod_direction_*().
At least with SPI-attached GPIO controllers, the transmission is never
guaranteed to succeed, so errors can occur both for input and output
GPIOs. The MAX3191x is input-only and does pass SPI errors back to
the caller. Output drivers such as gpio-74x164.c silently ignore
SPI errors, which is arguably a problem.
> Maybe we should have a section in Documentation/gpio/driver.txt,
> that doc is a bit incomplete right now.
First time I've seen that file. :-) I used the kerneldoc as guidance
when writing the gpio-max3191x.c driver and found it sufficient, so I'm
not sure how driver.txt could be expanded?
Thanks!
Lukas
next prev parent reply other threads:[~2017-08-27 17:34 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-21 13:12 [PATCH 0/4] GPIO driver for Maxim MAX3191x Lukas Wunner
2017-08-21 13:12 ` [PATCH 4/4] gpio: Add driver for Maxim MAX3191x industrial serializer Lukas Wunner
[not found] ` <df530ae703fcfdf52d27a1b6d19b6d1a4724b103.1503319573.git.lukas-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2017-08-23 8:09 ` Linus Walleij
2017-08-21 13:12 ` [PATCH 1/4] bitops: Introduce assign_bit() Lukas Wunner
2017-08-21 16:18 ` Bart Van Assche
2017-08-22 8:30 ` Lukas Wunner
2017-08-22 9:27 ` Peter Zijlstra
2017-08-22 10:04 ` Lukas Wunner
2017-08-23 7:32 ` Linus Walleij
2017-08-23 17:09 ` Bart Van Assche
2017-08-24 19:52 ` Linus Walleij
2017-08-21 13:12 ` [PATCH 2/4] gpio: Introduce ->get_multiple callback Lukas Wunner
2017-08-23 7:38 ` Linus Walleij
2017-08-27 17:34 ` Lukas Wunner [this message]
2017-08-31 13:48 ` Linus Walleij
2017-08-31 15:46 ` Lukas Wunner
2017-09-03 14:58 ` Linus Walleij
2017-10-04 20:32 ` Lukas Wunner
2017-10-07 11:23 ` Linus Walleij
2017-10-12 11:15 ` Lukas Wunner
2017-08-21 13:12 ` [PATCH 3/4] dt-bindings: gpio: max3191x: Document new driver Lukas Wunner
2017-08-23 0:48 ` Rob Herring
2017-08-23 9:44 ` Lukas Wunner
[not found] ` <20170823094438.GA12416-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2017-08-23 13:03 ` Rob Herring
2017-09-05 8:16 ` Lukas Wunner
2017-10-04 19:31 ` Lukas Wunner
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=20170827173459.GB13399@wunner.de \
--to=lukas@wunner.de \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=m.duckeck@kunbus.de \
--cc=phil@raspberrypi.org \
/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.