diff mbox series

i2c: gpio: suppress error on probe defer

Message ID 20200309211618.25535-1-hamish.martin@alliedtelesis.co.nz
State Accepted
Headers show
Series i2c: gpio: suppress error on probe defer | expand

Commit Message

Hamish Martin March 9, 2020, 9:16 p.m. UTC
If a GPIO we are trying to use is not available and we are deferring
the probe, don't output an error message.
This seems to have been the intent of commit 05c74778858d
("i2c: gpio: Add support for named gpios in DT") but the error was
still output due to not checking the updated 'retdesc'.

Fixes: 05c74778858d ("i2c: gpio: Add support for named gpios in DT")
Signed-off-by: Hamish Martin <hamish.martin@alliedtelesis.co.nz>
---
 drivers/i2c/busses/i2c-gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Linus Walleij March 10, 2020, 8:13 a.m. UTC | #1
On Mon, Mar 9, 2020 at 10:16 PM Hamish Martin
<hamish.martin@alliedtelesis.co.nz> wrote:

> If a GPIO we are trying to use is not available and we are deferring
> the probe, don't output an error message.
> This seems to have been the intent of commit 05c74778858d
> ("i2c: gpio: Add support for named gpios in DT") but the error was
> still output due to not checking the updated 'retdesc'.
>
> Fixes: 05c74778858d ("i2c: gpio: Add support for named gpios in DT")
> Signed-off-by: Hamish Martin <hamish.martin@alliedtelesis.co.nz>

Acked-by: Linus Walleij <linus.walleij@linaro.org>

Maintainers have varied opinions about this. Some think
it is a stopgap problem until we get probes ordered by other
measures, others think developers should simply learn
the meaning of error -517 and realize it is no error.

But this is fine with me.

Yours,
Linus Walleij
Wolfram Sang March 10, 2020, 11:29 a.m. UTC | #2
On Tue, Mar 10, 2020 at 10:16:18AM +1300, Hamish Martin wrote:
> If a GPIO we are trying to use is not available and we are deferring
> the probe, don't output an error message.
> This seems to have been the intent of commit 05c74778858d
> ("i2c: gpio: Add support for named gpios in DT") but the error was
> still output due to not checking the updated 'retdesc'.
> 
> Fixes: 05c74778858d ("i2c: gpio: Add support for named gpios in DT")
> Signed-off-by: Hamish Martin <hamish.martin@alliedtelesis.co.nz>

Applied to for-current, thanks!
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
index 3a9e840a3546..a4a6825c8758 100644
--- a/drivers/i2c/busses/i2c-gpio.c
+++ b/drivers/i2c/busses/i2c-gpio.c
@@ -348,7 +348,7 @@  static struct gpio_desc *i2c_gpio_get_desc(struct device *dev,
 	if (ret == -ENOENT)
 		retdesc = ERR_PTR(-EPROBE_DEFER);
 
-	if (ret != -EPROBE_DEFER)
+	if (PTR_ERR(retdesc) != -EPROBE_DEFER)
 		dev_err(dev, "error trying to get descriptor: %d\n", ret);
 
 	return retdesc;