diff mbox series

[1/4] i2c: xlp9xx: return ENXIO on slave address NACK

Message ID 1516253964-4615-1-git-send-email-george.cherian@cavium.com
State Accepted
Headers show
Series [1/4] i2c: xlp9xx: return ENXIO on slave address NACK | expand

Commit Message

George Cherian Jan. 18, 2018, 5:39 a.m. UTC
From: Dmitry Bazhenov <dmitry.bazhenov@auriga.com>

Fix the driver violation of the common practice to return
ENXIO error on a slave address NACK.

Signed-off-by: Dmitry Bazhenov <dmitry.bazhenov@auriga.com>
Signed-off-by: George Cherian <george.cherian@cavium.com>
---
 drivers/i2c/busses/i2c-xlp9xx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

George Cherian Jan. 30, 2018, 2:28 p.m. UTC | #1
Gentle Ping on this series.

On 01/18/2018 11:09 AM, George Cherian wrote:
> From: Dmitry Bazhenov <dmitry.bazhenov@auriga.com>
> 
> Fix the driver violation of the common practice to return
> ENXIO error on a slave address NACK.
> 
> Signed-off-by: Dmitry Bazhenov <dmitry.bazhenov@auriga.com>
> Signed-off-by: George Cherian <george.cherian@cavium.com>
> ---
>   drivers/i2c/busses/i2c-xlp9xx.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-xlp9xx.c b/drivers/i2c/busses/i2c-xlp9xx.c
> index b970bf8..6d78cdc 100644
> --- a/drivers/i2c/busses/i2c-xlp9xx.c
> +++ b/drivers/i2c/busses/i2c-xlp9xx.c
> @@ -324,7 +324,8 @@ static int xlp9xx_i2c_xfer_msg(struct xlp9xx_i2c_dev *priv, struct i2c_msg *msg,
>   		dev_dbg(priv->dev, "transfer error %x!\n", priv->msg_err);
>   		if (priv->msg_err & XLP9XX_I2C_INTEN_BUSERR)
>   			xlp9xx_i2c_init(priv);
> -		return -EIO;
> +		return (priv->msg_err & XLP9XX_I2C_INTEN_NACKADDR) ?
> +			-ENXIO : -EIO;
>   	}
>   
>   	if (timeleft == 0) {
> 

Regards
-George
dann frazier Feb. 22, 2018, 6:02 p.m. UTC | #2
On Tue, Jan 30, 2018 at 7:28 AM, George Cherian
<gcherian@caviumnetworks.com> wrote:
> Gentle Ping on this series.

I've been using these on a few Cavium Sabre boards, which previously
had an unusable system interface (/dev/ipmi) due to timeouts or just
enumerations failures. So, fwiw:

Tested-by: dann frazier <dann.frazier@canonical.com>

 -dann

> On 01/18/2018 11:09 AM, George Cherian wrote:
>>
>> From: Dmitry Bazhenov <dmitry.bazhenov@auriga.com>
>>
>> Fix the driver violation of the common practice to return
>> ENXIO error on a slave address NACK.
>>
>> Signed-off-by: Dmitry Bazhenov <dmitry.bazhenov@auriga.com>
>> Signed-off-by: George Cherian <george.cherian@cavium.com>
>> ---
>>   drivers/i2c/busses/i2c-xlp9xx.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/i2c/busses/i2c-xlp9xx.c
>> b/drivers/i2c/busses/i2c-xlp9xx.c
>> index b970bf8..6d78cdc 100644
>> --- a/drivers/i2c/busses/i2c-xlp9xx.c
>> +++ b/drivers/i2c/busses/i2c-xlp9xx.c
>> @@ -324,7 +324,8 @@ static int xlp9xx_i2c_xfer_msg(struct xlp9xx_i2c_dev
>> *priv, struct i2c_msg *msg,
>>                 dev_dbg(priv->dev, "transfer error %x!\n", priv->msg_err);
>>                 if (priv->msg_err & XLP9XX_I2C_INTEN_BUSERR)
>>                         xlp9xx_i2c_init(priv);
>> -               return -EIO;
>> +               return (priv->msg_err & XLP9XX_I2C_INTEN_NACKADDR) ?
>> +                       -ENXIO : -EIO;
>>         }
>>         if (timeleft == 0) {
>>
>
> Regards
> -George
Wolfram Sang Feb. 26, 2018, 8:20 p.m. UTC | #3
On Thu, Jan 18, 2018 at 05:39:21AM +0000, George Cherian wrote:
> From: Dmitry Bazhenov <dmitry.bazhenov@auriga.com>
> 
> Fix the driver violation of the common practice to return
> ENXIO error on a slave address NACK.
> 
> Signed-off-by: Dmitry Bazhenov <dmitry.bazhenov@auriga.com>
> Signed-off-by: George Cherian <george.cherian@cavium.com>

Applied to for-next, thanks!
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-xlp9xx.c b/drivers/i2c/busses/i2c-xlp9xx.c
index b970bf8..6d78cdc 100644
--- a/drivers/i2c/busses/i2c-xlp9xx.c
+++ b/drivers/i2c/busses/i2c-xlp9xx.c
@@ -324,7 +324,8 @@  static int xlp9xx_i2c_xfer_msg(struct xlp9xx_i2c_dev *priv, struct i2c_msg *msg,
 		dev_dbg(priv->dev, "transfer error %x!\n", priv->msg_err);
 		if (priv->msg_err & XLP9XX_I2C_INTEN_BUSERR)
 			xlp9xx_i2c_init(priv);
-		return -EIO;
+		return (priv->msg_err & XLP9XX_I2C_INTEN_NACKADDR) ?
+			-ENXIO : -EIO;
 	}
 
 	if (timeleft == 0) {