backports.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] backport: declare GPIO own_desc functions if GPIOLIB is not defined
@ 2020-12-16 14:26 Luca Coelho
  2021-02-14 19:58 ` Hauke Mehrtens
  0 siblings, 1 reply; 2+ messages in thread
From: Luca Coelho @ 2020-12-16 14:26 UTC (permalink / raw)
  To: backports; +Cc: johannes, hauke

From: Luca Coelho <luciano.coelho@intel.com>

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
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 backport/compat/backport-5.3.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/backport/compat/backport-5.3.c b/backport/compat/backport-5.3.c
index f501448e24cd..46e6a11d8da3 100644
--- a/backport/compat/backport-5.3.c
+++ b/backport/compat/backport-5.3.c
@@ -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,
-- 
2.29.2

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] backport: declare GPIO own_desc functions if GPIOLIB is not defined
  2020-12-16 14:26 [PATCH] backport: declare GPIO own_desc functions if GPIOLIB is not defined Luca Coelho
@ 2021-02-14 19:58 ` Hauke Mehrtens
  0 siblings, 0 replies; 2+ messages in thread
From: Hauke Mehrtens @ 2021-02-14 19:58 UTC (permalink / raw)
  To: Luca Coelho, backports; +Cc: johannes


[-- Attachment #1.1: Type: text/plain, Size: 1549 bytes --]

On 12/16/20 3:26 PM, Luca Coelho wrote:
> From: Luca Coelho <luciano.coelho@intel.com>
> 
> 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
> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
> ---
>   backport/compat/backport-5.3.c | 11 +++++++++++
>   1 file changed, 11 insertions(+)
> 
> diff --git a/backport/compat/backport-5.3.c b/backport/compat/backport-5.3.c
> index f501448e24cd..46e6a11d8da3 100644
> --- a/backport/compat/backport-5.3.c
> +++ b/backport/compat/backport-5.3.c
> @@ -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,
> 

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

Hauke


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-02-14 20:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-16 14:26 [PATCH] backport: declare GPIO own_desc functions if GPIOLIB is not defined Luca Coelho
2021-02-14 19:58 ` Hauke Mehrtens

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).