From: Kent Gibson <warthog618@gmail.com>
To: linux-gpio@vger.kernel.org, brgl@bgdev.pl
Cc: Kent Gibson <warthog618@gmail.com>
Subject: [libgpiod v2][PATCH 3/6] line-config: rename off to idx
Date: Fri, 11 Mar 2022 15:39:23 +0800 [thread overview]
Message-ID: <20220311073926.78636-4-warthog618@gmail.com> (raw)
In-Reply-To: <20220311073926.78636-1-warthog618@gmail.com>
The off variable in set_kernel_attr_mask actually refers to an index
into a bit mask, not a line offset, so rename it to idx to avoid any
confusion.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
---
lib/line-config.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/line-config.c b/lib/line-config.c
index f21e1c4..31fc1b3 100644
--- a/lib/line-config.c
+++ b/lib/line-config.c
@@ -1034,7 +1034,7 @@ static void set_kernel_attr_mask(uint64_t *out, const uint64_t *in,
{
struct override_config *override;
size_t i, j;
- int off;
+ int idx;
gpiod_line_mask_zero(out);
@@ -1045,9 +1045,9 @@ static void set_kernel_attr_mask(uint64_t *out, const uint64_t *in,
!gpiod_line_mask_test_bit(in, i))
continue;
- for (j = 0, off = -1; j < num_lines; j++) {
+ for (j = 0, idx = -1; j < num_lines; j++) {
if (offsets[j] == override->offset) {
- off = j;
+ idx = j;
break;
}
}
@@ -1056,10 +1056,10 @@ static void set_kernel_attr_mask(uint64_t *out, const uint64_t *in,
* Overridden offsets that are not in the list of offsets to
* request (or already requested) are silently ignored.
*/
- if (off < 0)
+ if (idx < 0)
continue;
- gpiod_line_mask_set_bit(out, off);
+ gpiod_line_mask_set_bit(out, idx);
}
}
--
2.35.1
next prev parent reply other threads:[~2022-03-11 7:40 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
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 ` Kent Gibson [this message]
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=20220311073926.78636-4-warthog618@gmail.com \
--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).