Re: [PATCH v1] i2c: designware: Consider SCL GPIO optional

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

 



On 21/02/2018 16:31, Wolfram Sang wrote:
On Sat, Feb 17, 2018 at 10:58:43PM +0200, Andy Shevchenko wrote:
GPIO library can return -ENOSYS for the failed request.
Instead of failing ->probe() in this case override error code to 0.

I wonder if the code wouldn't be much easier if
i2c_dw_init_recovery_info() was simply returning void? Or just give a
warning in the log but not bail out of probe()?

You need to handle EPROBE_DEFER.




Fixes: ca382f5b38f3 ("i2c: designware: add i2c gpio recovery option")
Reported-by: Dominik Brodowski <linux@xxxxxxxxxxxxxxxxxxxx>
Cc: Tim Sander <tim@xxxxxxxxxxxxxxx>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
---
  drivers/i2c/busses/i2c-designware-master.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c
index ae691884d071..5778908351a2 100644
--- a/drivers/i2c/busses/i2c-designware-master.c
+++ b/drivers/i2c/busses/i2c-designware-master.c
@@ -644,7 +644,7 @@ static int i2c_dw_init_recovery_info(struct dw_i2c_dev *dev)
  	gpio = devm_gpiod_get(dev->dev, "scl", GPIOD_OUT_HIGH);
  	if (IS_ERR(gpio)) {
  		r = PTR_ERR(gpio);
-		if (r == -ENOENT)
+		if (r == -ENOENT || r == -ENOSYS)
  			return 0;
  		return r;
  	}
--
2.15.1



--
Regards
Phil Reid

ElectroMagnetic Imaging Technology Pty Ltd
Development of Geophysical Instrumentation & Software
www.electromag.com.au

3 The Avenue, Midland WA 6056, AUSTRALIA
Ph: +61 8 9250 8100
Fax: +61 8 9250 7100
Email: preid@xxxxxxxxxxxxxxxxx



[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux