From 23f7bc07f3b8f3d3ec8e9b87e58b6fa7aab21277 Mon Sep 17 00:00:00 2001
From: Bartosz Golaszewski <bartekgola@gmail.com>
Date: Wed, 11 Oct 2017 14:20:54 +0200
Subject: [PATCH] simple-api: use correct prefixes for callback typedefs

We want to have all simple-api-related symbols prefixed with
gpiod_simple_.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
---
 include/gpiod.h     | 24 +++++++++++++-----------
 src/lib/simple.c    | 13 +++++++------
 src/tools/gpioset.c |  2 +-
 3 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/include/gpiod.h b/include/gpiod.h
index 702fb87..d1efd62 100644
--- a/include/gpiod.h
+++ b/include/gpiod.h
@@ -95,7 +95,7 @@ int gpiod_simple_get_value_multiple(const char *consumer, const char *device,
 /**
  * @brief Simple set value callback signature.
  */
-typedef void (*gpiod_set_value_cb)(void *);
+typedef void (*gpiod_simple_set_value_cb)(void *);
 
 /**
  * @brief Set value of a single GPIO line.
@@ -112,7 +112,7 @@ typedef void (*gpiod_set_value_cb)(void *);
  */
 int gpiod_simple_set_value(const char *consumer, const char *device,
 			   unsigned int offset, int value, bool active_low,
-			   gpiod_set_value_cb cb, void *data) GPIOD_API;
+			   gpiod_simple_set_value_cb cb, void *data) GPIOD_API;
 
 /**
  * @brief Set values of a set of a set of GPIO lines.
@@ -130,7 +130,8 @@ int gpiod_simple_set_value(const char *consumer, const char *device,
 int gpiod_simple_set_value_multiple(const char *consumer, const char *device,
 				    const unsigned int *offsets,
 				    const int *values, unsigned int num_lines,
-				    bool active_low, gpiod_set_value_cb cb,
+				    bool active_low,
+				    gpiod_simple_set_value_cb cb,
 				    void *data) GPIOD_API;
 
 /**
@@ -162,8 +163,8 @@ enum {
  * GPIO line offset (unsigned int), event timestamp (const struct timespec *)
  * and a pointer to user data (void *).
  */
-typedef int (*gpiod_event_handle_cb)(int, unsigned int,
-				     const struct timespec *, void *);
+typedef int (*gpiod_simple_event_handle_cb)(int, unsigned int,
+					    const struct timespec *, void *);
 
 /**
  * @brief Return status values that the simple event poll callback can return.
@@ -193,8 +194,9 @@ enum {
  * return an appropriate value that can be interpreted by the event loop
  * routine.
  */
-typedef int (*gpiod_event_poll_cb)(unsigned int, const int *, unsigned int *,
-				   const struct timespec *, void *);
+typedef int (*gpiod_simple_event_poll_cb)(unsigned int,
+					  const int *, unsigned int *,
+					  const struct timespec *, void *);
 
 /**
  * @brief Wait for events on a single GPIO line.
@@ -214,8 +216,8 @@ typedef int (*gpiod_event_poll_cb)(unsigned int, const int *, unsigned int *,
 int gpiod_simple_event_loop(const char *consumer, const char *device,
 			    unsigned int offset, bool active_low,
 			    const struct timespec *timeout,
-			    gpiod_event_poll_cb poll_cb,
-			    gpiod_event_handle_cb event_cb,
+			    gpiod_simple_event_poll_cb poll_cb,
+			    gpiod_simple_event_handle_cb event_cb,
 			    void *data) GPIOD_API;
 
 /**
@@ -237,8 +239,8 @@ int gpiod_simple_event_loop_multiple(const char *consumer, const char *device,
 				     const unsigned int *offsets,
 				     unsigned int num_lines, bool active_low,
 				     const struct timespec *timeout,
-				     gpiod_event_poll_cb poll_cb,
-				     gpiod_event_handle_cb event_cb,
+				     gpiod_simple_event_poll_cb poll_cb,
+				     gpiod_simple_event_handle_cb event_cb,
 				     void *data) GPIOD_API;
 
 /**
diff --git a/src/lib/simple.c b/src/lib/simple.c
index 88fdeff..905e1d6 100644
--- a/src/lib/simple.c
+++ b/src/lib/simple.c
@@ -79,7 +79,7 @@ int gpiod_simple_get_value_multiple(const char *consumer, const char *device,
 
 int gpiod_simple_set_value(const char *consumer, const char *device,
 			   unsigned int offset, int value, bool active_low,
-			   gpiod_set_value_cb cb, void *data)
+			   gpiod_simple_set_value_cb cb, void *data)
 {
 	return gpiod_simple_set_value_multiple(consumer, device, &offset,
 					       &value, 1, active_low,
@@ -89,7 +89,8 @@ int gpiod_simple_set_value(const char *consumer, const char *device,
 int gpiod_simple_set_value_multiple(const char *consumer, const char *device,
 				    const unsigned int *offsets,
 				    const int *values, unsigned int num_lines,
-				    bool active_low, gpiod_set_value_cb cb,
+				    bool active_low,
+				    gpiod_simple_set_value_cb cb,
 				    void *data)
 {
 	struct gpiod_line_bulk bulk;
@@ -171,8 +172,8 @@ static int basic_event_poll(unsigned int num_lines, const int *fds,
 int gpiod_simple_event_loop(const char *consumer, const char *device,
 			    unsigned int offset, bool active_low,
 			    const struct timespec *timeout,
-			    gpiod_event_poll_cb poll_cb,
-			    gpiod_event_handle_cb event_cb,
+			    gpiod_simple_event_poll_cb poll_cb,
+			    gpiod_simple_event_handle_cb event_cb,
 			    void *data)
 {
 	return gpiod_simple_event_loop_multiple(consumer, device, &offset, 1,
@@ -184,8 +185,8 @@ int gpiod_simple_event_loop_multiple(const char *consumer, const char *device,
 				     const unsigned int *offsets,
 				     unsigned int num_lines, bool active_low,
 				     const struct timespec *timeout,
-				     gpiod_event_poll_cb poll_cb,
-				     gpiod_event_handle_cb event_cb,
+				     gpiod_simple_event_poll_cb poll_cb,
+				     gpiod_simple_event_handle_cb event_cb,
 				     void *data)
 {
 	unsigned int i, event_offset, line_offset;
diff --git a/src/tools/gpioset.c b/src/tools/gpioset.c
index 6096e7c..d1a46c1 100644
--- a/src/tools/gpioset.c
+++ b/src/tools/gpioset.c
@@ -137,7 +137,7 @@ enum {
 struct mode_mapping {
 	int id;
 	const char *name;
-	gpiod_set_value_cb callback;
+	gpiod_simple_set_value_cb callback;
 };
 
 static const struct mode_mapping modes[] = {
-- 
2.30.2