From: Kent Gibson <warthog618@gmail.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: linux-gpio@vger.kernel.org
Subject: Re: [libgpiod][RFC] helper functions for basic use cases
Date: Wed, 22 May 2024 20:41:03 +0800 [thread overview]
Message-ID: <20240522124103.GA172631@rigel> (raw)
In-Reply-To: <CAMRc=McuzzzRF8ttRKZWouayF250p8V2OXwmyjSrKOYe95Mn+g@mail.gmail.com>
On Wed, May 22, 2024 at 12:59:39PM +0200, Bartosz Golaszewski wrote:
> On Fri, May 17, 2024 at 2:37 PM Kent Gibson <warthog618@gmail.com> wrote:
> >
> >
> > Oh, I agree - that makes total sense. The direction I was headed felt wrong,
> > so I figured I must've misunderstood what you meant.
> >
> > I'll re-organise it into a separate unit.
> >
> > Does that unit have to act through the core API, or can we give it
> > access to the internals?
>
> If we can avoid it accessing the internals, that would be awesome.
> Unless you hit a road-block, please try to keep the core separate.
>
If you want the ext functions to store config then that would rule out the
shortcut constructors returning a gpiod_line_request.
I was thinking that the ext could be a friend of core and get access to
some things not generally accessible, in this case allowing ext to store
the config inside the request.
Without that, the two options we have is to rebuild the config from line
info, which you don't like, or wrapping the gpiod_line_request and have
the wrapper provide an accessor to the contained gpiod_line_request if
the user wants to use core API, which I'm not thrilled about.
But that seems to be the only option.
> > And where do you stand wrt the idea of adding a config pointer to struct
> > gpiod_line_request itself?
> >
>
> We'd need to make a deep copy, otherwise it could be destroyed and the
> pointer would be left dangling, right?
>
No, as the config is constructed and added by ext - the user can't actually
see it. It would only be accessed indirectly via the ext functions.
If using only the core API then it would always be NULL.
Well unless we were to provide accessors to make it accessible to the
user, and then which way to go would be open to debate. There are other
functions in libgpiod that pass ownership, so copying isn't the only
option. I haven't put much thought into that though, as I wasn't planning
to go there.
Cheers,
Kent.
next prev parent reply other threads:[~2024-05-22 12:41 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-07 2:21 [libgpiod][RFC] helper functions for basic use cases Kent Gibson
2024-05-10 18:37 ` Bartosz Golaszewski
2024-05-11 1:11 ` Kent Gibson
2024-05-13 8:28 ` Bartosz Golaszewski
2024-05-13 10:13 ` Kent Gibson
2024-05-14 13:31 ` Bartosz Golaszewski
2024-05-14 13:38 ` Kent Gibson
2024-05-15 8:26 ` Bartosz Golaszewski
2024-05-15 9:18 ` Kent Gibson
2024-05-15 13:37 ` Kent Gibson
2024-05-15 13:54 ` Bartosz Golaszewski
2024-05-15 14:14 ` Kent Gibson
2024-05-16 0:19 ` Kent Gibson
2024-05-16 13:55 ` Kent Gibson
2024-05-17 10:53 ` Bartosz Golaszewski
2024-05-17 12:37 ` Kent Gibson
2024-05-22 10:59 ` Bartosz Golaszewski
2024-05-22 12:41 ` Kent Gibson [this message]
2024-05-24 14:20 ` Bartosz Golaszewski
2024-05-15 7:06 ` Martin Hundebøll
2024-05-15 9:32 ` Kent Gibson
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=20240522124103.GA172631@rigel \
--to=warthog618@gmail.com \
--cc=brgl@bgdev.pl \
--cc=linux-gpio@vger.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).