]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
gpio: vf610: Simplify vf610_gpio_set()
authorAndrey Smirnov <andrew.smirnov@gmail.com>
Mon, 11 Mar 2019 06:27:32 +0000 (23:27 -0700)
committerBartosz Golaszewski <bgolaszewski@baylibre.com>
Mon, 18 Mar 2019 07:58:45 +0000 (08:58 +0100)
The only difference between two codepaths is register offset
used. Simplify the code a bit by replacing explicit calls with a
single call with a variable offset. No functional change intended.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: Chris Healy <cphealy@gmail.com>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Heiner Kallweit <hkallweit1@gmail.com>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: linux-gpio@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-imx@nxp.com
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
drivers/gpio/gpio-vf610.c

index 7e9451f47efe26dd006be152ab55342330387ec7..2ea17870e9da322a40b97f0ac32992ac035779ca 100644 (file)
@@ -102,11 +102,9 @@ static void vf610_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
 {
        struct vf610_gpio_port *port = gpiochip_get_data(gc);
        unsigned long mask = BIT(gpio);
+       unsigned long offset = val ? GPIO_PSOR : GPIO_PCOR;
 
-       if (val)
-               vf610_gpio_writel(mask, port->gpio_base + GPIO_PSOR);
-       else
-               vf610_gpio_writel(mask, port->gpio_base + GPIO_PCOR);
+       vf610_gpio_writel(mask, port->gpio_base + offset);
 }
 
 static int vf610_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)