[PATCH] i2c: gpio: fix sda/scl-gpios property support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fix checking the correct pins introduced by commit 5a17fc5863 ("i2c: gpio:
add sda/scl-gpios property support").

Signed-off-by: Marco Felsch <m.felsch@xxxxxxxxxxxxxx>
---
 drivers/i2c/busses/i2c-gpio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
index 9508adab06..5ab43fe935 100644
--- a/drivers/i2c/busses/i2c-gpio.c
+++ b/drivers/i2c/busses/i2c-gpio.c
@@ -97,7 +97,7 @@ static int of_i2c_gpio_probe(struct device_node *np,
 	pdata->sda_pin = of_get_named_gpio_flags(np, "sda-gpios", 0, NULL);
 	pdata->scl_pin = of_get_named_gpio_flags(np, "scl-gpios", 0, NULL);
 
-	if ((!gpio_is_valid(pdata->sda_pin) || !gpio_is_valid(pdata->sda_pin))
+	if ((!gpio_is_valid(pdata->sda_pin) || !gpio_is_valid(pdata->scl_pin))
 	    && (of_gpio_count(np) >= 2)) {
 		/* Note: The gpios property is marked as deprecated */
 		ret = of_get_gpio(np, 0);
@@ -111,7 +111,7 @@ static int of_i2c_gpio_probe(struct device_node *np,
 		pdata->scl_pin = ret;
 	}
 
-	if (!gpio_is_valid(pdata->sda_pin) || !gpio_is_valid(pdata->sda_pin))
+	if (!gpio_is_valid(pdata->sda_pin) || !gpio_is_valid(pdata->scl_pin))
 		return -ENODEV;
 
 	of_property_read_u32(np, "i2c-gpio,delay-us", &pdata->udelay);
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux