diff options
author | Ben Dooks <ben.dooks@codethink.co.uk> | 2014-03-13 10:37:38 -0400 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2014-03-13 17:16:43 -0400 |
commit | 40e7b1153a39e49715a1f75c654d8da66e3638c4 (patch) | |
tree | ee3aefe23650c22a0f5a15d5bc581165e8547cf8 /drivers/i2c | |
parent | 8a325997d95d446206b204b7859e055a0315e4fa (diff) |
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>
Diffstat (limited to 'drivers/i2c')
-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 d9f7e186a4c7..02d2d4abb9dd 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, | |||
94 | *sda_pin = of_get_gpio(np, 0); | 94 | *sda_pin = of_get_gpio(np, 0); |
95 | *scl_pin = of_get_gpio(np, 1); | 95 | *scl_pin = of_get_gpio(np, 1); |
96 | 96 | ||
97 | if (*sda_pin == -EPROBE_DEFER || *scl_pin == -EPROBE_DEFER) | ||
98 | return -EPROBE_DEFER; | ||
99 | |||
97 | if (!gpio_is_valid(*sda_pin) || !gpio_is_valid(*scl_pin)) { | 100 | if (!gpio_is_valid(*sda_pin) || !gpio_is_valid(*scl_pin)) { |
98 | pr_err("%s: invalid GPIO pins, sda=%d/scl=%d\n", | 101 | pr_err("%s: invalid GPIO pins, sda=%d/scl=%d\n", |
99 | np->full_name, *sda_pin, *scl_pin); | 102 | np->full_name, *sda_pin, *scl_pin); |