From: Kent Gibson <warthog618@gmail.com>
To: Erik Schilling <erik.schilling@linaro.org>
Cc: linux-gpio@vger.kernel.org, brgl@bgdev.pl
Subject: Re: [libgpiod][PATCH 8/8] bindings: rust: examples: replace tools examples with use case examples
Date: Fri, 23 Jun 2023 16:26:38 +0800 [thread overview]
Message-ID: <ZJVXPn683fXesO/s@sol> (raw)
In-Reply-To: <CTJVBIO5TY63.PUKXXIU50HDG@fedora>
On Fri, Jun 23, 2023 at 09:57:17AM +0200, Erik Schilling wrote:
> On Fri Jun 23, 2023 at 6:39 AM CEST, Kent Gibson wrote:
> > Replace tool examples with use case examples drawn from the tools,
> > gpio_events example with buffered_event_lifetimes, and
> > gpio_threaded_info_events with reconfigure_input_to_output.
> >
> > Signed-off-by: Kent Gibson <warthog618@gmail.com>
>
> Reviewed-by: Erik Schilling <erik.schilling@linaro.org>
>
> > let mut buffer = libgpiod::request::Buffer::new(4)?;
>
> Slightly tangential:
>
> Maybe the API should provide some sensible defaults for the buffer size?
> (Or just set a sane default and provide ways to override it)? The change
> from 1 -> 4 for bulk operations seems reasonable, but I feel like a user
> just getting started with all of this likely won't know what might be
> good values to pick...
>
The C API does that - it defaults to 64, IIRC - if you pass in 0.
And the Rust will do the same - read the docs:
/// Create a new edge event buffer.
///
/// If capacity equals 0, it will be set to a default value of 64. If
/// capacity is larger than 1024, it will be limited to 1024.
Using 64 seems excessive to me, so I explictly set more reasonable
sizes in the examples.
Btw a casual user is probably fine with 1 - the events will still be
buffered in the kernel so the only advantages of > 1 is to reduce the
number of reads when handling bursts, and so drain the kernel buffer
slightly quicker. I expect that the only users who would see an
appreciable difference in behaviour with different userspace buffer
sizes probably have a good idea why they want to be setting it.
Again, would be good to document that - if it isn't already.
Cheers,
Kent.
next prev parent reply other threads:[~2023-06-23 8:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-23 4:38 [libgpiod][PATCH 0/8] replace tool examples with use case examples Kent Gibson
2023-06-23 4:38 ` [libgpiod][PATCH 1/8] core: examples: consistency cleanups Kent Gibson
2023-06-23 4:38 ` [libgpiod][PATCH 2/8] core: examples: add more use case examples Kent Gibson
2023-06-23 4:38 ` [libgpiod][PATCH 3/8] bindings: cxx: examples: consistency cleanup Kent Gibson
2023-06-23 4:38 ` [libgpiod][PATCH 4/8] bindings: cxx: examples: replace tools examples with use case examples Kent Gibson
2023-06-23 4:38 ` [libgpiod][PATCH 5/8] bindings: python: examples: consistency cleanup Kent Gibson
2023-06-23 4:38 ` [libgpiod][PATCH 6/8] bindings: python: examples: replace tools examples with use case examples Kent Gibson
2023-06-23 19:31 ` Bartosz Golaszewski
2023-06-23 4:39 ` [libgpiod][PATCH 7/8] bindings: rust: examples: consistency cleanup Kent Gibson
2023-06-23 7:58 ` Erik Schilling
2023-06-23 4:39 ` [libgpiod][PATCH 8/8] bindings: rust: examples: replace tools examples with use case examples Kent Gibson
2023-06-23 7:57 ` Erik Schilling
2023-06-23 8:26 ` Kent Gibson [this message]
2023-06-23 19:35 ` [libgpiod][PATCH 0/8] replace tool " 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=ZJVXPn683fXesO/s@sol \
--to=warthog618@gmail.com \
--cc=brgl@bgdev.pl \
--cc=erik.schilling@linaro.org \
--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 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.