gpio: make of_get_named_gpiod_flags() private
Subsystems (2)
PATCH 1/1 gpio: make of_get_named_gpiod_flags() private
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.
--- drivers/gpio/gpiolib-of.c | 14 ++++++++++++++ drivers/gpio/gpiolib.h | 3 +++ include/linux/of_gpio.h | 39 ++------------------------------------- 3 files changed, 19 insertions(+), 37 deletions(-)
drivers/gpio/gpiolib-of.c +14 -0
@@ -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
drivers/gpio/gpiolib.h +3 -0
@@ -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 */
include/linux/of_gpio.h +2 -37
@@ -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) {
Signature · 1 line
1.9.2
Quoted 12 lines · 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 simplergpiod_get()to provide properly-configured GPIOs.
of_get_named_gpiod_flags()is just used internally by gpiolib to implementgpiod_get(), and by the oldof_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, andof_get_named_gpio_flags()is moved from a static inline function to a regular one ingpiolib-of.c
Quoted 5 lines
This results in all references to gpiod_* functions in
of_gpio.hbeing gone, which is the way it should be since this file is part of the old integer GPIO interface.Signed-off-by Alexandre Courbot <[email protected]>
Nice. Patch applied!
Yours,
Linus Walleij
Quoted 12 lines · 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 simplergpiod_get()to provide properly-configured GPIOs.
of_get_named_gpiod_flags()is just used internally by gpiolib to implementgpiod_get(), and by the oldof_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, andof_get_named_gpio_flags()is moved from a static inline function to a regular one ingpiolib-of.c
Quoted 5 lines
This results in all references to gpiod_* functions in
of_gpio.hbeing gone, which is the way it should be since this file is part of the old integer GPIO interface.Signed-off-by Alexandre Courbot <[email protected]>
This patch broke a lot of drivers so I had to take it out again...
Yours,
Linus Walleij
Quoted 14 lines · Linus Walleij
Quoted 12 lines · 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 simplergpiod_get()to provide properly-configured GPIOs.
of_get_named_gpiod_flags()is just used internally by gpiolib to implementgpiod_get(), and by the oldof_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, andof_get_named_gpio_flags()is moved from a static inline function to a regular one ingpiolib-of.c
Quoted 7 lines
Quoted 5 lines
This results in all references to gpiod_* functions in
of_gpio.hbeing gone, which is the way it should be since this file is part of the old integer GPIO interface.Signed-off-by Alexandre Courbot <[email protected]>This patch broke a lot of drivers so I had to take it out again...
That's unexpected - what happens with it?
Quoted 20 lines · Alexandre Courbot
Quoted 18 lines · Linus Walleij
Quoted 16 lines · 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 simplergpiod_get()to provide properly-configured GPIOs.
of_get_named_gpiod_flags()is just used internally by gpiolib to implementgpiod_get(), and by the oldof_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, andof_get_named_gpio_flags()is moved from a static inline function to a regular one ingpiolib-of.cThis results in all references to gpiod_* functions in
of_gpio.hbeing gone, which is the way it should be since this file is part of the old integer GPIO interface.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Alexandre Courbot <[email protected]>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.
Quoted 7 lines · Alexandre Courbot
Quoted 4 lines · Linus Walleij
Quoted 4 lines
This results in all references to gpiod_* functions in
of_gpio.hbeing gone, which is the way it should be since this file is part of the old integer GPIO interface.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Alexandre Courbot <[email protected]>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
Quoted 8 lines · Linus Walleij
Quoted 7 lines · Alexandre Courbot
Quoted 4 lines · Linus Walleij
Quoted 4 lines
This results in all references to gpiod_* functions in
of_gpio.hbeing gone, which is the way it should be since this file is part of the old integer GPIO interface.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Alexandre Courbot <[email protected]>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.
Quoted 7 lines · Alexandre Courbot
Quoted 2 lines · Linus Walleij
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