gpio: sysfs: preparatory clean ups
authorJohan Hovold <johan@kernel.org>
Mon, 4 May 2015 15:10:29 +0000 (17:10 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 12 May 2015 08:46:36 +0000 (10:46 +0200)
Put the recently introduced gpio-chip pointer to some more use in
gpiod_export.

Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpiolib-sysfs.c

index b2b62cc6f9e1ed7133bd6c0d186c9c005ed41872..658ed28e6d7d9fe7bc345fcb76ab9c1d13b6f2bb 100644 (file)
@@ -599,7 +599,7 @@ int gpiod_export(struct gpio_desc *desc, bool direction_may_change)
                goto fail_unlock;
        }
 
-       if (desc->chip->direction_input && desc->chip->direction_output &&
+       if (chip->direction_input && chip->direction_output &&
                        direction_may_change) {
                set_bit(FLAG_SYSFS_DIR, &desc->flags);
        }
@@ -607,10 +607,10 @@ int gpiod_export(struct gpio_desc *desc, bool direction_may_change)
        spin_unlock_irqrestore(&gpio_lock, flags);
 
        offset = gpio_chip_hwgpio(desc);
-       if (desc->chip->names && desc->chip->names[offset])
-               ioname = desc->chip->names[offset];
+       if (chip->names && chip->names[offset])
+               ioname = chip->names[offset];
 
-       dev = device_create_with_groups(&gpio_class, desc->chip->dev,
+       dev = device_create_with_groups(&gpio_class, chip->dev,
                                        MKDEV(0, 0), desc, gpio_groups,
                                        ioname ? ioname : "gpio%u",
                                        desc_to_gpio(desc));