Patchwork [3/4] i2c: rcar: do not print error if device nacks transfer

login
register
mail settings
Submitter Ben Dooks
Date Jan. 17, 2014, 6:11 p.m.
Message ID <1389982298-23143-4-git-send-email-ben.dooks@codethink.co.uk>
Download mbox | patch
Permalink /patch/312291/
State Superseded
Headers show

Comments

Ben Dooks - Jan. 17, 2014, 6:11 p.m.
The i2c-rcar driver currently prints an error message if the master_xfer
callback fails. However if the bus is being probed then lots of NAKs
will be generated, causing the output of a number of errors printed.

To solve this, disable the print if the error is not -EREMOTEIO.

An example of running i2cdetect:

10: i2c-rcar e6530000.i2c: error -121 : 15
-- i2c-rcar e6530000.i2c: error -121 : 15
-- 12 i2c-rcar e6530000.i2c: error -121 : 15
-- i2c-rcar e6530000.i2c: error -121 : 15
-- i2c-rcar e6530000.i2c: error -121 : 15
-- i2c-rcar e6530000.i2c: error -121 : 15
-- i2c-rcar e6530000.i2c: error -121 : 15
-- i2c-rcar e6530000.i2c: error -121 : 15

Cc: Simon Horman <horms+renesas@verge.net.au>
Cc: Wolfram Sang <wsa@the-dreams.de>
Cc: linux-i2c@vger.kernel.org
Cc: linux-sh@vger.kernel.org
Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
 drivers/i2c/busses/i2c-rcar.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Wolfram Sang - Jan. 24, 2014, 5:11 p.m.
On Fri, Jan 17, 2014 at 06:11:37PM +0000, Ben Dooks wrote:
> The i2c-rcar driver currently prints an error message if the master_xfer
> callback fails. However if the bus is being probed then lots of NAKs
> will be generated, causing the output of a number of errors printed.
> 
> To solve this, disable the print if the error is not -EREMOTEIO.

Basically OK. Yet, according to 'fault-codes" it should be -ENXIO. May
be a good time to fix this as well.

Also, you might want to print for -EIO only? Or do you want to see
-EAGAIN, too?
Ben Dooks - Jan. 26, 2014, 3:32 p.m.
On 24/01/14 17:11, Wolfram Sang wrote:
> On Fri, Jan 17, 2014 at 06:11:37PM +0000, Ben Dooks wrote:
>> The i2c-rcar driver currently prints an error message if the master_xfer
>> callback fails. However if the bus is being probed then lots of NAKs
>> will be generated, causing the output of a number of errors printed.
>>
>> To solve this, disable the print if the error is not -EREMOTEIO.
>
> Basically OK. Yet, according to 'fault-codes" it should be -ENXIO. May
> be a good time to fix this as well.
>
> Also, you might want to print for -EIO only? Or do you want to see
> -EAGAIN, too?

Ok, although the change to the error code should probably be a separate
patch instead of modifying this one.
Ben Dooks - Jan. 26, 2014, 3:57 p.m.
On 24/01/14 17:11, Wolfram Sang wrote:
> On Fri, Jan 17, 2014 at 06:11:37PM +0000, Ben Dooks wrote:
>> The i2c-rcar driver currently prints an error message if the master_xfer
>> callback fails. However if the bus is being probed then lots of NAKs
>> will be generated, causing the output of a number of errors printed.
>>
>> To solve this, disable the print if the error is not -EREMOTEIO.
>
> Basically OK. Yet, according to 'fault-codes" it should be -ENXIO. May
> be a good time to fix this as well.
>
> Also, you might want to print for -EIO only? Or do you want to see
> -EAGAIN, too.

I'm not sure, I've not seen any EAGAIN replies from the driver.
I will leave this for a future patch.

Patch

diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index 2c2fd7c..0d25104 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -623,7 +623,7 @@  static int rcar_i2c_master_xfer(struct i2c_adapter *adap,
 
 	pm_runtime_put(dev);
 
-	if (ret < 0)
+	if (ret < 0 && ret != -EREMOTEIO)
 		dev_err(dev, "error %d : %x\n", ret, priv->flags);
 
 	return ret;