aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpiolib-of.c
diff options
context:
space:
mode:
authorDmitry Torokhov <[email protected]>2022-12-19 19:20:13 +0000
committerBartosz Golaszewski <[email protected]>2023-01-30 14:55:28 +0000
commitc7835652a85df183c967f574d1999505ebf80b88 (patch)
tree3bb879daedc976e122b78c3d11062968e3d0ba51 /drivers/gpio/gpiolib-of.c
parentgpiolib: of: remove of_gpio_count() (diff)
downloadkernel-c7835652a85df183c967f574d1999505ebf80b88.tar.gz
kernel-c7835652a85df183c967f574d1999505ebf80b88.zip
gpiolib: of: stop exporting of_gpio_named_count()
The only user of this function is gpiolib-of.c so move it there. Signed-off-by: Dmitry Torokhov <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
Diffstat (limited to 'drivers/gpio/gpiolib-of.c')
-rw-r--r--drivers/gpio/gpiolib-of.c26
1 files changed, 26 insertions, 0 deletions
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
@@ -24,6 +24,32 @@
#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
* @con_id: Function within the GPIO consumer