Skip to contentSkip to conversation

libgpiod: Minor fixups for 2.0 bindings

PATCH In review Viresh Kumar 2 participants 6 messages Nov 26, 2021 – Dec 3, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover libgpiod: Minor fixups for 2.0 bindings

Hi Bartosz,

This patchset contain minor fixes for the libgpiod 2.0 helpers that I found during my rust bindings work with it.

It is based on next/post-libgpiod-2.0 branch.

--
Viresh

Viresh Kumar (2):
libgpiod: Fix ioctl number for gpiod_line_request_reconfigure_lines()
libgpiod: Remove dummy declaration gpiod_line_config_get_event_clock()

 include/gpiod.h    | 12 ------------
 lib/line-request.c |  2 +-
 2 files changed, 1 insertion(+), 13 deletions(-)
Signature · 1 line
2.31.1.272.g89b43f80a514
#1 lore raw

PATCH 1/2 libgpiod: Fix ioctl number for gpiod_line_request_reconfigure_lines()

The ioctl number used for gpiod_line_request_reconfigure_lines() is incorrect written as GPIO_V2_LINE_GET_VALUES_IOCTL instead of GPIO_V2_LINE_SET_CONFIG_IOCTL. Fix it.

---
 lib/line-request.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/line-request.c +1 -1
index 8008b89c7e65..0ac4ec89408e 100644
@@ -197,7 +197,7 @@ gpiod_line_request_reconfigure_lines(struct gpiod_line_request *request,
 	if (ret)
 		return ret;
 
-	ret = ioctl(request->fd, GPIO_V2_LINE_GET_VALUES_IOCTL, &cfgbuf);
+	ret = ioctl(request->fd, GPIO_V2_LINE_SET_CONFIG_IOCTL, &cfgbuf);
 	if (ret)
 		return ret;
 
Signature · 1 line
2.31.1.272.g89b43f80a514
#2 lore raw

PATCH 2/2 libgpiod: Remove dummy declaration gpiod_line_config_get_event_clock()

In reply to Viresh Kumar

gpiod_line_config_get_event_clock() isn't implemented, and just has the declaration available. Drop it.

---
 include/gpiod.h | 12 ------------
 1 file changed, 12 deletions(-)
include/gpiod.h +0 -12
index 44deafc83c11..0bc0ceee4b76 100644
@@ -777,18 +777,6 @@ void gpiod_line_config_set_event_clock_subset(struct gpiod_line_config *config,
 					      unsigned int num_offsets,
 					      const unsigned int *offsets);
 
-/**
- * @brief Get the event clock setting for a given line.
- * @param config Line config object.
- * @param offset Line offset for which to read the event clock setting.
- * @return Event clock setting that would have been used for given offset if
- *         the config object was used in a request at the time of the call.
- * @note If an offset is used for which no config was provided, the function
- *       will return the global default value.
- */
-int gpiod_line_config_get_event_clock(struct gpiod_line_config *config,
-				      unsigned int offset);
-
 /**
  * @brief Set the output value for a single offset.
  * @param config Line config object.
Signature · 1 line
2.31.1.272.g89b43f80a514
#4 lore raw
In reply to Viresh Kumar
Quoted 15 lines · Viresh Kumar

Hi Bartosz,

This patchset contain minor fixes for the libgpiod 2.0 helpers that I found during my rust bindings work with it.

It is based on next/post-libgpiod-2.0 branch.

--
Viresh

Viresh Kumar (2):
libgpiod: Fix ioctl number for gpiod_line_request_reconfigure_lines()
libgpiod: Remove dummy declaration gpiod_line_config_get_event_clock()

Quoted 7 lines
 include/gpiod.h    | 12 ------------
 lib/line-request.c |  2 +-
 2 files changed, 1 insertion(+), 13 deletions(-)

--
2.31.1.272.g89b43f80a514

Thanks a lot! Are you fine with me squashing this with the big patch like I did with similar fixes from Ben before? The patch is technically still under development (this kind of bugs will be uncovered a lot once I start writing tests) and there's no reason to merge it into master with bugs. I would keep your signed-off-by of course.

Bart

#5 lore raw
Quoted 5 lines · Bartosz Golaszewski

Thanks a lot! Are you fine with me squashing this with the big patch like I did with similar fixes from Ben before? The patch is technically still under development (this kind of bugs will be uncovered a lot once I start writing tests) and there's no reason to merge it into master with bugs.

Sure.

Quoted 1 line

I would keep your signed-off-by of course.

Its okay to drop that as well if required, I don't care about it much :)

Signature · 1 line
viresh
#3 lore raw

Re: [PATCH 2/2] libgpiod: Remove dummy declaration gpiod_line_config_get_event_clock()

In reply to Viresh Kumar
Quoted 33 lines · Viresh Kumar

gpiod_line_config_get_event_clock() isn't implemented, and just has the declaration available. Drop it.

---
 include/gpiod.h | 12 ------------
 1 file changed, 12 deletions(-)
include/gpiod.h +0 -13
index 44deafc83c11..0bc0ceee4b76 100644
@@ -777,18 +777,6 @@ void gpiod_line_config_set_event_clock_subset(struct gpiod_line_config *config,
                                              unsigned int num_offsets,
                                              const unsigned int *offsets);
 
-/**
- * @brief Get the event clock setting for a given line.
- * @param config Line config object.
- * @param offset Line offset for which to read the event clock setting.
- * @return Event clock setting that would have been used for given offset if
- *         the config object was used in a request at the time of the call.
- * @note If an offset is used for which no config was provided, the function
- *       will return the global default value.
- */
-int gpiod_line_config_get_event_clock(struct gpiod_line_config *config,
-                                     unsigned int offset);
-
 /**
  * @brief Set the output value for a single offset.
  * @param config Line config object.
--
Quoted 2 lines

2.31.1.272.g89b43f80a514

But we want this function - it should get implemented, not dropped. :)

It's actually added in the devel branch for line_config accessors.

Bart