diff mbox series

[libgpiod,v2,3/6] line-config: rename off to idx

Message ID 20220311073926.78636-4-warthog618@gmail.com
State New
Headers show
Series documentation and other minor tweaks | expand

Commit Message

Kent Gibson March 11, 2022, 7:39 a.m. UTC
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 mbox series

Patch

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);
 	}
 }