From: Kent Gibson <warthog618@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
Marc Zyngier <maz@kernel.org>,
linux-gpio@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, Bartosz Golaszewski <brgl@bgdev.pl>,
Jonathan Corbet <corbet@lwn.net>,
Hans de Goede <hdegoede@redhat.com>
Subject: Re: [PATCH v1 2/3] Documentation: gpio: Add a section on what to return in ->get() callback
Date: Wed, 7 Dec 2022 18:11:55 +0800 [thread overview]
Message-ID: <Y5Bm6+ZKMaWCPDxi@sol> (raw)
In-Reply-To: <Y5BjJmz5Mvdr8cAR@smile.fi.intel.com>
On Wed, Dec 07, 2022 at 11:55:50AM +0200, Andy Shevchenko wrote:
> On Wed, Dec 07, 2022 at 01:06:46AM +0100, Linus Walleij wrote:
> > On Mon, Dec 5, 2022 at 2:43 AM Kent Gibson <warthog618@gmail.com> wrote:
> >
> > > My preference would be for the driver API to be extended with a new
> > > callback for the output buffer, say get_output(), and have the existing
> > > get() always return the input buffer.
> >
> > This has a certain elegance to it, as it cuts to the bone of the
> > problem and partition it in two halves, reflecting the two pieces
> > of hardware: input and output buffer. Also follows Rusty Russells
> > API hierarchy.
>
> The (one of) problem is that not all hardware may support input and output
> be enabled at the same time.
Exactly - and you want to hide that from the user.
> What would that new API return in that case
> and how it would be better with get() returning the value depending on
> direction?
>
It would return an error for whichever is not supported. So get()
returns an error when the input buffer is unavailable, and get_output()
returns an error when the output buffer is unavailable. And that is for
whatever reason, e.g. the selected mode or lacking hardware or driver
support.
It is better because the user is explicitly informed that the buffer
they are trying to read from is not supported by the current
configuration. And they get to choose which buffer they want to read
as they see fit - not have that selection made for them by magic.
Cheers,
Kent.
next prev parent reply other threads:[~2022-12-07 10:12 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-30 15:55 [PATCH v1 1/3] Documentation: gpio: Input mode is not true Hi-Z Andy Shevchenko
2022-11-30 15:55 ` [PATCH v1 2/3] Documentation: gpio: Add a section on what to return in ->get() callback Andy Shevchenko
2022-11-30 16:12 ` Hans de Goede
2022-11-30 16:14 ` Hans de Goede
2022-11-30 16:22 ` Andy Shevchenko
2022-11-30 16:20 ` Andy Shevchenko
2022-12-01 11:18 ` Hans de Goede
2022-12-03 9:38 ` Linus Walleij
2022-12-03 12:09 ` Hans de Goede
2022-12-05 1:43 ` Kent Gibson
2022-12-05 12:08 ` Andy Shevchenko
2022-12-05 15:35 ` Kent Gibson
2022-12-07 0:06 ` Linus Walleij
2022-12-07 9:55 ` Andy Shevchenko
2022-12-07 10:11 ` Kent Gibson [this message]
2022-12-07 13:49 ` Linus Walleij
2022-11-30 15:55 ` [PATCH v1 3/3] Documentation: gpio: Replace leading TABs by spaces in the code blocks Andy Shevchenko
2022-12-03 9:35 ` Linus Walleij
2022-12-03 9:33 ` [PATCH v1 1/3] Documentation: gpio: Input mode is not true Hi-Z Linus Walleij
2023-03-10 17:25 ` Andy Shevchenko
2023-03-15 10:07 ` Bartosz Golaszewski
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=Y5Bm6+ZKMaWCPDxi@sol \
--to=warthog618@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=brgl@bgdev.pl \
--cc=corbet@lwn.net \
--cc=hdegoede@redhat.com \
--cc=linus.walleij@linaro.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).