2013-10-20 22:15:11

by Alexandre Courbot

[permalink] [raw]
Subject: [PATCH 0/3] Fixup patches for gpiod interface

These patches fix a few issues of the gpiod series highlighted by the
autobuild system. They take root in the fact that devres.c was compiled
even when gpiolib is not to be built, which should obviously not happen.
But they also reveal missing includes in the same file, and sparse also
pointed out a suspiscious line that happened to be completely wrong.

Patch 1/3 and 2/3 can be applied on their own, but would probably better
be squashed into bae48da2 "add gpiod_get() and gpiod_put() functions".

Patch 3/3 stands on its own, and should preferably be applied before the
rest of the gpiod series. It would not hurt to apply it after if 1/3 and
2/3 are properly squashed.

Apologies for these issues that could have been caught earlier had I been
less negligent.

Alexandre Courbot (3):
gpiolib: devres: fix devm_gpiod_get_index()
gpiolib: devres: add missing headers
gpiolib: make GPIO_DEVRES depend on GPIOLIB

drivers/gpio/Kconfig | 8 ++++----
drivers/gpio/devres.c | 4 +++-
2 files changed, 7 insertions(+), 5 deletions(-)

--
1.8.4.1


2013-10-20 22:15:15

by Alexandre Courbot

[permalink] [raw]
Subject: [PATCH 3/3] gpiolib: make GPIO_DEVRES depend on GPIOLIB

Current Kconfig allows GPIO_DEVRES to be selected and compiled without
GPIOLIB. This does not make sense anymore since GPIOLIB has become the
exclusive way to deal with GPIOs. This patch makes GPIO_DEVRES available
only if GPIOLIB is selected.

Signed-off-by: Alexandre Courbot <[email protected]>
---
drivers/gpio/Kconfig | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 92e258c..62eb9ef 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -30,10 +30,6 @@ config ARCH_REQUIRE_GPIOLIB
Selecting this from the architecture code will cause the gpiolib
code to always get built in.

-config GPIO_DEVRES
- def_bool y
- depends on HAS_IOMEM
-

menuconfig GPIOLIB
bool "GPIO Support"
@@ -47,6 +43,10 @@ menuconfig GPIOLIB

if GPIOLIB

+config GPIO_DEVRES
+ def_bool y
+ depends on HAS_IOMEM
+
config OF_GPIO
def_bool y
depends on OF
--
1.8.4.1

2013-10-20 22:15:14

by Alexandre Courbot

[permalink] [raw]
Subject: [PATCH 2/3] gpiolib: devres: add missing headers

Add missing headers for drivers/gpiolib/devres.c.

Signed-off-by: Alexandre Courbot <[email protected]>
---
drivers/gpio/devres.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/gpio/devres.c b/drivers/gpio/devres.c
index fceebdc..307464f 100644
--- a/drivers/gpio/devres.c
+++ b/drivers/gpio/devres.c
@@ -15,7 +15,9 @@
*/

#include <linux/module.h>
+#include <linux/err.h>
#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
#include <linux/device.h>
#include <linux/gfp.h>

--
1.8.4.1

2013-10-20 22:15:12

by Alexandre Courbot

[permalink] [raw]
Subject: [PATCH 1/3] gpiolib: devres: fix devm_gpiod_get_index()

Fix the return value if devm_gpiod_get_index(). It was returning 0 while
it should return the obtained GPIO descriptor.

Signed-off-by: Alexandre Courbot <[email protected]>
---
drivers/gpio/devres.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/devres.c b/drivers/gpio/devres.c
index 2caa257..fceebdc 100644
--- a/drivers/gpio/devres.c
+++ b/drivers/gpio/devres.c
@@ -80,7 +80,7 @@ struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev,
*dr = desc;
devres_add(dev, dr);

- return 0;
+ return desc;
}
EXPORT_SYMBOL(devm_gpiod_get_index);

--
1.8.4.1

2013-10-23 08:09:58

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 1/3] gpiolib: devres: fix devm_gpiod_get_index()

On Mon, Oct 21, 2013 at 12:14 AM, Alexandre Courbot <[email protected]> wrote:

> Fix the return value if devm_gpiod_get_index(). It was returning 0 while
> it should return the obtained GPIO descriptor.
>
> Signed-off-by: Alexandre Courbot <[email protected]>

Patch applied.

Yours,
Linus Walleij

2013-10-23 08:13:32

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 3/3] gpiolib: make GPIO_DEVRES depend on GPIOLIB

On Mon, Oct 21, 2013 at 12:14 AM, Alexandre Courbot <[email protected]> wrote:

> Current Kconfig allows GPIO_DEVRES to be selected and compiled without
> GPIOLIB. This does not make sense anymore since GPIOLIB has become the
> exclusive way to deal with GPIOs. This patch makes GPIO_DEVRES available
> only if GPIOLIB is selected.
>
> Signed-off-by: Alexandre Courbot <[email protected]>

Hm, I wonder about this. Are, or where there ever consumers of generic
GPIO using devres without gpiolib?

Yours,
Linus Walleij

2013-10-23 08:14:35

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 3/3] gpiolib: make GPIO_DEVRES depend on GPIOLIB

On Wed, Oct 23, 2013 at 10:13 AM, Linus Walleij
<[email protected]> wrote:
> On Mon, Oct 21, 2013 at 12:14 AM, Alexandre Courbot <[email protected]> wrote:
>
>> Current Kconfig allows GPIO_DEVRES to be selected and compiled without
>> GPIOLIB. This does not make sense anymore since GPIOLIB has become the
>> exclusive way to deal with GPIOs. This patch makes GPIO_DEVRES available
>> only if GPIOLIB is selected.
>>
>> Signed-off-by: Alexandre Courbot <[email protected]>
>
> Hm, I wonder about this. Are, or where there ever consumers of generic
> GPIO using devres without gpiolib?

However I've applied the patch so we can see what happens, what
other way is there to test it...

Yours,
Linus Walleij