linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: export add/remove lookup table functions
@ 2017-04-20 21:23 Anatolij Gustschin
  2017-04-21 19:24 ` Andy Shevchenko
  2017-05-22  8:58 ` Linus Walleij
  0 siblings, 2 replies; 6+ messages in thread
From: Anatolij Gustschin @ 2017-04-20 21:23 UTC (permalink / raw)
  To: linux-gpio; +Cc: linux-kernel, Linus Walleij, Alexandre Courbot

For hot-pluggable devices adding GPIOs dynamically we need to
assemble and add the gpio lookup tables at probe time in modules,
so that requesting these GPIOs in attached drivers can work.
Export lookup table functions for modules.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
 drivers/gpio/gpiolib.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 4aa1e78..9196b1e 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -3008,6 +3008,7 @@ void gpiod_add_lookup_table(struct gpiod_lookup_table *table)
 
 	mutex_unlock(&gpio_lookup_lock);
 }
+EXPORT_SYMBOL_GPL(gpiod_add_lookup_table);
 
 /**
  * gpiod_remove_lookup_table() - unregister GPIO device consumers
@@ -3021,6 +3022,7 @@ void gpiod_remove_lookup_table(struct gpiod_lookup_table *table)
 
 	mutex_unlock(&gpio_lookup_lock);
 }
+EXPORT_SYMBOL_GPL(gpiod_remove_lookup_table);
 
 static struct gpiod_lookup_table *gpiod_find_lookup_table(struct device *dev)
 {
-- 
2.7.4

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

* Re: [PATCH] gpio: export add/remove lookup table functions
  2017-04-20 21:23 [PATCH] gpio: export add/remove lookup table functions Anatolij Gustschin
@ 2017-04-21 19:24 ` Andy Shevchenko
  2017-04-24 14:04   ` [PATCH] gpiolib: Add stubs for gpiod lookup table interface Anatolij Gustschin
  2017-04-24 14:08   ` [PATCH] gpio: export add/remove lookup table functions Anatolij Gustschin
  2017-05-22  8:58 ` Linus Walleij
  1 sibling, 2 replies; 6+ messages in thread
From: Andy Shevchenko @ 2017-04-21 19:24 UTC (permalink / raw)
  To: Anatolij Gustschin
  Cc: linux-gpio, linux-kernel, Linus Walleij, Alexandre Courbot

On Fri, Apr 21, 2017 at 12:23 AM, Anatolij Gustschin <agust@denx.de> wrote:
> For hot-pluggable devices adding GPIOs dynamically we need to
> assemble and add the gpio lookup tables at probe time in modules,
> so that requesting these GPIOs in attached drivers can work.
> Export lookup table functions for modules.
>
> Signed-off-by: Anatolij Gustschin <agust@denx.de>

...and still a question "Do we go with stubs for them in case of !GPIOLIB?"

Patch below looks good to me:
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> ---
>  drivers/gpio/gpiolib.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index 4aa1e78..9196b1e 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -3008,6 +3008,7 @@ void gpiod_add_lookup_table(struct gpiod_lookup_table *table)
>
>         mutex_unlock(&gpio_lookup_lock);
>  }
> +EXPORT_SYMBOL_GPL(gpiod_add_lookup_table);
>
>  /**
>   * gpiod_remove_lookup_table() - unregister GPIO device consumers
> @@ -3021,6 +3022,7 @@ void gpiod_remove_lookup_table(struct gpiod_lookup_table *table)
>
>         mutex_unlock(&gpio_lookup_lock);
>  }
> +EXPORT_SYMBOL_GPL(gpiod_remove_lookup_table);
>
>  static struct gpiod_lookup_table *gpiod_find_lookup_table(struct device *dev)
>  {
> --
> 2.7.4
>



-- 
With Best Regards,
Andy Shevchenko

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

* [PATCH] gpiolib: Add stubs for gpiod lookup table interface
  2017-04-21 19:24 ` Andy Shevchenko
@ 2017-04-24 14:04   ` Anatolij Gustschin
  2017-04-26 21:31     ` Andy Shevchenko
  2017-04-24 14:08   ` [PATCH] gpio: export add/remove lookup table functions Anatolij Gustschin
  1 sibling, 1 reply; 6+ messages in thread
From: Anatolij Gustschin @ 2017-04-24 14:04 UTC (permalink / raw)
  To: linux-gpio
  Cc: Linus Walleij, Alexandre Courbot, Andy Shevchenko, linux-kernel

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>
---
 include/linux/gpio/consumer.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h
index 933d936..6c0cc67 100644
--- a/include/linux/gpio/consumer.h
+++ b/include/linux/gpio/consumer.h
@@ -144,6 +144,11 @@ struct gpio_desc *devm_fwnode_get_index_gpiod_from_child(struct device *dev,
 						enum gpiod_flags flags,
 						const char *label);
 
+struct gpiod_lookup_table;
+
+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,16 @@ struct gpio_desc *devm_fwnode_get_index_gpiod_from_child(struct device *dev,
 	return ERR_PTR(-ENOSYS);
 }
 
+struct gpiod_lookup_table;
+
+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

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

* Re: [PATCH] gpio: export add/remove lookup table functions
  2017-04-21 19:24 ` Andy Shevchenko
  2017-04-24 14:04   ` [PATCH] gpiolib: Add stubs for gpiod lookup table interface Anatolij Gustschin
@ 2017-04-24 14:08   ` Anatolij Gustschin
  1 sibling, 0 replies; 6+ messages in thread
From: Anatolij Gustschin @ 2017-04-24 14:08 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-gpio, linux-kernel, Linus Walleij, Alexandre Courbot

On Fri, 21 Apr 2017 22:24:49 +0300
Andy Shevchenko andy.shevchenko@gmail.com wrote:
...
>...and still a question "Do we go with stubs for them in case of !GPIOLIB?"

I've just sent a patch.

>Patch below looks good to me:

Thanks for review!

Anatolij

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

* Re: [PATCH] gpiolib: Add stubs for gpiod lookup table interface
  2017-04-24 14:04   ` [PATCH] gpiolib: Add stubs for gpiod lookup table interface Anatolij Gustschin
@ 2017-04-26 21:31     ` Andy Shevchenko
  0 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2017-04-26 21:31 UTC (permalink / raw)
  To: Anatolij Gustschin
  Cc: linux-gpio, Linus Walleij, Alexandre Courbot, linux-kernel

On Mon, Apr 24, 2017 at 5:04 PM, 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.

One nit below, otherwise
FWIW:
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

Linus, it would be nice if are okay with this approach. It will fix
that one user which might break a buiid on some kernel configurations.

>
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> ---
>  include/linux/gpio/consumer.h | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h
> index 933d936..6c0cc67 100644
> --- a/include/linux/gpio/consumer.h
> +++ b/include/linux/gpio/consumer.h
> @@ -144,6 +144,11 @@ struct gpio_desc *devm_fwnode_get_index_gpiod_from_child(struct device *dev,
>                                                 enum gpiod_flags flags,
>                                                 const char *label);

> +struct gpiod_lookup_table;

>  #else /* CONFIG_GPIOLIB */

> +struct gpiod_lookup_table;

No need to duplicate this. Just move out of #ifdef.

-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH] gpio: export add/remove lookup table functions
  2017-04-20 21:23 [PATCH] gpio: export add/remove lookup table functions Anatolij Gustschin
  2017-04-21 19:24 ` Andy Shevchenko
@ 2017-05-22  8:58 ` Linus Walleij
  1 sibling, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2017-05-22  8:58 UTC (permalink / raw)
  To: Anatolij Gustschin; +Cc: linux-gpio, linux-kernel, Alexandre Courbot

On Thu, Apr 20, 2017 at 11:23 PM, Anatolij Gustschin <agust@denx.de> wrote:

> For hot-pluggable devices adding GPIOs dynamically we need to
> assemble and add the gpio lookup tables at probe time in modules,
> so that requesting these GPIOs in attached drivers can work.
> Export lookup table functions for modules.
>
> Signed-off-by: Anatolij Gustschin <agust@denx.de>

Patch applied with Andy's Review tag, sorry for missing it,
it was indeed sent to me I just randomly forgot the patch.

Yours,
Linus Walleij

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

end of thread, other threads:[~2017-05-22  8:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-20 21:23 [PATCH] gpio: export add/remove lookup table functions Anatolij Gustschin
2017-04-21 19:24 ` Andy Shevchenko
2017-04-24 14:04   ` [PATCH] gpiolib: Add stubs for gpiod lookup table interface Anatolij Gustschin
2017-04-26 21:31     ` Andy Shevchenko
2017-04-24 14:08   ` [PATCH] gpio: export add/remove lookup table functions Anatolij Gustschin
2017-05-22  8:58 ` Linus Walleij

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).