* [PATCH] gpio: make of_get_named_gpiod_flags() private
@ 2014-05-04 3:45 Alexandre Courbot
2014-05-13 8:39 ` Linus Walleij
2014-05-13 13:17 ` Linus Walleij
0 siblings, 2 replies; 8+ messages in thread
From: Alexandre Courbot @ 2014-05-04 3:45 UTC (permalink / raw)
To: Linus Walleij; +Cc: linux-gpio, linux-kernel, Alexandre Courbot
of_get_named_gpiod_flags() is visible and directly usable by GPIO
consumers, but it really should not as the gpiod interface relies
on the simpler gpiod_get() to provide properly-configured GPIOs.
of_get_named_gpiod_flags() is just used internally by gpiolib to
implement gpiod_get(), and by the old of_get_named_gpio_flags()
function, therefore it makes sense to make it gpiolib-private.
As a side-effect, the unused (and unneeded) of_get_gpiod_flags()
inline function is also removed, and of_get_named_gpio_flags() is moved
from a static inline function to a regular one in gpiolib-of.c
This results in all references to gpiod_* functions in of_gpio.h being
gone, which is the way it should be since this file is part of the old
integer GPIO interface.
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
drivers/gpio/gpiolib-of.c | 14 ++++++++++++++
drivers/gpio/gpiolib.h | 3 +++
include/linux/of_gpio.h | 39 ++-------------------------------------
3 files changed, 19 insertions(+), 37 deletions(-)
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index db98d3a..af7e25c 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -96,6 +96,20 @@ struct gpio_desc *of_get_named_gpiod_flags(struct device_node *np,
}
EXPORT_SYMBOL(of_get_named_gpiod_flags);
+int of_get_named_gpio_flags(struct device_node *np, const char *list_name,
+ int index, enum of_gpio_flags *flags)
+{
+ struct gpio_desc *desc;
+
+ desc = of_get_named_gpiod_flags(np, list_name, index, flags);
+
+ if (IS_ERR(desc))
+ return PTR_ERR(desc);
+ else
+ return desc_to_gpio(desc);
+}
+EXPORT_SYMBOL(of_get_named_gpio_flags);
+
/**
* of_gpio_simple_xlate - translate gpio_spec to the GPIO number and flags
* @gc: pointer to the gpio_chip structure
diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h
index cf09294..f75c82e 100644
--- a/drivers/gpio/gpiolib.h
+++ b/drivers/gpio/gpiolib.h
@@ -46,4 +46,7 @@ acpi_get_gpiod_by_index(struct device *dev, int index,
int gpiochip_request_own_desc(struct gpio_desc *desc, const char *label);
void gpiochip_free_own_desc(struct gpio_desc *desc);
+struct gpio_desc *of_get_named_gpiod_flags(struct device_node *np,
+ const char *list_name, int index, enum of_gpio_flags *flags);
+
#endif /* GPIOLIB_H */
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
index f14123a..123883c 100644
--- a/include/linux/of_gpio.h
+++ b/include/linux/of_gpio.h
@@ -19,7 +19,6 @@
#include <linux/errno.h>
#include <linux/gpio.h>
#include <linux/of.h>
-#include <linux/gpio/consumer.h>
struct device_node;
@@ -48,9 +47,6 @@ static inline struct of_mm_gpio_chip *to_of_mm_gpio_chip(struct gpio_chip *gc)
return container_of(gc, struct of_mm_gpio_chip, gc);
}
-extern struct gpio_desc *of_get_named_gpiod_flags(struct device_node *np,
- const char *list_name, int index, enum of_gpio_flags *flags);
-
extern int of_mm_gpiochip_add(struct device_node *np,
struct of_mm_gpio_chip *mm_gc);
@@ -63,12 +59,6 @@ extern int of_gpio_simple_xlate(struct gpio_chip *gc,
#else /* CONFIG_OF_GPIO */
/* Drivers may not strictly depend on the GPIO support, so let them link. */
-static inline struct gpio_desc *of_get_named_gpiod_flags(struct device_node *np,
- const char *list_name, int index, enum of_gpio_flags *flags)
-{
- return ERR_PTR(-ENOSYS);
-}
-
static inline int of_gpio_simple_xlate(struct gpio_chip *gc,
const struct of_phandle_args *gpiospec,
u32 *flags)
@@ -81,17 +71,8 @@ static inline void of_gpiochip_remove(struct gpio_chip *gc) { }
#endif /* CONFIG_OF_GPIO */
-static inline int of_get_named_gpio_flags(struct device_node *np,
- const char *list_name, int index, enum of_gpio_flags *flags)
-{
- struct gpio_desc *desc;
- desc = of_get_named_gpiod_flags(np, list_name, index, flags);
-
- if (IS_ERR(desc))
- return PTR_ERR(desc);
- else
- return desc_to_gpio(desc);
-}
+extern int of_get_named_gpio_flags(struct device_node *np,
+ const char *list_name, int index, enum of_gpio_flags *flags);
/**
* of_gpio_named_count() - Count GPIOs for a device
@@ -129,22 +110,6 @@ static inline int of_gpio_count(struct device_node *np)
return of_gpio_named_count(np, "gpios");
}
-/**
- * of_get_gpiod_flags() - Get a GPIO descriptor and flags to use with GPIO API
- * @np: device node to get GPIO from
- * @index: index of the GPIO
- * @flags: a flags pointer to fill in
- *
- * Returns GPIO descriptor to use with Linux generic GPIO API, or a errno
- * value on the error condition. If @flags is not NULL the function also fills
- * in flags for the GPIO.
- */
-static inline struct gpio_desc *of_get_gpiod_flags(struct device_node *np,
- int index, enum of_gpio_flags *flags)
-{
- return of_get_named_gpiod_flags(np, "gpios", index, flags);
-}
-
static inline int of_get_gpio_flags(struct device_node *np, int index,
enum of_gpio_flags *flags)
{
--
1.9.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] gpio: make of_get_named_gpiod_flags() private
2014-05-04 3:45 [PATCH] gpio: make of_get_named_gpiod_flags() private Alexandre Courbot
@ 2014-05-13 8:39 ` Linus Walleij
2014-05-13 13:17 ` Linus Walleij
1 sibling, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2014-05-13 8:39 UTC (permalink / raw)
To: Alexandre Courbot; +Cc: linux-gpio, linux-kernel
On Sun, May 4, 2014 at 5:45 AM, Alexandre Courbot <acourbot@nvidia.com> wrote:
> of_get_named_gpiod_flags() is visible and directly usable by GPIO
> consumers, but it really should not as the gpiod interface relies
> on the simpler gpiod_get() to provide properly-configured GPIOs.
>
> of_get_named_gpiod_flags() is just used internally by gpiolib to
> implement gpiod_get(), and by the old of_get_named_gpio_flags()
> function, therefore it makes sense to make it gpiolib-private.
>
> As a side-effect, the unused (and unneeded) of_get_gpiod_flags()
> inline function is also removed, and of_get_named_gpio_flags() is moved
> from a static inline function to a regular one in gpiolib-of.c
>
> This results in all references to gpiod_* functions in of_gpio.h being
> gone, which is the way it should be since this file is part of the old
> integer GPIO interface.
>
> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Nice. Patch applied!
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] gpio: make of_get_named_gpiod_flags() private
2014-05-04 3:45 [PATCH] gpio: make of_get_named_gpiod_flags() private Alexandre Courbot
2014-05-13 8:39 ` Linus Walleij
@ 2014-05-13 13:17 ` Linus Walleij
2014-05-13 13:23 ` Alexandre Courbot
1 sibling, 1 reply; 8+ messages in thread
From: Linus Walleij @ 2014-05-13 13:17 UTC (permalink / raw)
To: Alexandre Courbot; +Cc: linux-gpio, linux-kernel
On Sun, May 4, 2014 at 5:45 AM, Alexandre Courbot <acourbot@nvidia.com> wrote:
> of_get_named_gpiod_flags() is visible and directly usable by GPIO
> consumers, but it really should not as the gpiod interface relies
> on the simpler gpiod_get() to provide properly-configured GPIOs.
>
> of_get_named_gpiod_flags() is just used internally by gpiolib to
> implement gpiod_get(), and by the old of_get_named_gpio_flags()
> function, therefore it makes sense to make it gpiolib-private.
>
> As a side-effect, the unused (and unneeded) of_get_gpiod_flags()
> inline function is also removed, and of_get_named_gpio_flags() is moved
> from a static inline function to a regular one in gpiolib-of.c
>
> This results in all references to gpiod_* functions in of_gpio.h being
> gone, which is the way it should be since this file is part of the old
> integer GPIO interface.
>
> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
This patch broke a lot of drivers so I had to take it out again...
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] gpio: make of_get_named_gpiod_flags() private
2014-05-13 13:17 ` Linus Walleij
@ 2014-05-13 13:23 ` Alexandre Courbot
2014-05-14 2:11 ` Alexandre Courbot
2014-05-16 15:25 ` Linus Walleij
0 siblings, 2 replies; 8+ messages in thread
From: Alexandre Courbot @ 2014-05-13 13:23 UTC (permalink / raw)
To: Linus Walleij; +Cc: Alexandre Courbot, linux-gpio, linux-kernel
On Tue, May 13, 2014 at 10:17 PM, Linus Walleij
<linus.walleij@linaro.org> wrote:
> On Sun, May 4, 2014 at 5:45 AM, Alexandre Courbot <acourbot@nvidia.com> wrote:
>
>> of_get_named_gpiod_flags() is visible and directly usable by GPIO
>> consumers, but it really should not as the gpiod interface relies
>> on the simpler gpiod_get() to provide properly-configured GPIOs.
>>
>> of_get_named_gpiod_flags() is just used internally by gpiolib to
>> implement gpiod_get(), and by the old of_get_named_gpio_flags()
>> function, therefore it makes sense to make it gpiolib-private.
>>
>> As a side-effect, the unused (and unneeded) of_get_gpiod_flags()
>> inline function is also removed, and of_get_named_gpio_flags() is moved
>> from a static inline function to a regular one in gpiolib-of.c
>>
>> This results in all references to gpiod_* functions in of_gpio.h being
>> gone, which is the way it should be since this file is part of the old
>> integer GPIO interface.
>>
>> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
>
> This patch broke a lot of drivers so I had to take it out again...
That's unexpected - what happens with it?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] gpio: make of_get_named_gpiod_flags() private
2014-05-13 13:23 ` Alexandre Courbot
@ 2014-05-14 2:11 ` Alexandre Courbot
2014-05-16 15:25 ` Linus Walleij
1 sibling, 0 replies; 8+ messages in thread
From: Alexandre Courbot @ 2014-05-14 2:11 UTC (permalink / raw)
To: Linus Walleij; +Cc: Alexandre Courbot, linux-gpio, linux-kernel
On Tue, May 13, 2014 at 10:23 PM, Alexandre Courbot <gnurou@gmail.com> wrote:
> On Tue, May 13, 2014 at 10:17 PM, Linus Walleij
> <linus.walleij@linaro.org> wrote:
>> On Sun, May 4, 2014 at 5:45 AM, Alexandre Courbot <acourbot@nvidia.com> wrote:
>>
>>> of_get_named_gpiod_flags() is visible and directly usable by GPIO
>>> consumers, but it really should not as the gpiod interface relies
>>> on the simpler gpiod_get() to provide properly-configured GPIOs.
>>>
>>> of_get_named_gpiod_flags() is just used internally by gpiolib to
>>> implement gpiod_get(), and by the old of_get_named_gpio_flags()
>>> function, therefore it makes sense to make it gpiolib-private.
>>>
>>> As a side-effect, the unused (and unneeded) of_get_gpiod_flags()
>>> inline function is also removed, and of_get_named_gpio_flags() is moved
>>> from a static inline function to a regular one in gpiolib-of.c
>>>
>>> This results in all references to gpiod_* functions in of_gpio.h being
>>> gone, which is the way it should be since this file is part of the old
>>> integer GPIO interface.
>>>
>>> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
>>
>> This patch broke a lot of drivers so I had to take it out again...
>
> That's unexpected - what happens with it?
I double-checked the patch and tested it on some ARM boards, couldn't
find anything wrong during compilation and runtime. Would appreciate
some specifics about what broke so I can address the issue.
Thanks,
Alex.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] gpio: make of_get_named_gpiod_flags() private
2014-05-13 13:23 ` Alexandre Courbot
2014-05-14 2:11 ` Alexandre Courbot
@ 2014-05-16 15:25 ` Linus Walleij
2014-05-16 15:29 ` Alexandre Courbot
1 sibling, 1 reply; 8+ messages in thread
From: Linus Walleij @ 2014-05-16 15:25 UTC (permalink / raw)
To: Alexandre Courbot; +Cc: Alexandre Courbot, linux-gpio, linux-kernel
On Tue, May 13, 2014 at 3:23 PM, Alexandre Courbot <gnurou@gmail.com> wrote:
> On Tue, May 13, 2014 at 10:17 PM, Linus Walleij
> <linus.walleij@linaro.org> wrote:
>>> This results in all references to gpiod_* functions in of_gpio.h being
>>> gone, which is the way it should be since this file is part of the old
>>> integer GPIO interface.
>>>
>>> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
>>
>> This patch broke a lot of drivers so I had to take it out again...
>
> That's unexpected - what happens with it?
I got a horde of mails from Fengguang's autobuilder, I think you got
them as well ... else tell me and I'll dig them up.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] gpio: make of_get_named_gpiod_flags() private
2014-05-16 15:25 ` Linus Walleij
@ 2014-05-16 15:29 ` Alexandre Courbot
2014-05-16 16:14 ` Linus Walleij
0 siblings, 1 reply; 8+ messages in thread
From: Alexandre Courbot @ 2014-05-16 15:29 UTC (permalink / raw)
To: Linus Walleij, Alexandre Courbot; +Cc: linux-gpio, linux-kernel
On 05/17/2014 12:25 AM, Linus Walleij wrote:
> On Tue, May 13, 2014 at 3:23 PM, Alexandre Courbot <gnurou@gmail.com> wrote:
>> On Tue, May 13, 2014 at 10:17 PM, Linus Walleij
>> <linus.walleij@linaro.org> wrote:
>
>>>> This results in all references to gpiod_* functions in of_gpio.h being
>>>> gone, which is the way it should be since this file is part of the old
>>>> integer GPIO interface.
>>>>
>>>> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
>>>
>>> This patch broke a lot of drivers so I had to take it out again...
>>
>> That's unexpected - what happens with it?
>
> I got a horde of mails from Fengguang's autobuilder, I think you got
> them as well ... else tell me and I'll dig them up.
Mmm, it seems like I didn't get any mail. Could you follow othem r point
me to where these results are visible?
Thanks,
Alex.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] gpio: make of_get_named_gpiod_flags() private
2014-05-16 15:29 ` Alexandre Courbot
@ 2014-05-16 16:14 ` Linus Walleij
0 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2014-05-16 16:14 UTC (permalink / raw)
To: Alexandre Courbot; +Cc: Alexandre Courbot, linux-gpio, linux-kernel
On Fri, May 16, 2014 at 5:29 PM, Alexandre Courbot <acourbot@nvidia.com> wrote:
> On 05/17/2014 12:25 AM, Linus Walleij wrote:
>> I got a horde of mails from Fengguang's autobuilder, I think you got
>> them as well ... else tell me and I'll dig them up.
>
> Mmm, it seems like I didn't get any mail. Could you follow othem r point me
> to where these results are visible?
OK I'll look...
Linus
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-05-16 16:14 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-04 3:45 [PATCH] gpio: make of_get_named_gpiod_flags() private Alexandre Courbot
2014-05-13 8:39 ` Linus Walleij
2014-05-13 13:17 ` Linus Walleij
2014-05-13 13:23 ` Alexandre Courbot
2014-05-14 2:11 ` Alexandre Courbot
2014-05-16 15:25 ` Linus Walleij
2014-05-16 15:29 ` Alexandre Courbot
2014-05-16 16:14 ` 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).