[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220930014405.5469-1-taolan@huawei.com>
Date: Fri, 30 Sep 2022 01:44:05 +0000
From: Tao Lan <taolan@...wei.com>
To: <linux-i2c@...r.kernel.org>, <linux-kernel@...r.kernel.org>
CC: taolan <taolan@...wei.com>
Subject: [PATCH] i2c-hix5hd2: Add more debug info when transfer fail.
From: taolan <taolan@...wei.com>
The transfer result is checked, classified, and printed, which
facilitates debugging.
---
drivers/i2c/busses/i2c-hix5hd2.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-hix5hd2.c b/drivers/i2c/busses/i2c-hix5hd2.c
index 61ae58f57047..e6ab8b20cd01 100644
--- a/drivers/i2c/busses/i2c-hix5hd2.c
+++ b/drivers/i2c/busses/i2c-hix5hd2.c
@@ -366,8 +366,17 @@ static int hix5hd2_i2c_xfer(struct i2c_adapter *adap,
goto out;
}
- ret = num;
+ if (i == num) {
+ ret = num;
+ } else {
+ /* Only one message, cannot access the device */
+ if (i == 1)
+ ret = -EREMOTEIO;
+ else
+ ret = i;
+ pr_warning("xfer message failed\n");
+ }
out:
pm_runtime_mark_last_busy(priv->dev);
pm_runtime_put_autosuspend(priv->dev);
--
2.22.0
Powered by blists - more mailing lists