Skip to contentSkip to conversation

i2c-gpio: OF gpio code does not handle defered probe case

PATCH Applied Ben Dooks 2 participants 2 messages Mar 13, 2014 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Ben Dooks

author
#0 lore raw

PATCH 1/1 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
---
 drivers/i2c/busses/i2c-gpio.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/i2c/busses/i2c-gpio.c +3 -0
index d9f7e18..02d2d4a 100644
@@ -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);
Signature · 1 line
1.9.0

A message that is not in the archive (sent off-list or not yet received): 1394721458-23585-1-git-send-email-ben.dooks-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org

Applied
#2 lore raw
Quoted 9 lines · Ben Dooks

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

Applied to for-next, thanks!