diff options
author | Ben Dooks <ben.dooks@codethink.co.uk> | 2014-03-13 14:37:38 +0000 |
---|---|---|
committer | Damian Hobson-Garcia <dhobsong@igel.co.jp> | 2015-01-19 10:23:52 +0900 |
commit | b61fb6b40487f8cdcbaa6625e35946f735fc465f (patch) | |
tree | 7f42af50e65a4703615c054da4174cbef00418cf | |
parent | 6ee243cd06321e19df303a3b1ed38dd82f188700 (diff) | |
download | renesas_kernel-b61fb6b40487f8cdcbaa6625e35946f735fc465f.tar.gz renesas_kernel-b61fb6b40487f8cdcbaa6625e35946f735fc465f.tar.bz2 renesas_kernel-b61fb6b40487f8cdcbaa6625e35946f735fc465f.zip |
i2c: gpio: OF gpio code does not handle defered probe case
When using device-tree and the i2c-gpio driver is called before the
GPIO node has been probed then it needs to correctly defer the probe
instead of returning a permanent error that the gpio numbers are not
valid.
This fixes the following error:
/i2c@2: invalid GPIO pins, sda=-517/scl=-517
Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
(cherry picked from commit 40e7b1153a39e49715a1f75c654d8da66e3638c4)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 1582407d7809605bc223583d35515829c2ab0071)
Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
-rw-r--r-- | drivers/i2c/busses/i2c-gpio.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c index d9f7e186a4c..02d2d4abb9d 100644 --- a/drivers/i2c/busses/i2c-gpio.c +++ b/drivers/i2c/busses/i2c-gpio.c @@ -94,6 +94,9 @@ static int of_i2c_gpio_get_pins(struct device_node *np, *sda_pin = of_get_gpio(np, 0); *scl_pin = of_get_gpio(np, 1); + if (*sda_pin == -EPROBE_DEFER || *scl_pin == -EPROBE_DEFER) + return -EPROBE_DEFER; + if (!gpio_is_valid(*sda_pin) || !gpio_is_valid(*scl_pin)) { pr_err("%s: invalid GPIO pins, sda=%d/scl=%d\n", np->full_name, *sda_pin, *scl_pin); |