2015-05-07 08:08:31

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 0/3] leds: leds-gpio: Allow compile test if !GPIOLIB

The GPIO subsystem provides dummy GPIO consumer functions if GPIOLIB is
not enabled. Hence drivers that depend on GPIOLIB, but use GPIO consumer
functionality only, can still be compiled if GPIOLIB is not enabled.

This patch series allows compile testing of the leds-gpio driver if
GPIOLIB is not enabled. This requires adding a missing dummy to gpiolib,
and a missing include to leds-gpio.

This series follows the work started in the series "[PATCH 00/27] gpio:
Allow compile test of GPIO consumers if !GPIOLIB"
(https://lkml.org/lkml/2015/5/5/779), but can be applied independently.

The third patch depends on the first two patches, but it could be folded
into "[PATCH 09/27] leds: Allow compile test of GPIO consumers if
!GPIOLIB" of the series mentioned above, once its dependencies are
satisfied.

Thanks!

Geert Uytterhoeven (3):
gpiolib: Add missing dummies for the unified device properties
interface
leds: leds-gpio: Add missing #include <linux/of.h>
leds: leds-gpio: Allow compile test if !GPIOLIB

drivers/leds/Kconfig | 2 +-
drivers/leds/leds-gpio.c | 1 +
include/linux/gpio/consumer.h | 15 +++++++++++++++
3 files changed, 17 insertions(+), 1 deletion(-)

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


2015-05-07 08:08:23

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 1/3] gpiolib: Add missing dummies for the unified device properties interface

If GPIOLIB=n:

drivers/leds/leds-gpio.c: In function ‘gpio_leds_create’:
drivers/leds/leds-gpio.c:187: error: implicit declaration of function ‘devm_get_gpiod_from_child’
drivers/leds/leds-gpio.c:187: warning: assignment makes pointer from integer without a cast

Add dummies for fwnode_get_named_gpiod() and devm_get_gpiod_from_child()
for the !GPIOLIB case to fix this.

Signed-off-by: Geert Uytterhoeven <[email protected]>
Fixes: 40b7318319281b1b ("gpio: Support for unified device properties interface")
---
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 3a7c9ffd5ab930b4..da042657dc31d7f5 100644
--- a/include/linux/gpio/consumer.h
+++ b/include/linux/gpio/consumer.h
@@ -406,6 +406,21 @@ static inline int desc_to_gpio(const struct gpio_desc *desc)
return -EINVAL;
}

+/* Child properties interface */
+struct fwnode_handle;
+
+static inline struct gpio_desc *fwnode_get_named_gpiod(
+ struct fwnode_handle *fwnode, const char *propname)
+{
+ return ERR_PTR(-ENOSYS);
+}
+
+static inline struct gpio_desc *devm_get_gpiod_from_child(
+ struct device *dev, const char *con_id, struct fwnode_handle *child)
+{
+ return ERR_PTR(-ENOSYS);
+}
+
#endif /* CONFIG_GPIOLIB */

/*
--
1.9.1

2015-05-07 08:08:27

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 2/3] leds: leds-gpio: Add missing #include <linux/of.h>

drivers/leds/leds-gpio.c: In function ‘gpio_leds_create’:
drivers/leds/leds-gpio.c:194: error: implicit declaration of function ‘of_node’
drivers/leds/leds-gpio.c:194: warning: assignment makes pointer from integer without a cast
drivers/leds/leds-gpio.c:200: error: dereferencing pointer to incomplete type

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
drivers/leds/leds-gpio.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index 15eb3f86f670ffe4..89d981e8f8cacf55 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -16,6 +16,7 @@
#include <linux/kernel.h>
#include <linux/leds.h>
#include <linux/module.h>
+#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/slab.h>
--
1.9.1

2015-05-07 08:09:23

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 3/3] leds: leds-gpio: Allow compile test if !GPIOLIB

The GPIO subsystem provides dummy GPIO consumer functions if GPIOLIB is
not enabled. Hence drivers that depend on GPIOLIB, but use GPIO consumer
functionality only, can still be compiled if GPIOLIB is not enabled.

Relax the dependency of LEDS_GPIO on GPIOLIB if COMPILE_TEST is
enabled.

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
This could be folded in "[PATCH 09/27] leds: Allow compile test of GPIO
consumers if !GPIOLIB" once its dependencies are satisfied.
---
drivers/leds/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index 8161cddc3f8d597a..1f6cb38335b52c3c 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -182,7 +182,7 @@ config LEDS_PCA9532_GPIO
config LEDS_GPIO
tristate "LED Support for GPIO connected LEDs"
depends on LEDS_CLASS
- depends on GPIOLIB
+ depends on GPIOLIB || COMPILE_TEST
help
This option enables support for the LEDs connected to GPIO
outputs. To be useful the particular board must have LEDs
--
1.9.1

2015-05-07 12:15:13

by Jacek Anaszewski

[permalink] [raw]
Subject: Re: [PATCH 2/3] leds: leds-gpio: Add missing #include <linux/of.h>

On 05/07/2015 10:08 AM, Geert Uytterhoeven wrote:
> drivers/leds/leds-gpio.c: In function ‘gpio_leds_create’:
> drivers/leds/leds-gpio.c:194: error: implicit declaration of function ‘of_node’
> drivers/leds/leds-gpio.c:194: warning: assignment makes pointer from integer without a cast
> drivers/leds/leds-gpio.c:200: error: dereferencing pointer to incomplete type
>
> Signed-off-by: Geert Uytterhoeven <[email protected]>
> ---
> drivers/leds/leds-gpio.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
> index 15eb3f86f670ffe4..89d981e8f8cacf55 100644
> --- a/drivers/leds/leds-gpio.c
> +++ b/drivers/leds/leds-gpio.c
> @@ -16,6 +16,7 @@
> #include <linux/kernel.h>
> #include <linux/leds.h>
> #include <linux/module.h>
> +#include <linux/of.h>
> #include <linux/platform_device.h>
> #include <linux/property.h>
> #include <linux/slab.h>
>

Acked-by: Jacek Anaszewski <[email protected]>

--
Best Regards,
Jacek Anaszewski

2015-05-07 12:15:35

by Jacek Anaszewski

[permalink] [raw]
Subject: Re: [PATCH 3/3] leds: leds-gpio: Allow compile test if !GPIOLIB

On 05/07/2015 10:08 AM, Geert Uytterhoeven wrote:
> The GPIO subsystem provides dummy GPIO consumer functions if GPIOLIB is
> not enabled. Hence drivers that depend on GPIOLIB, but use GPIO consumer
> functionality only, can still be compiled if GPIOLIB is not enabled.
>
> Relax the dependency of LEDS_GPIO on GPIOLIB if COMPILE_TEST is
> enabled.
>
> Signed-off-by: Geert Uytterhoeven <[email protected]>
> ---
> This could be folded in "[PATCH 09/27] leds: Allow compile test of GPIO
> consumers if !GPIOLIB" once its dependencies are satisfied.
> ---
> drivers/leds/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
> index 8161cddc3f8d597a..1f6cb38335b52c3c 100644
> --- a/drivers/leds/Kconfig
> +++ b/drivers/leds/Kconfig
> @@ -182,7 +182,7 @@ config LEDS_PCA9532_GPIO
> config LEDS_GPIO
> tristate "LED Support for GPIO connected LEDs"
> depends on LEDS_CLASS
> - depends on GPIOLIB
> + depends on GPIOLIB || COMPILE_TEST
> help
> This option enables support for the LEDs connected to GPIO
> outputs. To be useful the particular board must have LEDs
>

Acked-by: Jacek Anaszewski <[email protected]>

--
Best Regards,
Jacek Anaszewski

2015-05-08 17:44:05

by Bryan Wu

[permalink] [raw]
Subject: Re: [PATCH 1/3] gpiolib: Add missing dummies for the unified device properties interface

On Thu, May 7, 2015 at 1:08 AM, Geert Uytterhoeven <[email protected]> wrote:
> If GPIOLIB=n:
>
> drivers/leds/leds-gpio.c: In function ‘gpio_leds_create’:
> drivers/leds/leds-gpio.c:187: error: implicit declaration of function ‘devm_get_gpiod_from_child’
> drivers/leds/leds-gpio.c:187: warning: assignment makes pointer from integer without a cast
>
> Add dummies for fwnode_get_named_gpiod() and devm_get_gpiod_from_child()
> for the !GPIOLIB case to fix this.
>

Geert,

This patch looks good to me. Do you mind merging it through LED tree
with other 2 more LED patches?

Thanks,
-Bryan


> Signed-off-by: Geert Uytterhoeven <[email protected]>
> Fixes: 40b7318319281b1b ("gpio: Support for unified device properties interface")
> ---
> 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 3a7c9ffd5ab930b4..da042657dc31d7f5 100644
> --- a/include/linux/gpio/consumer.h
> +++ b/include/linux/gpio/consumer.h
> @@ -406,6 +406,21 @@ static inline int desc_to_gpio(const struct gpio_desc *desc)
> return -EINVAL;
> }
>
> +/* Child properties interface */
> +struct fwnode_handle;
> +
> +static inline struct gpio_desc *fwnode_get_named_gpiod(
> + struct fwnode_handle *fwnode, const char *propname)
> +{
> + return ERR_PTR(-ENOSYS);
> +}
> +
> +static inline struct gpio_desc *devm_get_gpiod_from_child(
> + struct device *dev, const char *con_id, struct fwnode_handle *child)
> +{
> + return ERR_PTR(-ENOSYS);
> +}
> +
> #endif /* CONFIG_GPIOLIB */
>
> /*
> --
> 1.9.1
>

2015-05-12 07:47:25

by Alexandre Courbot

[permalink] [raw]
Subject: Re: [PATCH 1/3] gpiolib: Add missing dummies for the unified device properties interface

On Thu, May 7, 2015 at 5:08 PM, Geert Uytterhoeven <[email protected]> wrote:
> If GPIOLIB=n:
>
> drivers/leds/leds-gpio.c: In function ‘gpio_leds_create’:
> drivers/leds/leds-gpio.c:187: error: implicit declaration of function ‘devm_get_gpiod_from_child’
> drivers/leds/leds-gpio.c:187: warning: assignment makes pointer from integer without a cast
>
> Add dummies for fwnode_get_named_gpiod() and devm_get_gpiod_from_child()
> for the !GPIOLIB case to fix this.

This was obviously missing.

Acked-by: Alexandre Courbot <[email protected]>

2015-05-12 07:49:02

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH 1/3] gpiolib: Add missing dummies for the unified device properties interface

Hi Bryan,

On Fri, May 8, 2015 at 7:43 PM, Bryan Wu <[email protected]> wrote:
> On Thu, May 7, 2015 at 1:08 AM, Geert Uytterhoeven <[email protected]> wrote:
>> If GPIOLIB=n:
>>
>> drivers/leds/leds-gpio.c: In function ‘gpio_leds_create’:
>> drivers/leds/leds-gpio.c:187: error: implicit declaration of function ‘devm_get_gpiod_from_child’
>> drivers/leds/leds-gpio.c:187: warning: assignment makes pointer from integer without a cast
>>
>> Add dummies for fwnode_get_named_gpiod() and devm_get_gpiod_from_child()
>> for the !GPIOLIB case to fix this.
>
> This patch looks good to me. Do you mind merging it through LED tree
> with other 2 more LED patches?

Now we have an ack from Alex, that's fine for me. Thanks!

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

2015-05-12 10:23:13

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 3/3] leds: leds-gpio: Allow compile test if !GPIOLIB

On Thu, May 7, 2015 at 10:08 AM, Geert Uytterhoeven
<[email protected]> wrote:

> The GPIO subsystem provides dummy GPIO consumer functions if GPIOLIB is
> not enabled. Hence drivers that depend on GPIOLIB, but use GPIO consumer
> functionality only, can still be compiled if GPIOLIB is not enabled.
>
> Relax the dependency of LEDS_GPIO on GPIOLIB if COMPILE_TEST is
> enabled.
>
> Signed-off-by: Geert Uytterhoeven <[email protected]>

Acked-by: Linus Walleij <[email protected]>

Yours,
Linus Walleij

2015-05-12 10:31:39

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 1/3] gpiolib: Add missing dummies for the unified device properties interface

On Thu, May 7, 2015 at 10:08 AM, Geert Uytterhoeven
<[email protected]> wrote:

> If GPIOLIB=n:
>
> drivers/leds/leds-gpio.c: In function ‘gpio_leds_create’:
> drivers/leds/leds-gpio.c:187: error: implicit declaration of function ‘devm_get_gpiod_from_child’
> drivers/leds/leds-gpio.c:187: warning: assignment makes pointer from integer without a cast
>
> Add dummies for fwnode_get_named_gpiod() and devm_get_gpiod_from_child()
> for the !GPIOLIB case to fix this.
>
> Signed-off-by: Geert Uytterhoeven <[email protected]>
> Fixes: 40b7318319281b1b ("gpio: Support for unified device properties interface")

Acked-by: Linus Walleij <[email protected]>

Counting on this to go through the LEDs tree as discussed.

Yours,
Linus Walleij

2015-05-12 17:48:51

by Bryan Wu

[permalink] [raw]
Subject: Re: [PATCH 1/3] gpiolib: Add missing dummies for the unified device properties interface

On Tue, May 12, 2015 at 3:31 AM, Linus Walleij <[email protected]> wrote:
> On Thu, May 7, 2015 at 10:08 AM, Geert Uytterhoeven
> <[email protected]> wrote:
>
>> If GPIOLIB=n:
>>
>> drivers/leds/leds-gpio.c: In function ‘gpio_leds_create’:
>> drivers/leds/leds-gpio.c:187: error: implicit declaration of function ‘devm_get_gpiod_from_child’
>> drivers/leds/leds-gpio.c:187: warning: assignment makes pointer from integer without a cast
>>
>> Add dummies for fwnode_get_named_gpiod() and devm_get_gpiod_from_child()
>> for the !GPIOLIB case to fix this.
>>
>> Signed-off-by: Geert Uytterhoeven <[email protected]>
>> Fixes: 40b7318319281b1b ("gpio: Support for unified device properties interface")
>
> Acked-by: Linus Walleij <[email protected]>
>
> Counting on this to go through the LEDs tree as discussed.
>
> Yours,
> Linus Walleij


OK, merged with Alex and Linus Acks. Thanks,
-Bryan

2015-05-12 17:50:11

by Bryan Wu

[permalink] [raw]
Subject: Re: [PATCH 2/3] leds: leds-gpio: Add missing #include <linux/of.h>

On Thu, May 7, 2015 at 5:15 AM, Jacek Anaszewski
<[email protected]> wrote:
> On 05/07/2015 10:08 AM, Geert Uytterhoeven wrote:
>>
>> drivers/leds/leds-gpio.c: In function ‘gpio_leds_create’:
>> drivers/leds/leds-gpio.c:194: error: implicit declaration of function
>> ‘of_node’
>> drivers/leds/leds-gpio.c:194: warning: assignment makes pointer from
>> integer without a cast
>> drivers/leds/leds-gpio.c:200: error: dereferencing pointer to incomplete
>> type
>>
>> Signed-off-by: Geert Uytterhoeven <[email protected]>
>> ---
>> drivers/leds/leds-gpio.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
>> index 15eb3f86f670ffe4..89d981e8f8cacf55 100644
>> --- a/drivers/leds/leds-gpio.c
>> +++ b/drivers/leds/leds-gpio.c
>> @@ -16,6 +16,7 @@
>> #include <linux/kernel.h>
>> #include <linux/leds.h>
>> #include <linux/module.h>
>> +#include <linux/of.h>
>> #include <linux/platform_device.h>
>> #include <linux/property.h>
>> #include <linux/slab.h>
>>
>
> Acked-by: Jacek Anaszewski <[email protected]>
>

Merged, thanks.
-Bryan

2015-05-12 17:53:42

by Bryan Wu

[permalink] [raw]
Subject: Re: [PATCH 3/3] leds: leds-gpio: Allow compile test if !GPIOLIB

On Tue, May 12, 2015 at 3:23 AM, Linus Walleij <[email protected]> wrote:
> On Thu, May 7, 2015 at 10:08 AM, Geert Uytterhoeven
> <[email protected]> wrote:
>
>> The GPIO subsystem provides dummy GPIO consumer functions if GPIOLIB is
>> not enabled. Hence drivers that depend on GPIOLIB, but use GPIO consumer
>> functionality only, can still be compiled if GPIOLIB is not enabled.
>>
>> Relax the dependency of LEDS_GPIO on GPIOLIB if COMPILE_TEST is
>> enabled.
>>
>> Signed-off-by: Geert Uytterhoeven <[email protected]>
>
> Acked-by: Linus Walleij <[email protected]>
>
> Yours,
> Linus Walleij

Merged, thanks.
-Bryan