Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1631910 > unrolled thread

[PATCH v2] gpiolib: Add stubs for gpiod lookup table interface

Started byAnatolij Gustschin <agust@denx.de>
First post2017-04-27 09:00 +0200
Last post2017-04-27 16:30 +0200
Articles 5 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2] gpiolib: Add stubs for gpiod lookup table interface Anatolij Gustschin <agust@denx.de> - 2017-04-27 09:00 +0200
    Re: [PATCH v2] gpiolib: Add stubs for gpiod lookup table interface Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-04-27 16:10 +0200
      Re: [PATCH v2] gpiolib: Add stubs for gpiod lookup table interface Anatolij Gustschin <agust@denx.de> - 2017-04-27 16:30 +0200
        Re: [PATCH v2] gpiolib: Add stubs for gpiod lookup table interface Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-04-27 16:50 +0200
      Re: [PATCH v2] gpiolib: Add stubs for gpiod lookup table interface Anatolij Gustschin <agust@denx.de> - 2017-04-27 16:30 +0200

#1631910 — [PATCH v2] gpiolib: Add stubs for gpiod lookup table interface

FromAnatolij Gustschin <agust@denx.de>
Date2017-04-27 09:00 +0200
Subject[PATCH v2] gpiolib: Add stubs for gpiod lookup table interface
Message-ID<tALzc-5ht-15@gated-at.bofh.it>
Add stubs for gpiod_add_lookup_table() and gpiod_remove_lookup_table()
for the !GPIOLIB case to prevent build errors. Also add prototypes.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
Changes in v2:
 move gpiod_lookup_table out of #ifdef

 include/linux/gpio/consumer.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h
index 8f702fc..f4a3fed 100644
--- a/include/linux/gpio/consumer.h
+++ b/include/linux/gpio/consumer.h
@@ -41,6 +41,8 @@ enum gpiod_flags {
 			  GPIOD_FLAGS_BIT_DIR_VAL,
 };
 
+struct gpiod_lookup_table;
+
 #ifdef CONFIG_GPIOLIB
 
 /* Return the number of GPIOs associated with a device / function */
@@ -144,6 +146,9 @@ struct gpio_desc *devm_fwnode_get_index_gpiod_from_child(struct device *dev,
 						enum gpiod_flags flags,
 						const char *label);
 
+void gpiod_add_lookup_table(struct gpiod_lookup_table *table);
+void gpiod_remove_lookup_table(struct gpiod_lookup_table *table);
+
 #else /* CONFIG_GPIOLIB */
 
 static inline int gpiod_count(struct device *dev, const char *con_id)
@@ -435,6 +440,14 @@ struct gpio_desc *devm_fwnode_get_index_gpiod_from_child(struct device *dev,
 	return ERR_PTR(-ENOSYS);
 }
 
+static inline void gpiod_add_lookup_table(struct gpiod_lookup_table *table)
+{
+}
+
+static inline void gpiod_remove_lookup_table(struct gpiod_lookup_table *table)
+{
+}
+
 #endif /* CONFIG_GPIOLIB */
 
 static inline
-- 
2.7.4

[toc] | [next] | [standalone]


#1632118

FromAndy Shevchenko <andy.shevchenko@gmail.com>
Date2017-04-27 16:10 +0200
Message-ID<tAShj-1ET-3@gated-at.bofh.it>
In reply to#1631910
On Thu, Apr 27, 2017 at 9:52 AM, Anatolij Gustschin <agust@denx.de> wrote:
> Add stubs for gpiod_add_lookup_table() and gpiod_remove_lookup_table()
> for the !GPIOLIB case to prevent build errors. Also add prototypes.
>
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

Oh, has to take my tag back. See below why.


> --- a/include/linux/gpio/consumer.h
> +++ b/include/linux/gpio/consumer.h

It is already defined in machine.h.

What you basically need is to add stubs for !GPIOLIB case

#ifdef ...
...existing prototypes...
#else /* GPIOLIB */
static inline void gpiod_add_lookup_table(struct gpiod_lookup_table *table) {}
static inline void gpiod_remove_lookup_table(struct gpiod_lookup_table
*table) {}
#endif /* !GPIOLIB */

P.S. please notice how I put the stubs. It would be good to keep them
in two lines.

-- 
With Best Regards,
Andy Shevchenko

[toc] | [prev] | [next] | [standalone]


#1632130

FromAnatolij Gustschin <agust@denx.de>
Date2017-04-27 16:30 +0200
Message-ID<tASAG-1Ma-11@gated-at.bofh.it>
In reply to#1632118
On Thu, 27 Apr 2017 16:25:34 +0200
Anatolij Gustschin agust@denx.de wrote:

>On Thu, 27 Apr 2017 17:07:23 +0300
>Andy Shevchenko andy.shevchenko@gmail.com wrote:
...
>>static inline void gpiod_add_lookup_table(struct gpiod_lookup_table *table) {}
>>static inline void gpiod_remove_lookup_table(struct gpiod_lookup_table
>>*table) {}
>>#endif /* !GPIOLIB */
>>
>>P.S. please notice how I put the stubs. It would be good to keep them
>>in two lines.  
>
>this will exceed 80 char line limit.

I'll go with

static inline 
void gpiod_add_lookup_table(struct gpiod_lookup_table *table) {}

static inline
void gpiod_remove_lookup_table(struct gpiod_lookup_table *table) {}

Is it okay?

Thanks,

Anatolij

[toc] | [prev] | [next] | [standalone]


#1632151

FromAndy Shevchenko <andy.shevchenko@gmail.com>
Date2017-04-27 16:50 +0200
Message-ID<tASU2-1Wr-15@gated-at.bofh.it>
In reply to#1632130
On Thu, Apr 27, 2017 at 5:29 PM, Anatolij Gustschin <agust@denx.de> wrote:
> On Thu, 27 Apr 2017 16:25:34 +0200
> Anatolij Gustschin agust@denx.de wrote:
>
>>On Thu, 27 Apr 2017 17:07:23 +0300
>>Andy Shevchenko andy.shevchenko@gmail.com wrote:
> ...
>>>static inline void gpiod_add_lookup_table(struct gpiod_lookup_table *table) {}
>>>static inline void gpiod_remove_lookup_table(struct gpiod_lookup_table
>>>*table) {}
>>>#endif /* !GPIOLIB */
>>>
>>>P.S. please notice how I put the stubs. It would be good to keep them
>>>in two lines.
>>
>>this will exceed 80 char line limit.

Not for many (unimportant) symbols.

> I'll go with
>
> static inline
> void gpiod_add_lookup_table(struct gpiod_lookup_table *table) {}
>
> static inline
> void gpiod_remove_lookup_table(struct gpiod_lookup_table *table) {}
>
> Is it okay?

Whatever Linus prefers. I'm fine with either.

-- 
With Best Regards,
Andy Shevchenko

[toc] | [prev] | [next] | [standalone]


#1632135

FromAnatolij Gustschin <agust@denx.de>
Date2017-04-27 16:30 +0200
Message-ID<tASAG-1Ma-13@gated-at.bofh.it>
In reply to#1632118
On Thu, 27 Apr 2017 17:07:23 +0300
Andy Shevchenko andy.shevchenko@gmail.com wrote:

>On Thu, Apr 27, 2017 at 9:52 AM, Anatolij Gustschin <agust@denx.de> wrote:
>> Add stubs for gpiod_add_lookup_table() and gpiod_remove_lookup_table()
>> for the !GPIOLIB case to prevent build errors. Also add prototypes.
>>
>> Signed-off-by: Anatolij Gustschin <agust@denx.de>
>> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>  
>
>Oh, has to take my tag back. See below why.
>
>
>> --- a/include/linux/gpio/consumer.h
>> +++ b/include/linux/gpio/consumer.h  
>
>It is already defined in machine.h.
>
>What you basically need is to add stubs for !GPIOLIB case
>
>#ifdef ...
>...existing prototypes...
>#else /* GPIOLIB */
>static inline void gpiod_add_lookup_table(struct gpiod_lookup_table *table) {}
>static inline void gpiod_remove_lookup_table(struct gpiod_lookup_table
>*table) {}
>#endif /* !GPIOLIB */
>
>P.S. please notice how I put the stubs. It would be good to keep them
>in two lines.

this will exceed 80 char line limit.

Thanks,

Anatolij

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web