@@ -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)
{
@@ -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);
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@suse.com> --- drivers/gpio/gpiolib.c | 3 ++- include/linux/gpio/driver.h | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-)