]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
dm: i2c-gpio: Remove redundant dm_gpio_set_value() call
authorAxel Lin <axel.lin@ingics.com>
Sun, 26 Apr 2015 03:05:38 +0000 (11:05 +0800)
committerLothar Waßmann <LW@KARO-electronics.de>
Tue, 8 Sep 2015 20:37:15 +0000 (22:37 +0200)
dm_gpio_set_dir_flags() will also set gpio output value when switching to
gpio output. So it's not necessary to call dm_gpio_set_value() after
dm_gpio_set_dir_flags() call.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Simon Glass <sjg@chromium.org>
drivers/i2c/i2c-gpio.c

index ed899d47770ca5f00ff2cecebb1fe8b0f8071a20..a8b83c51bc398a61f89377b3305cc9474a14c9e2 100644 (file)
@@ -41,18 +41,19 @@ static int i2c_gpio_sda_get(struct gpio_desc *sda)
 
 static void i2c_gpio_sda_set(struct gpio_desc *sda, int bit)
 {
-       if (bit) {
+       if (bit)
                dm_gpio_set_dir_flags(sda, GPIOD_IS_IN);
-       } else {
+       else
                dm_gpio_set_dir_flags(sda, GPIOD_IS_OUT);
-               dm_gpio_set_value(sda, 0);
-       }
 }
 
 static void i2c_gpio_scl_set(struct gpio_desc *scl, int bit)
 {
-       dm_gpio_set_dir_flags(scl, GPIOD_IS_OUT);
-       dm_gpio_set_value(scl, bit);
+       ulong flags = GPIOD_IS_OUT;
+
+       if (bit)
+               flags |= GPIOD_IS_OUT_ACTIVE;
+       dm_gpio_set_dir_flags(scl, flags);
 }
 
 static void i2c_gpio_write_bit(struct gpio_desc *scl, struct gpio_desc *sda,