diff mbox series

[libgpiod,v2,4/6] line-config: rename num_values to num_lines

Message ID 20220311073926.78636-5-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
Other functions, such as gpiod_line_request_set_values_subset()
use num_lines to indicate the size of the set, so change
num_values to num_lines in gpiod_line_config_set_output_values()
to be consistent.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
---
 include/gpiod.h   | 4 ++--
 lib/line-config.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Bartosz Golaszewski March 15, 2022, 10:58 a.m. UTC | #1
On Fri, Mar 11, 2022 at 8:40 AM Kent Gibson <warthog618@gmail.com> wrote:
>
> Other functions, such as gpiod_line_request_set_values_subset()
> use num_lines to indicate the size of the set, so change
> num_values to num_lines in gpiod_line_config_set_output_values()
> to be consistent.
>
> Signed-off-by: Kent Gibson <warthog618@gmail.com>

This is the same issue as with patch 2. We're setting a number of
offset to value mappings (it's better visible in the C++ bindings
where we're actually setting std::pairs of offset -> value mapping. I
think that we need to pass is the number of values to set and not
number of lines. We are still preparing the configuration.

Bart
diff mbox series

Patch

diff --git a/include/gpiod.h b/include/gpiod.h
index 8fb70ee..3f4bedd 100644
--- a/include/gpiod.h
+++ b/include/gpiod.h
@@ -935,13 +935,13 @@  gpiod_line_config_set_output_value_override(struct gpiod_line_config *config,
 /**
  * @brief Override the output values for multiple offsets.
  * @param config Line config object.
- * @param num_values Number of offsets for which to override values.
+ * @param num_lines Number of lines for which to override values.
  * @param offsets Array of line offsets to override values for.
  * @param values Array of output values associated with the offsets passed in
  *               the previous argument.
  */
 void gpiod_line_config_set_output_values(struct gpiod_line_config *config,
-					 size_t num_values,
+					 size_t num_lines,
 					 const unsigned int *offsets,
 					 const int *values);
 
diff --git a/lib/line-config.c b/lib/line-config.c
index 31fc1b3..0361a32 100644
--- a/lib/line-config.c
+++ b/lib/line-config.c
@@ -671,13 +671,13 @@  gpiod_line_config_set_output_value_override(struct gpiod_line_config *config,
 
 GPIOD_API void
 gpiod_line_config_set_output_values(struct gpiod_line_config *config,
-				    size_t num_values,
+				    size_t num_lines,
 				    const unsigned int *offsets,
 				    const int *values)
 {
 	size_t i;
 
-	for (i = 0; i < num_values; i++)
+	for (i = 0; i < num_lines; i++)
 		gpiod_line_config_set_output_value_override(config,
 							    offsets[i],
 							    values[i]);