@@ -410,14 +410,6 @@ gpiod_info_event_peek_line_info(struct gpiod_info_event *event);
struct gpiod_line_info *
gpiod_info_event_get_line_info(struct gpiod_info_event *event);
-/**
- * @brief Read the line info event from a file descriptor.
- * @param fd File descriptor to read from.
- * @return New info event object or NULL on error. The returned object must be
- * freed using ::gpiod_info_event_free.
- */
-struct gpiod_info_event *gpiod_info_event_read_fd(int fd);
-
/**
* @}
*
@@ -1036,22 +1028,6 @@ gpiod_edge_event_buffer_get_event(struct gpiod_edge_event_buffer *buffer,
unsigned int
gpiod_edge_event_buffer_num_events(struct gpiod_edge_event_buffer *buffer);
-/**
- * @brief Read GPIO edge events directly from a file descriptor.
- * @param fd File descriptor.
- * @param buffer Line event buffer.
- * @param max_events Maximum number of events to read.
- * @return On success returns the number of events read from the file
- * descriptor, on failure return -1.
- *
- * Users who directly poll the file descriptor for incoming events can also
- * directly read the event data from it using this routine. This function
- * translates the kernel representation of the event to the libgpiod format.
- */
-int gpiod_edge_event_buffer_read_fd(int fd,
- struct gpiod_edge_event_buffer *buffer,
- unsigned int max_events);
-
/**
* @}
*
@@ -146,9 +146,8 @@ gpiod_edge_event_buffer_num_events(struct gpiod_edge_event_buffer *buffer)
return buffer->num_events;
}
-GPIOD_API int
-gpiod_edge_event_buffer_read_fd(int fd, struct gpiod_edge_event_buffer *buffer,
- unsigned int max_events)
+int gpiod_edge_event_buffer_read_fd(int fd, struct gpiod_edge_event_buffer *buffer,
+ unsigned int max_events)
{
struct gpio_v2_line_event *curr;
struct gpiod_edge_event *event;
@@ -86,7 +86,7 @@ gpiod_info_event_get_line_info(struct gpiod_info_event *event)
return gpiod_line_info_copy(event->info);
}
-GPIOD_API struct gpiod_info_event *gpiod_info_event_read_fd(int fd)
+struct gpiod_info_event *gpiod_info_event_read_fd(int fd)
{
struct gpio_v2_line_info_changed evbuf;
ssize_t rd;
@@ -25,8 +25,11 @@ int gpiod_line_config_to_kernel(struct gpiod_line_config *config,
const unsigned int *offsets);
struct gpiod_line_request *
gpiod_line_request_from_kernel(struct gpio_v2_line_request *reqbuf);
+int gpiod_edge_event_buffer_read_fd(int fd, struct gpiod_edge_event_buffer *buffer,
+ unsigned int max_events);
struct gpiod_info_event *
gpiod_info_event_from_kernel(struct gpio_v2_line_info_changed *evbuf);
+struct gpiod_info_event *gpiod_info_event_read_fd(int fd);
int gpiod_poll_fd(int fd, uint64_t timeout);
While exposing file descriptors for polling (for use by event loops) is a common pattern, allowing to read data directly from file descriptors isn't really a thing in most linux libraries. Sane event loops allow to associate data with polled file descriptors so users know which object to use for receiving data when it's available. Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl> --- include/gpiod.h | 24 ------------------------ lib/edge-event.c | 5 ++--- lib/info-event.c | 2 +- lib/internal.h | 3 +++ 4 files changed, 6 insertions(+), 28 deletions(-)