linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa@kernel.org>
To: linux-i2c@vger.kernel.org
Cc: nick.hawkins@hpe.com, Wolfram Sang <wsa@kernel.org>
Subject: [PATCH] i2c: gxp: return proper error on address NACK
Date: Mon, 20 Feb 2023 15:40:59 +0100	[thread overview]
Message-ID: <20230220144059.77213-1-wsa@kernel.org> (raw)

According to Documentation/i2c/fault-codes.rst, NACK after sending an
address should be -ENXIO.

Signed-off-by: Wolfram Sang <wsa@kernel.org>
---

Depends on: "[PATCH] i2c: gxp: remove "empty" switch statement"

 drivers/i2c/busses/i2c-gxp.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-gxp.c b/drivers/i2c/busses/i2c-gxp.c
index 352dedf6292f..fda7809e72ba 100644
--- a/drivers/i2c/busses/i2c-gxp.c
+++ b/drivers/i2c/busses/i2c-gxp.c
@@ -129,8 +129,10 @@ static int gxp_i2c_master_xfer(struct i2c_adapter *adapter,
 	if (time_left == 0)
 		return -ETIMEDOUT;
 
-	if (drvdata->state == GXP_I2C_ADDR_NACK ||
-	    drvdata->state == GXP_I2C_DATA_NACK)
+	if (drvdata->state == GXP_I2C_ADDR_NACK)
+		return -ENXIO;
+
+	if (drvdata->state == GXP_I2C_DATA_NACK)
 		return -EIO;
 
 	return ret;
-- 
2.30.2


             reply	other threads:[~2023-02-20 14:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-20 14:40 Wolfram Sang [this message]
2023-03-03 20:00 ` [PATCH] i2c: gxp: return proper error on address NACK Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230220144059.77213-1-wsa@kernel.org \
    --to=wsa@kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=nick.hawkins@hpe.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).