summaryrefslogtreecommitdiff
path: root/drivers/gpio
diff options
context:
space:
mode:
authorDong Aisheng <aisheng.dong@nxp.com>2017-09-06 20:31:28 +0800
committerLeonard Crestez <leonard.crestez@nxp.com>2018-08-24 12:41:33 +0300
commit7b9911022e812df1a3aba7270ae290cf7bdbfdea (patch)
tree487e3c2d8ad0f512d3a98f67302a911ee383ea8d /drivers/gpio
parent035f465e9b48da1e9d3ee61733a519364017aba0 (diff)
MLK-17491-12 gpio: gpio-vf610: put gpio direction setting in vf610_gpio_direction_output
The gpio direction setting is better to be put in vf610_gpio_direction_output rather than vf610_gpio_set where the later one is only for value set. Reviewed-by: Fugang Duan <fugang.duan@nxp.com> Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-vf610.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c
index 68567cabcdee..ffc077204db3 100644
--- a/drivers/gpio/gpio-vf610.c
+++ b/drivers/gpio/gpio-vf610.c
@@ -97,8 +97,6 @@ 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);
- vf610_gpio_writel(mask, port->gpio_base + GPIO_PDDR);
-
if (val)
vf610_gpio_writel(mask, port->gpio_base + GPIO_PSOR);
else
@@ -120,6 +118,11 @@ static int vf610_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
static int vf610_gpio_direction_output(struct gpio_chip *chip, unsigned gpio,
int value)
{
+ struct vf610_gpio_port *port = gpiochip_get_data(chip);
+ unsigned long mask = BIT(gpio);
+
+ vf610_gpio_writel(mask, port->gpio_base + GPIO_PDDR);
+
vf610_gpio_set(chip, gpio, value);
return pinctrl_gpio_direction_output(chip->base + gpio);