* [PATCH 1/2] i2c: uniphier: issue STOP only for last message or I2C_M_STOP
@ 2018-08-31 14:30 Masahiro Yamada
2018-08-31 14:30 ` [PATCH 2/2] i2c: uniphier-f: " Masahiro Yamada
2018-09-01 12:52 ` [PATCH 1/2] i2c: uniphier: " Wolfram Sang
0 siblings, 2 replies; 4+ messages in thread
From: Masahiro Yamada @ 2018-08-31 14:30 UTC (permalink / raw)
To: linux-i2c; +Cc: Wolfram Sang, Masahiro Yamada, linux-arm-kernel, linux-kernel
This driver currently emits a STOP if the next message is not
I2C_MD_RD. It should not do it because it disturbs the I2C_RDWR
ioctl, where read/write transactions are combined without STOP
between.
Issue STOP only when the message is the last one _or_ flagged with
I2C_M_STOP.
Fixes: dd6fd4a32793 ("i2c: uniphier: add UniPhier FIFO-less I2C driver")
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---
drivers/i2c/busses/i2c-uniphier.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/i2c/busses/i2c-uniphier.c b/drivers/i2c/busses/i2c-uniphier.c
index bb181b0..454f914 100644
--- a/drivers/i2c/busses/i2c-uniphier.c
+++ b/drivers/i2c/busses/i2c-uniphier.c
@@ -248,11 +248,8 @@ static int uniphier_i2c_master_xfer(struct i2c_adapter *adap,
return ret;
for (msg = msgs; msg < emsg; msg++) {
- /* If next message is read, skip the stop condition */
- bool stop = !(msg + 1 < emsg && msg[1].flags & I2C_M_RD);
- /* but, force it if I2C_M_STOP is set */
- if (msg->flags & I2C_M_STOP)
- stop = true;
+ /* Emit STOP if it is the last message or I2C_M_STOP is set. */
+ bool stop = (msg + 1 == emsg) || (msg->flags & I2C_M_STOP);
ret = uniphier_i2c_master_xfer_one(adap, msg, stop);
if (ret)
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] i2c: uniphier-f: issue STOP only for last message or I2C_M_STOP
2018-08-31 14:30 [PATCH 1/2] i2c: uniphier: issue STOP only for last message or I2C_M_STOP Masahiro Yamada
@ 2018-08-31 14:30 ` Masahiro Yamada
2018-09-01 12:52 ` Wolfram Sang
2018-09-01 12:52 ` [PATCH 1/2] i2c: uniphier: " Wolfram Sang
1 sibling, 1 reply; 4+ messages in thread
From: Masahiro Yamada @ 2018-08-31 14:30 UTC (permalink / raw)
To: linux-i2c; +Cc: Wolfram Sang, Masahiro Yamada, linux-arm-kernel, linux-kernel
This driver currently emits a STOP if the next message is not
I2C_MD_RD. It should not do it because it disturbs the I2C_RDWR
ioctl, where read/write transactions are combined without STOP
between.
Issue STOP only when the message is the last one _or_ flagged with
I2C_M_STOP.
Fixes: 6a62974b667f ("i2c: uniphier_f: add UniPhier FIFO-builtin I2C driver")
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---
drivers/i2c/busses/i2c-uniphier-f.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/i2c/busses/i2c-uniphier-f.c b/drivers/i2c/busses/i2c-uniphier-f.c
index 9918bdd..a403e85 100644
--- a/drivers/i2c/busses/i2c-uniphier-f.c
+++ b/drivers/i2c/busses/i2c-uniphier-f.c
@@ -401,11 +401,8 @@ static int uniphier_fi2c_master_xfer(struct i2c_adapter *adap,
return ret;
for (msg = msgs; msg < emsg; msg++) {
- /* If next message is read, skip the stop condition */
- bool stop = !(msg + 1 < emsg && msg[1].flags & I2C_M_RD);
- /* but, force it if I2C_M_STOP is set */
- if (msg->flags & I2C_M_STOP)
- stop = true;
+ /* Emit STOP if it is the last message or I2C_M_STOP is set. */
+ bool stop = (msg + 1 == emsg) || (msg->flags & I2C_M_STOP);
ret = uniphier_fi2c_master_xfer_one(adap, msg, stop);
if (ret)
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] i2c: uniphier: issue STOP only for last message or I2C_M_STOP
2018-08-31 14:30 [PATCH 1/2] i2c: uniphier: issue STOP only for last message or I2C_M_STOP Masahiro Yamada
2018-08-31 14:30 ` [PATCH 2/2] i2c: uniphier-f: " Masahiro Yamada
@ 2018-09-01 12:52 ` Wolfram Sang
1 sibling, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2018-09-01 12:52 UTC (permalink / raw)
To: Masahiro Yamada; +Cc: linux-i2c, linux-arm-kernel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 549 bytes --]
On Fri, Aug 31, 2018 at 11:30:47PM +0900, Masahiro Yamada wrote:
> This driver currently emits a STOP if the next message is not
> I2C_MD_RD. It should not do it because it disturbs the I2C_RDWR
> ioctl, where read/write transactions are combined without STOP
> between.
>
> Issue STOP only when the message is the last one _or_ flagged with
> I2C_M_STOP.
>
> Fixes: dd6fd4a32793 ("i2c: uniphier: add UniPhier FIFO-less I2C driver")
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Applied to for-current, thanks!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] i2c: uniphier-f: issue STOP only for last message or I2C_M_STOP
2018-08-31 14:30 ` [PATCH 2/2] i2c: uniphier-f: " Masahiro Yamada
@ 2018-09-01 12:52 ` Wolfram Sang
0 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2018-09-01 12:52 UTC (permalink / raw)
To: Masahiro Yamada; +Cc: linux-i2c, linux-arm-kernel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 554 bytes --]
On Fri, Aug 31, 2018 at 11:30:48PM +0900, Masahiro Yamada wrote:
> This driver currently emits a STOP if the next message is not
> I2C_MD_RD. It should not do it because it disturbs the I2C_RDWR
> ioctl, where read/write transactions are combined without STOP
> between.
>
> Issue STOP only when the message is the last one _or_ flagged with
> I2C_M_STOP.
>
> Fixes: 6a62974b667f ("i2c: uniphier_f: add UniPhier FIFO-builtin I2C driver")
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Applied to for-current, thanks!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-09-01 12:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-31 14:30 [PATCH 1/2] i2c: uniphier: issue STOP only for last message or I2C_M_STOP Masahiro Yamada
2018-08-31 14:30 ` [PATCH 2/2] i2c: uniphier-f: " Masahiro Yamada
2018-09-01 12:52 ` Wolfram Sang
2018-09-01 12:52 ` [PATCH 1/2] i2c: uniphier: " Wolfram Sang
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).