]> git.karo-electronics.de Git - linux-beck.git/commitdiff
gpio-sysfs: Use gpio descriptor name instead of gpiochip names array
authorMarkus Pargmann <mpa@pengutronix.de>
Fri, 14 Aug 2015 14:11:01 +0000 (16:11 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Thu, 24 Sep 2015 17:48:52 +0000 (10:48 -0700)
The name is now stored in the gpio descriptor as well, for example to
allow to store names from DT. This patch changes the sysfs gpio files
to use the gpio descriptor name.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpiolib-sysfs.c

index b57ed8e55ab5f61b7f8307399bb4e3d16299e64b..3e81f28e3aeec762c904dd55f91b8b3fa736b27f 100644 (file)
@@ -550,9 +550,7 @@ int gpiod_export(struct gpio_desc *desc, bool direction_may_change)
        struct gpiod_data       *data;
        unsigned long           flags;
        int                     status;
-       const char              *ioname = NULL;
        struct device           *dev;
-       int                     offset;
 
        /* can't export until sysfs is available ... */
        if (!gpio_class.p) {
@@ -601,13 +599,9 @@ int gpiod_export(struct gpio_desc *desc, bool direction_may_change)
        else
                data->direction_can_change = false;
 
-       offset = gpio_chip_hwgpio(desc);
-       if (chip->names && chip->names[offset])
-               ioname = chip->names[offset];
-
        dev = device_create_with_groups(&gpio_class, chip->dev,
                                        MKDEV(0, 0), data, gpio_groups,
-                                       ioname ? ioname : "gpio%u",
+                                       desc->name ? desc->name : "gpio%u",
                                        desc_to_gpio(desc));
        if (IS_ERR(dev)) {
                status = PTR_ERR(dev);