lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y5Bm6+ZKMaWCPDxi@sol>
Date:   Wed, 7 Dec 2022 18:11:55 +0800
From:   Kent Gibson <warthog618@...il.com>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc:     Linus Walleij <linus.walleij@...aro.org>,
        Marc Zyngier <maz@...nel.org>, linux-gpio@...r.kernel.org,
        linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
        Bartosz Golaszewski <brgl@...ev.pl>,
        Jonathan Corbet <corbet@....net>,
        Hans de Goede <hdegoede@...hat.com>
Subject: Re: [PATCH v1 2/3] Documentation: gpio: Add a section on what to
 return in ->get() callback

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@...il.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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ