From: Kent Gibson <warthog618@gmail.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: "open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>
Subject: Re: [libgpiod v2][PATCH 2/6] API: rename gpiod_request_config_get_num_offsets to gpiod_request_config_get_num_lines to match line_request pattern
Date: Tue, 15 Mar 2022 19:23:05 +0800 [thread overview]
Message-ID: <20220315112305.GA170151@sol> (raw)
In-Reply-To: <CAMRc=MfDmc86mK=8U_srVJg6fFvFy5hx+pnYmN8wS8rd4KWobQ@mail.gmail.com>
On Tue, Mar 15, 2022 at 11:52:21AM +0100, Bartosz Golaszewski wrote:
> On Fri, Mar 11, 2022 at 8:40 AM Kent Gibson <warthog618@gmail.com> wrote:
> >
> > Both gpiod_request_config and gpiod_line_request contain a number of
> > lines, but the former has a get_num_offsets accessor, while the latter
> > has get_num_lines. Make them consistent by switching request_config to
> > get_num_lines.
> >
> > Signed-off-by: Kent Gibson <warthog618@gmail.com>
> > ---
>
> IMO this doesn't make much sense because we still have
> gpiod_request_config_set_offsets(). So now you have set_offsets but
> get_lines. At the time of preparing the request_config we're still
> talking about offsets of lines to request, while once the request has
> been made, we're talking about requested lines.
>
Oh FFS we are always talking about lines. Whether you have requested
them yet or not is irrelevant. You WANT to request lines.
If we had globally unique line names we wouldn't give a rats about the
offset.
And take another look - you have actually have get_offsets and
get_num_lines functions.
Offsets is just one of the attributes of the lines, and this approach
still works if there is another fields of interest. e.g. values:
int gpiod_line_request_set_values_subset(struct gpiod_line_request *request,
size_t num_lines,
const unsigned int *offsets,
const int *values);
which you then complain about in patch 4 as I'm writing this.... <sigh>.
You could equally argue that one should be num_values.
While we are still preparing the configuration, we are preparing the
config for LINES, not offsets. Using num_lines is a reminder that you
need to provide the offset for each line - the two are inextricably
linked. Using num_offsets could be taken to imply that
gpiod_request_config_set_offsets() can be called multiple times to add
offsets.
> I would leave it as it is personally.
>
I know, I know :-|.
Cheers,
Kent.
next prev parent reply other threads:[~2022-03-15 11:23 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-11 7:39 [libgpiod v2][PATCH 0/6] documentation and other minor tweaks Kent Gibson
2022-03-11 7:39 ` [libgpiod v2][PATCH 1/6] treewide: use size_t for loop variable where limit is size_t Kent Gibson
2022-03-11 7:39 ` [libgpiod v2][PATCH 2/6] API: rename gpiod_request_config_get_num_offsets to gpiod_request_config_get_num_lines to match line_request pattern Kent Gibson
2022-03-15 10:52 ` Bartosz Golaszewski
2022-03-15 11:23 ` Kent Gibson [this message]
2022-03-15 11:39 ` Bartosz Golaszewski
2022-03-15 11:59 ` Kent Gibson
2022-03-15 13:43 ` Bartosz Golaszewski
2022-03-15 14:51 ` Kent Gibson
2022-03-11 7:39 ` [libgpiod v2][PATCH 3/6] line-config: rename off to idx Kent Gibson
2022-03-11 7:39 ` [libgpiod v2][PATCH 4/6] line-config: rename num_values to num_lines Kent Gibson
2022-03-15 10:58 ` Bartosz Golaszewski
2022-03-11 7:39 ` [libgpiod v2][PATCH 5/6] line-request: rename wait and read functions Kent Gibson
2022-03-11 7:39 ` [libgpiod v2][PATCH 6/6] doc: API documentation tweaks Kent Gibson
2022-03-15 11:20 ` Bartosz Golaszewski
2022-03-14 8:31 ` [libgpiod v2][PATCH 0/6] documentation and other minor tweaks Bartosz Golaszewski
2022-03-15 1:33 ` Kent Gibson
2022-03-15 11:25 ` 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=20220315112305.GA170151@sol \
--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).