From: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
To: <linux-i2c@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>
Cc: <nicolas.ferre@microchip.com>, <alexandre.belloni@bootlin.com>,
<ludovic.desroches@microchip.com>, <andrew@sanpeople.com>,
<mhoffman@lightlink.com>, <khali@linux-fr.org>, <wsa@kernel.org>,
<peda@axentia.se>,
Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Subject: [RESEND 1/3] i2c: at91: move i2c_recover_bus() outside of at91_do_twi_transfer()
Date: Tue, 14 Jun 2022 13:13:45 +0300 [thread overview]
Message-ID: <20220614101347.16910-2-codrin.ciubotariu@microchip.com> (raw)
In-Reply-To: <20220614101347.16910-1-codrin.ciubotariu@microchip.com>
This patch doesn't add a functional change, it just separates the recovery
from the transfer itself.
Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
---
Removed 'Fixes' tag
drivers/i2c/busses/i2c-at91-master.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/drivers/i2c/busses/i2c-at91-master.c b/drivers/i2c/busses/i2c-at91-master.c
index c0c35785a0dc..34df1614bc37 100644
--- a/drivers/i2c/busses/i2c-at91-master.c
+++ b/drivers/i2c/busses/i2c-at91-master.c
@@ -639,13 +639,6 @@ static int at91_do_twi_transfer(struct at91_twi_dev *dev)
AT91_TWI_THRCLR | AT91_TWI_LOCKCLR);
}
- /*
- * some faulty I2C slave devices might hold SDA down;
- * we can send a bus clear command, hoping that the pins will be
- * released
- */
- i2c_recover_bus(&dev->adapter);
-
return ret;
}
@@ -716,7 +709,17 @@ static int at91_twi_xfer(struct i2c_adapter *adap, struct i2c_msg *msg, int num)
ret = at91_do_twi_transfer(dev);
i2c_put_dma_safe_msg_buf(dma_buf, m_start, !ret);
- ret = (ret < 0) ? ret : num;
+ if (ret < 0) {
+ /*
+ * some faulty I2C slave devices might hold SDA down;
+ * we can send a bus clear command, hoping that the pins will be
+ * released
+ */
+ i2c_recover_bus(&dev->adapter);
+ } else {
+ ret = num;
+ }
+
out:
pm_runtime_mark_last_busy(dev->dev);
pm_runtime_put_autosuspend(dev->dev);
--
2.34.1
next prev parent reply other threads:[~2022-06-14 10:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-14 10:13 [RESEND 0/3] i2c: at91: Fixes and updates Codrin Ciubotariu
2022-06-14 10:13 ` Codrin Ciubotariu [this message]
2022-06-14 10:13 ` [RESEND 2/3] i2c: at91: keep the controller disabled when it is not used Codrin Ciubotariu
2022-06-14 10:13 ` [RESEND 3/3] i2c: at91: add advanced digital filtering support for SAMA5D4 Codrin Ciubotariu
2022-06-29 19:46 ` [RESEND 0/3] i2c: at91: Fixes and updates Wolfram Sang
2022-06-30 7:41 ` Nicolas Ferre
2022-06-30 8:09 ` Wolfram Sang
2025-03-20 22:18 ` Andi Shyti
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=20220614101347.16910-2-codrin.ciubotariu@microchip.com \
--to=codrin.ciubotariu@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=andrew@sanpeople.com \
--cc=khali@linux-fr.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ludovic.desroches@microchip.com \
--cc=mhoffman@lightlink.com \
--cc=nicolas.ferre@microchip.com \
--cc=peda@axentia.se \
--cc=wsa@kernel.org \
/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).