Linux GPIO subsystem development
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Kent Gibson <warthog618@gmail.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	linux-gpio@vger.kernel.org
Subject: Re: [libgpiod v2][PATCH v2] treewide: rework line configuration
Date: Wed, 14 Sep 2022 13:13:21 +0300	[thread overview]
Message-ID: <YyGpQedIKMRg8IVA@smile.fi.intel.com> (raw)
In-Reply-To: <20220913161407.63472-1-brgl@bgdev.pl>

On Tue, Sep 13, 2022 at 06:14:07PM +0200, Bartosz Golaszewski wrote:
> This tries to get rid of the concept of defaults and overrides for line
> properties from the library (or rather hide them from the users). While
> this makes the C API a bit more complex, it allows for a more elegant
> high-level interface.
> 
> This patch is pretty big but I'll just give an overview here. I don't
> expect a detailed review of every line.
> 
> Low-level data structure model (as seen in the C API):
> 
> We're adding a new structure - line_settings. It's a basic data class
> that stores a set of line properties. The line_config object is simplified
> and becomes a storage for the mappings between offsets and line_settings.
> 
> We no longer require the user to store the offsets array in the
> request_config. The offsets to request are simply those for which the
> user explicitly added settings to the line_config. Subsequently, the
> request_config structure becomes optional for the request.
> 
> In C++ bindings this allows us to implement an elegant interface with
> rust-like chained mutators. To that end, we're also introducing a new
> intermediate class called request_builder that's returned by the chip's
> prepare_request() method which exposes routines for storing the line
> and request configs for the request we're making. For examples of
> usage - see C++ tests and samples.

It's a huge change and my knowledge of C++ is a bare minimum from dozen of
years ago, can you point out to the file with an example how this APIs (which
are suggested by a new code) look like for developer in practice? Some test
cases or simple example? This can help to understand the prettiness of the
API.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2022-09-14 10:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-13 16:14 [libgpiod v2][PATCH v2] treewide: rework line configuration Bartosz Golaszewski
2022-09-14 10:13 ` Andy Shevchenko [this message]
2022-09-14 11:58   ` Bartosz Golaszewski
2022-09-22 12:25 ` Bartosz Golaszewski
2022-09-23  0:11   ` Kent Gibson
2022-09-23  8:13     ` 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=YyGpQedIKMRg8IVA@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=brgl@bgdev.pl \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=viresh.kumar@linaro.org \
    --cc=warthog618@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox