diff mbox series

[4/5] gpiolib: of: remove of_get_gpio[_flags]() and of_get_named_gpio_flags()

Message ID 20221219192016.1396950-4-dmitry.torokhov@gmail.com
State New
Headers show
Series [1/5] gpiolib: of: remove of_gpio_count() | expand

Commit Message

Dmitry Torokhov Dec. 19, 2022, 7:20 p.m. UTC
There are no more users of these APIs in the mainline kernel, remove
them. This leaves of_get_named_gpio() as the only legacy OF-specific
API.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/gpio/gpiolib-of.c | 17 +++++++++++----
 include/linux/of_gpio.h   | 45 ++++-----------------------------------
 2 files changed, 17 insertions(+), 45 deletions(-)

Comments

Andy Shevchenko Dec. 20, 2022, 1:58 p.m. UTC | #1
On Mon, Dec 19, 2022 at 11:20:15AM -0800, Dmitry Torokhov wrote:
> There are no more users of these APIs in the mainline kernel, remove
> them. This leaves of_get_named_gpio() as the only legacy OF-specific
> API.

...

> -	desc = of_get_named_gpiod_flags(np, list_name, index, flags);
> +	desc = of_get_named_gpiod_flags(np, propname, index, NULL);

I didn't get it. The commit message and the subject says there are no more
users of these APIs, why is it still here? How is it compiled?
Dmitry Torokhov Dec. 20, 2022, 6:29 p.m. UTC | #2
On Tue, Dec 20, 2022 at 03:58:11PM +0200, Andy Shevchenko wrote:
> On Mon, Dec 19, 2022 at 11:20:15AM -0800, Dmitry Torokhov wrote:
> > There are no more users of these APIs in the mainline kernel, remove
> > them. This leaves of_get_named_gpio() as the only legacy OF-specific
> > API.
> 
> ...
> 
> > -	desc = of_get_named_gpiod_flags(np, list_name, index, flags);
> > +	desc = of_get_named_gpiod_flags(np, propname, index, NULL);
> 
> I didn't get it. The commit message and the subject says there are no more
> users of these APIs, why is it still here? How is it compiled?

gpio vs gpiod strikes again ;) We are removing
of_get_named_gpio_flags(), but of_get_named_gpiod_flags() is a local
helper in gpiolib-of.c and is still very much in use there and I have no
plans removing it.

Thanks.
Andy Shevchenko Dec. 20, 2022, 7:16 p.m. UTC | #3
On Tue, Dec 20, 2022 at 10:29:06AM -0800, Dmitry Torokhov wrote:
> On Tue, Dec 20, 2022 at 03:58:11PM +0200, Andy Shevchenko wrote:
> > On Mon, Dec 19, 2022 at 11:20:15AM -0800, Dmitry Torokhov wrote:
> > > There are no more users of these APIs in the mainline kernel, remove
> > > them. This leaves of_get_named_gpio() as the only legacy OF-specific
> > > API.

...

> > > -	desc = of_get_named_gpiod_flags(np, list_name, index, flags);
> > > +	desc = of_get_named_gpiod_flags(np, propname, index, NULL);
> > 
> > I didn't get it. The commit message and the subject says there are no more
> > users of these APIs, why is it still here? How is it compiled?
> 
> gpio vs gpiod strikes again ;) We are removing
> of_get_named_gpio_flags(), but of_get_named_gpiod_flags() is a local
> helper in gpiolib-of.c and is still very much in use there and I have no
> plans removing it.

Right, thank you for clarification.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
diff mbox series

Patch

diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index 6114c5b3d2ce..fdf443310442 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -365,19 +365,28 @@  static struct gpio_desc *of_get_named_gpiod_flags(const struct device_node *np,
 	return desc;
 }
 
-int of_get_named_gpio_flags(const struct device_node *np, const char *list_name,
-			    int index, enum of_gpio_flags *flags)
+/**
+ * of_get_named_gpio() - Get a GPIO number to use with GPIO API
+ * @np:		device node to get GPIO from
+ * @propname:	Name of property containing gpio specifier(s)
+ * @index:	index of the GPIO
+ *
+ * Returns GPIO number to use with Linux generic GPIO API, or one of the errno
+ * value on the error condition.
+ */
+int of_get_named_gpio(const struct device_node *np, const char *propname,
+		      int index)
 {
 	struct gpio_desc *desc;
 
-	desc = of_get_named_gpiod_flags(np, list_name, index, flags);
+	desc = of_get_named_gpiod_flags(np, propname, index, NULL);
 
 	if (IS_ERR(desc))
 		return PTR_ERR(desc);
 	else
 		return desc_to_gpio(desc);
 }
-EXPORT_SYMBOL_GPL(of_get_named_gpio_flags);
+EXPORT_SYMBOL_GPL(of_get_named_gpio);
 
 /* Converts gpio_lookup_flags into bitmask of GPIO_* values */
 static unsigned long of_convert_gpio_flags(enum of_gpio_flags flags)
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
index 680025c1a55b..e27a9187c0c6 100644
--- a/include/linux/of_gpio.h
+++ b/include/linux/of_gpio.h
@@ -50,8 +50,8 @@  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 int of_get_named_gpio_flags(const struct device_node *np,
-		const char *list_name, int index, enum of_gpio_flags *flags);
+extern int of_get_named_gpio(const struct device_node *np,
+			     const char *list_name, int index);
 
 extern int of_mm_gpiochip_add_data(struct device_node *np,
 				   struct of_mm_gpio_chip *mm_gc,
@@ -68,49 +68,12 @@  extern void of_mm_gpiochip_remove(struct of_mm_gpio_chip *mm_gc);
 #include <linux/errno.h>
 
 /* Drivers may not strictly depend on the GPIO support, so let them link. */
-static inline int of_get_named_gpio_flags(const struct device_node *np,
-		const char *list_name, int index, enum of_gpio_flags *flags)
-{
-	if (flags)
-		*flags = 0;
-
-	return -ENOSYS;
-}
-
-#endif /* CONFIG_OF_GPIO */
-
-static inline int of_get_gpio_flags(const struct device_node *np, int index,
-		      enum of_gpio_flags *flags)
-{
-	return of_get_named_gpio_flags(np, "gpios", index, flags);
-}
-
-/**
- * of_get_named_gpio() - Get a GPIO number to use with GPIO API
- * @np:		device node to get GPIO from
- * @propname:	Name of property containing gpio specifier(s)
- * @index:	index of the GPIO
- *
- * Returns GPIO number to use with Linux generic GPIO API, or one of the errno
- * value on the error condition.
- */
 static inline int of_get_named_gpio(const struct device_node *np,
                                    const char *propname, int index)
 {
-	return of_get_named_gpio_flags(np, propname, index, NULL);
+	return -ENOSYS;
 }
 
-/**
- * of_get_gpio() - Get a GPIO number to use with GPIO API
- * @np:		device node to get GPIO from
- * @index:	index of the GPIO
- *
- * Returns GPIO number to use with Linux generic GPIO API, or one of the errno
- * value on the error condition.
- */
-static inline int of_get_gpio(const struct device_node *np, int index)
-{
-	return of_get_gpio_flags(np, index, NULL);
-}
+#endif /* CONFIG_OF_GPIO */
 
 #endif /* __LINUX_OF_GPIO_H */