2019-09-06 11:12:43

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 0/4] gpio: API boundary cleanups

Hi Linus, Bartosz,

This patch series contains various API boundary cleanups for gpiolib:
- The first two patches make two functions private,
- The last two patches switch the remaining gpiolib exported functions
from EXPORT_SYMBOL() to EXPORT_SYMBOL_GPL().

After this there is only a single GPIO driver function exported with
EXPORT_SYMBOL();

drivers/gpio/gpio-htc-egpio.c:EXPORT_SYMBOL(htc_egpio_get_wakeup_irq);

I believe this symbol was never used upstream, and may be a relic of the
original out-of-tree code the htc-egpio was based on. I don't know if
there (still) exist out-of-tree users of the symbol.

Thanks for your comments!

Geert Uytterhoeven (4):
gpio: of: Make of_get_named_gpiod_flags() private
gpio: of: Make of_gpio_simple_xlate() private
gpio: of: Switch to EXPORT_SYMBOL_GPL()
gpio: devres: Switch to EXPORT_SYMBOL_GPL()

drivers/gpio/gpiolib-devres.c | 28 ++++++++++++++--------------
drivers/gpio/gpiolib-of.c | 16 ++++++++--------
drivers/gpio/gpiolib-of.h | 7 -------
include/linux/of_gpio.h | 11 -----------
4 files changed, 22 insertions(+), 40 deletions(-)

--
2.17.1

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


2019-09-06 14:13:50

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 3/4] gpio: of: Switch to EXPORT_SYMBOL_GPL()

All exported functions provide genuine Linux-specific functionality.

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
drivers/gpio/gpiolib-of.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index fad3aad667558325..7aea6d0f3ace9b82 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -274,7 +274,7 @@ int of_get_named_gpio_flags(struct device_node *np, const char *list_name,
else
return desc_to_gpio(desc);
}
-EXPORT_SYMBOL(of_get_named_gpio_flags);
+EXPORT_SYMBOL_GPL(of_get_named_gpio_flags);

/**
* gpiod_get_from_of_node() - obtain a GPIO from an OF node
@@ -343,7 +343,7 @@ struct gpio_desc *gpiod_get_from_of_node(struct device_node *node,

return desc;
}
-EXPORT_SYMBOL(gpiod_get_from_of_node);
+EXPORT_SYMBOL_GPL(gpiod_get_from_of_node);

/*
* The SPI GPIO bindings happened before we managed to establish that GPIO
@@ -719,7 +719,7 @@ int of_mm_gpiochip_add_data(struct device_node *np,
pr_err("%pOF: GPIO chip registration failed with status %d\n", np, ret);
return ret;
}
-EXPORT_SYMBOL(of_mm_gpiochip_add_data);
+EXPORT_SYMBOL_GPL(of_mm_gpiochip_add_data);

/**
* of_mm_gpiochip_remove - Remove memory mapped GPIO chip (bank)
@@ -736,7 +736,7 @@ void of_mm_gpiochip_remove(struct of_mm_gpio_chip *mm_gc)
iounmap(mm_gc->regs);
kfree(gc->label);
}
-EXPORT_SYMBOL(of_mm_gpiochip_remove);
+EXPORT_SYMBOL_GPL(of_mm_gpiochip_remove);

static void of_gpiochip_init_valid_mask(struct gpio_chip *chip)
{
--
2.17.1

2019-09-06 14:14:01

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 2/4] gpio: of: Make of_gpio_simple_xlate() private

Since commit 9a95e8d25a140ba9 ("gpio: remove etraxfs driver"), there are
no more users of of_gpio_simple_xlate() outside gpiolib-of.c.
All GPIO drivers that need it now rely on of_gpiochip_add() setting it
up as the default translate function.

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
drivers/gpio/gpiolib-of.c | 6 +++---
include/linux/of_gpio.h | 11 -----------
2 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index 4c6b366cb7bd5cd0..fad3aad667558325 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -637,8 +637,9 @@ static int of_gpiochip_scan_gpios(struct gpio_chip *chip)
* GPIO chips. This function performs only one sanity check: whether GPIO
* is less than ngpios (that is specified in the gpio_chip).
*/
-int of_gpio_simple_xlate(struct gpio_chip *gc,
- const struct of_phandle_args *gpiospec, u32 *flags)
+static int of_gpio_simple_xlate(struct gpio_chip *gc,
+ const struct of_phandle_args *gpiospec,
+ u32 *flags)
{
/*
* We're discouraging gpio_cells < 2, since that way you'll have to
@@ -662,7 +663,6 @@ int of_gpio_simple_xlate(struct gpio_chip *gc,

return gpiospec->args[0];
}
-EXPORT_SYMBOL(of_gpio_simple_xlate);

/**
* of_mm_gpiochip_add_data - Add memory mapped GPIO chip (bank)
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
index f9737dea9d1f945a..16967390a3fe3b12 100644
--- a/include/linux/of_gpio.h
+++ b/include/linux/of_gpio.h
@@ -61,10 +61,6 @@ static inline int of_mm_gpiochip_add(struct device_node *np,
}
extern void of_mm_gpiochip_remove(struct of_mm_gpio_chip *mm_gc);

-extern int of_gpio_simple_xlate(struct gpio_chip *gc,
- const struct of_phandle_args *gpiospec,
- u32 *flags);
-
#else /* CONFIG_OF_GPIO */

/* Drivers may not strictly depend on the GPIO support, so let them link. */
@@ -77,13 +73,6 @@ static inline int of_get_named_gpio_flags(struct device_node *np,
return -ENOSYS;
}

-static inline int of_gpio_simple_xlate(struct gpio_chip *gc,
- const struct of_phandle_args *gpiospec,
- u32 *flags)
-{
- return -ENOSYS;
-}
-
#endif /* CONFIG_OF_GPIO */

/**
--
2.17.1

2019-09-10 11:58:45

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH 0/4] gpio: API boundary cleanups

Hi Bartosz,

On Tue, Sep 10, 2019 at 10:51 AM Bartosz Golaszewski
<[email protected]> wrote:
> pt., 6 wrz 2019 o 10:45 Geert Uytterhoeven <[email protected]> napisał(a):
> > This patch series contains various API boundary cleanups for gpiolib:
> > - The first two patches make two functions private,
> > - The last two patches switch the remaining gpiolib exported functions
> > from EXPORT_SYMBOL() to EXPORT_SYMBOL_GPL().
> >
> > After this there is only a single GPIO driver function exported with
> > EXPORT_SYMBOL();
> >
> > drivers/gpio/gpio-htc-egpio.c:EXPORT_SYMBOL(htc_egpio_get_wakeup_irq);
> >
> > I believe this symbol was never used upstream, and may be a relic of the
> > original out-of-tree code the htc-egpio was based on. I don't know if
> > there (still) exist out-of-tree users of the symbol.
> >
> > Thanks for your comments!
>
> All looks good to me. Are you fine with this being picked up after the
> v5.4 merge window?

Sure, whatever suits you best.

Thanks!

> > Geert Uytterhoeven (4):
> > gpio: of: Make of_get_named_gpiod_flags() private
> > gpio: of: Make of_gpio_simple_xlate() private
> > gpio: of: Switch to EXPORT_SYMBOL_GPL()
> > gpio: devres: Switch to EXPORT_SYMBOL_GPL()

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2019-09-10 18:53:13

by Bartosz Golaszewski

[permalink] [raw]
Subject: Re: [PATCH 0/4] gpio: API boundary cleanups

pt., 6 wrz 2019 o 10:45 Geert Uytterhoeven <[email protected]> napisał(a):
>
> Hi Linus, Bartosz,
>
> This patch series contains various API boundary cleanups for gpiolib:
> - The first two patches make two functions private,
> - The last two patches switch the remaining gpiolib exported functions
> from EXPORT_SYMBOL() to EXPORT_SYMBOL_GPL().
>
> After this there is only a single GPIO driver function exported with
> EXPORT_SYMBOL();
>
> drivers/gpio/gpio-htc-egpio.c:EXPORT_SYMBOL(htc_egpio_get_wakeup_irq);
>
> I believe this symbol was never used upstream, and may be a relic of the
> original out-of-tree code the htc-egpio was based on. I don't know if
> there (still) exist out-of-tree users of the symbol.
>
> Thanks for your comments!

All looks good to me. Are you fine with this being picked up after the
v5.4 merge window?

Bart

>
> Geert Uytterhoeven (4):
> gpio: of: Make of_get_named_gpiod_flags() private
> gpio: of: Make of_gpio_simple_xlate() private
> gpio: of: Switch to EXPORT_SYMBOL_GPL()
> gpio: devres: Switch to EXPORT_SYMBOL_GPL()
>
> drivers/gpio/gpiolib-devres.c | 28 ++++++++++++++--------------
> drivers/gpio/gpiolib-of.c | 16 ++++++++--------
> drivers/gpio/gpiolib-of.h | 7 -------
> include/linux/of_gpio.h | 11 -----------
> 4 files changed, 22 insertions(+), 40 deletions(-)
>
> --
> 2.17.1
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
> -- Linus Torvalds

2019-09-10 18:56:32

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 0/4] gpio: API boundary cleanups

On Fri, Sep 6, 2019 at 9:45 AM Geert Uytterhoeven
<[email protected]> wrote:

> This patch series contains various API boundary cleanups for gpiolib:
> - The first two patches make two functions private,
> - The last two patches switch the remaining gpiolib exported functions
> from EXPORT_SYMBOL() to EXPORT_SYMBOL_GPL().

Good stuff, let's merge for early v5.4 (possibly rebasing if necessary).

> After this there is only a single GPIO driver function exported with
> EXPORT_SYMBOL();
>
> drivers/gpio/gpio-htc-egpio.c:EXPORT_SYMBOL(htc_egpio_get_wakeup_irq);

Kill it. People using this platform should step up if they need it.
The outoftree code was at handhelds.org and that web site is
even down. There is a copy of their git tree on github
somewhere but it is definately not maintained.

Yours,
Linus Walleij

2019-09-11 13:50:08

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 3/4] gpio: of: Switch to EXPORT_SYMBOL_GPL()

On Fri, Sep 6, 2019 at 9:45 AM Geert Uytterhoeven
<[email protected]> wrote:

> All exported functions provide genuine Linux-specific functionality.
>
> Signed-off-by: Geert Uytterhoeven <[email protected]>

Patch applied.

Yours,
Linus Walleij

2019-09-11 13:51:22

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 2/4] gpio: of: Make of_gpio_simple_xlate() private

On Fri, Sep 6, 2019 at 9:45 AM Geert Uytterhoeven
<[email protected]> wrote:

> Since commit 9a95e8d25a140ba9 ("gpio: remove etraxfs driver"), there are
> no more users of of_gpio_simple_xlate() outside gpiolib-of.c.
> All GPIO drivers that need it now rely on of_gpiochip_add() setting it
> up as the default translate function.
>
> Signed-off-by: Geert Uytterhoeven <[email protected]>

Patch applied.

Yours,
Linus Walleij