[PATCH v2 07/14] gpiolib: Export symbol gpiochip_set_names()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Being able to assign gpio line names dynamically is a feature
that could be used by drivers that do not have the exact naming
(e.g. through the DTB/DTBO) at probing time.
An example of this is the RP1 driver that populates the DT
at late time through a DT overlay. In this case a custom overlay
can be loaded from userspace with the gpio line names.

Export gpiochip_set_names() to allow refreshing the gpio line
names from the driver module.

Signed-off-by: Andrea della Porta <andrea.porta@xxxxxxxx>
---
 drivers/gpio/gpiolib.c      | 3 ++-
 include/linux/gpio/driver.h | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index c6afbf434366..a2aa3560094a 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -522,7 +522,7 @@ static void gpiochip_set_desc_names(struct gpio_chip *gc)
  * names belong to the underlying firmware node and should not be released
  * by the caller.
  */
-static int gpiochip_set_names(struct gpio_chip *chip)
+int gpiochip_set_names(struct gpio_chip *chip)
 {
 	struct gpio_device *gdev = chip->gpiodev;
 	struct device *dev = &gdev->dev;
@@ -589,6 +589,7 @@ static int gpiochip_set_names(struct gpio_chip *chip)
 
 	return 0;
 }
+EXPORT_SYMBOL(gpiochip_set_names);
 
 static unsigned long *gpiochip_allocate_mask(struct gpio_chip *gc)
 {
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index 2dd7cb9cc270..6e4cd7b7e47e 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -679,6 +679,9 @@ bool gpiochip_line_is_open_source(struct gpio_chip *gc, unsigned int offset);
 bool gpiochip_line_is_persistent(struct gpio_chip *gc, unsigned int offset);
 bool gpiochip_line_is_valid(const struct gpio_chip *gc, unsigned int offset);
 
+/* Assign gpio line names from device property */
+int gpiochip_set_names(struct gpio_chip *chip);
+
 /* get driver data */
 void *gpiochip_get_data(struct gpio_chip *gc);
 
-- 
2.35.3





[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux