Skip to contentSkip to conversation

backport: declare GPIO own_desc functions if GPIOLIB is not defined

PATCH In review Luca Coelho 2 participants 2 messages Dec 16, 2020 – Feb 14, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 backport: declare GPIO own_desc functions if GPIOLIB is not defined

From: Luca Coelho <[email protected]>

In kernels older than v5.4, the gpiochip_request_own_desc() and the gpiochip_free_own_desc() functions are declared inside a CONFIG_GPIOLIB ifdef, so we need to declare them in our implementation to avoid compilation problems.

Change-Id Ic6da0d7ff9d99c64d110da63fb950fb555fd2782
---
 backport/compat/backport-5.3.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
backport/compat/backport-5.3.c +11 -0
index f501448e24cd..46e6a11d8da3 100644
@@ -45,6 +45,17 @@ static int gpiod_configure_flags(struct gpio_desc *desc, const char *con_id,
 }
 
 #undef gpiochip_request_own_desc
+
+/* In kernels older than 5.4, these function declarations are inside a
+ * CONFIG_GPIOLIB ifdef, so we need to declare them here.
+ */
+#ifndef CONFIG_GPIOLIB
+extern struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip *chip,
+						   u16 hwnum,
+						   const char *label);
+void gpiochip_free_own_desc(struct gpio_desc *desc);
+#endif /* CONFIG_GPIOLIB */
+
 struct gpio_desc *backport_gpiochip_request_own_desc(struct gpio_chip *gc,
 					    unsigned int hwnum,
 					    const char *label,
Signature · 4 lines
2.29.2

--
To unsubscribe from this list: send the line "unsubscribe backports" in
#1 lore raw
Quoted 26 lines · Luca Coelho

From: Luca Coelho <[email protected]>

In kernels older than v5.4, the gpiochip_request_own_desc() and the gpiochip_free_own_desc() functions are declared inside a CONFIG_GPIOLIB ifdef, so we need to declare them in our implementation to avoid compilation problems.

Change-Id Ic6da0d7ff9d99c64d110da63fb950fb555fd2782
---
  backport/compat/backport-5.3.c | 11 +++++++++++
  1 file changed, 11 insertions(+)
backport/compat/backport-5.3.c +4 -0
index f501448e24cd..46e6a11d8da3 100644
@@ -45,6 +45,17 @@ static int gpiod_configure_flags(struct gpio_desc *desc, const char *con_id,
  }
 
  #undef gpiochip_request_own_desc
+
+/* In kernels older than 5.4, these function declarations are inside a
+ * CONFIG_GPIOLIB ifdef, so we need to declare them here.
+ */

backport/compat/backport-5.3.c static int gpiod_configure_flags(struct gpio_desc *desc, const char *con_id, · line 61

Quoted 10 lines
backport/compat/backport-5.3.c +7 -0
+#ifndef CONFIG_GPIOLIB
+extern struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip *chip,
+						   u16 hwnum,
+						   const char *label);
+void gpiochip_free_own_desc(struct gpio_desc *desc);
+#endif /* CONFIG_GPIOLIB */
+
  struct gpio_desc *backport_gpiochip_request_own_desc(struct gpio_chip *gc,
  					    unsigned int hwnum,
  					    const char *label,

Thank you for the patch, I applied it and created a new 5.10.16 release.

Hauke