diff mbox series

[2/5] gpiolib: of: stop exporting of_gpio_named_count()

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

Commit Message

Dmitry Torokhov Dec. 19, 2022, 7:20 p.m. UTC
The only user of this function is gpiolib-of.c so move it there.

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

Comments

Andy Shevchenko Dec. 20, 2022, 1:50 p.m. UTC | #1
On Mon, Dec 19, 2022 at 11:20:13AM -0800, Dmitry Torokhov wrote:
> The only user of this function is gpiolib-of.c so move it there.

It's one liner used a single file, can we kill it completely?
Dmitry Torokhov Dec. 20, 2022, 6:27 p.m. UTC | #2
On Tue, Dec 20, 2022 at 03:50:40PM +0200, Andy Shevchenko wrote:
> On Mon, Dec 19, 2022 at 11:20:13AM -0800, Dmitry Torokhov wrote:
> > The only user of this function is gpiolib-of.c so move it there.
> 
> It's one liner used a single file, can we kill it completely?

It is being called from a couple of places there and documents how
exactly we are counting GPIOs, so I would prefer to leave this helper as
is.

Thanks.
Andy Shevchenko Dec. 20, 2022, 7:15 p.m. UTC | #3
On Tue, Dec 20, 2022 at 10:27:28AM -0800, Dmitry Torokhov wrote:
> On Tue, Dec 20, 2022 at 03:50:40PM +0200, Andy Shevchenko wrote:
> > On Mon, Dec 19, 2022 at 11:20:13AM -0800, Dmitry Torokhov wrote:
> > > The only user of this function is gpiolib-of.c so move it there.
> > 
> > It's one liner used a single file, can we kill it completely?
> 
> It is being called from a couple of places there and documents how
> exactly we are counting GPIOs, so I would prefer to leave this helper as
> is.

Fair enough. However I think that even so it may be killed in the future.

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 4fff7258ee41..6724e375678d 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -23,6 +23,32 @@ 
 #include "gpiolib.h"
 #include "gpiolib-of.h"
 
+/**
+ * of_gpio_named_count() - Count GPIOs for a device
+ * @np:		device node to count GPIOs for
+ * @propname:	property name containing gpio specifier(s)
+ *
+ * The function returns the count of GPIOs specified for a node.
+ * Note that the empty GPIO specifiers count too. Returns either
+ *   Number of gpios defined in property,
+ *   -EINVAL for an incorrectly formed gpios property, or
+ *   -ENOENT for a missing gpios property
+ *
+ * Example:
+ * gpios = <0
+ *          &gpio1 1 2
+ *          0
+ *          &gpio2 3 4>;
+ *
+ * The above example defines four GPIOs, two of which are not specified.
+ * This function will return '4'
+ */
+static int of_gpio_named_count(const struct device_node *np,
+			       const char *propname)
+{
+	return of_count_phandle_with_args(np, propname, "#gpio-cells");
+}
+
 /**
  * of_gpio_spi_cs_get_count() - special GPIO counting for SPI
  * @dev:    Consuming device
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
index 39f16a960565..680025c1a55b 100644
--- a/include/linux/of_gpio.h
+++ b/include/linux/of_gpio.h
@@ -79,32 +79,6 @@  static inline int of_get_named_gpio_flags(const struct device_node *np,
 
 #endif /* CONFIG_OF_GPIO */
 
-/**
- * of_gpio_named_count() - Count GPIOs for a device
- * @np:		device node to count GPIOs for
- * @propname:	property name containing gpio specifier(s)
- *
- * The function returns the count of GPIOs specified for a node.
- * Note that the empty GPIO specifiers count too. Returns either
- *   Number of gpios defined in property,
- *   -EINVAL for an incorrectly formed gpios property, or
- *   -ENOENT for a missing gpios property
- *
- * Example:
- * gpios = <0
- *          &gpio1 1 2
- *          0
- *          &gpio2 3 4>;
- *
- * The above example defines four GPIOs, two of which are not specified.
- * This function will return '4'
- */
-static inline int of_gpio_named_count(const struct device_node *np,
-				      const char *propname)
-{
-	return of_count_phandle_with_args(np, propname, "#gpio-cells");
-}
-
 static inline int of_get_gpio_flags(const struct device_node *np, int index,
 		      enum of_gpio_flags *flags)
 {