* [PATCH 07/12] i2c: stu300: use core to detect 'no zero length' quirk
2018-07-23 20:26 [PATCH 00/12] i2c: quirks: add zero length checks and update drivers Wolfram Sang
@ 2018-07-23 20:26 ` Wolfram Sang
2018-07-25 20:52 ` Linus Walleij
2018-08-04 21:27 ` Wolfram Sang
2018-07-23 20:26 ` [PATCH 09/12] i2c: zx2967: " Wolfram Sang
` (2 subsequent siblings)
3 siblings, 2 replies; 11+ messages in thread
From: Wolfram Sang @ 2018-07-23 20:26 UTC (permalink / raw)
To: linux-arm-kernel
And don't reimplement in the driver.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
Only build tested.
drivers/i2c/busses/i2c-stu300.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/i2c/busses/i2c-stu300.c b/drivers/i2c/busses/i2c-stu300.c
index fce52bdab2b7..5503fa171df0 100644
--- a/drivers/i2c/busses/i2c-stu300.c
+++ b/drivers/i2c/busses/i2c-stu300.c
@@ -673,12 +673,6 @@ static int stu300_xfer_msg(struct i2c_adapter *adap,
msg->addr, msg->len, msg->flags, stop);
}
- /* Zero-length messages are not supported by this hardware */
- if (msg->len == 0) {
- ret = -EINVAL;
- goto exit_disable;
- }
-
/*
* For some reason, sending the address sometimes fails when running
* on the 13 MHz clock. No interrupt arrives. This is a work around,
@@ -863,6 +857,10 @@ static const struct i2c_algorithm stu300_algo = {
.functionality = stu300_func,
};
+static const struct i2c_adapter_quirks stu300_quirks = {
+ .flags = I2C_AQ_NO_ZERO_LEN,
+};
+
static int stu300_probe(struct platform_device *pdev)
{
struct stu300_dev *dev;
@@ -920,6 +918,8 @@ static int stu300_probe(struct platform_device *pdev)
adap->algo = &stu300_algo;
adap->dev.parent = &pdev->dev;
adap->dev.of_node = pdev->dev.of_node;
+ adap->quirks = &stu300_quirks;
+
i2c_set_adapdata(adap, dev);
/* i2c device drivers may be active on return from add_adapter() */
--
2.11.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 09/12] i2c: zx2967: use core to detect 'no zero length' quirk
2018-07-23 20:26 [PATCH 00/12] i2c: quirks: add zero length checks and update drivers Wolfram Sang
2018-07-23 20:26 ` [PATCH 07/12] i2c: stu300: use core to detect 'no zero length' quirk Wolfram Sang
@ 2018-07-23 20:26 ` Wolfram Sang
2018-10-05 12:24 ` Wolfram Sang
` (2 more replies)
2018-07-23 20:47 ` [PATCH 00/12] i2c: quirks: add zero length checks and update drivers Andy Shevchenko
2018-08-04 21:23 ` Wolfram Sang
3 siblings, 3 replies; 11+ messages in thread
From: Wolfram Sang @ 2018-07-23 20:26 UTC (permalink / raw)
To: linux-arm-kernel
And don't reimplement in the driver.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
Only build tested.
drivers/i2c/busses/i2c-zx2967.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/i2c/busses/i2c-zx2967.c b/drivers/i2c/busses/i2c-zx2967.c
index 48281c1b30c6..b8f9e020d80e 100644
--- a/drivers/i2c/busses/i2c-zx2967.c
+++ b/drivers/i2c/busses/i2c-zx2967.c
@@ -281,9 +281,6 @@ static int zx2967_i2c_xfer_msg(struct zx2967_i2c *i2c,
int ret;
int i;
- if (msg->len == 0)
- return -EINVAL;
-
zx2967_i2c_flush_fifos(i2c);
i2c->cur_trans = msg->buf;
@@ -498,6 +495,10 @@ static const struct i2c_algorithm zx2967_i2c_algo = {
.functionality = zx2967_i2c_func,
};
+static const struct i2c_adapter_quirks zx2967_i2c_quirks = {
+ .flags = I2C_AQ_NO_ZERO_LEN,
+};
+
static const struct of_device_id zx2967_i2c_of_match[] = {
{ .compatible = "zte,zx296718-i2c", },
{ },
@@ -568,6 +569,7 @@ static int zx2967_i2c_probe(struct platform_device *pdev)
strlcpy(i2c->adap.name, "zx2967 i2c adapter",
sizeof(i2c->adap.name));
i2c->adap.algo = &zx2967_i2c_algo;
+ i2c->adap.quirks = &zx2967_i2c_quirks;
i2c->adap.nr = pdev->id;
i2c->adap.dev.parent = &pdev->dev;
i2c->adap.dev.of_node = pdev->dev.of_node;
--
2.11.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 09/12] i2c: zx2967: use core to detect 'no zero length' quirk
2018-07-23 20:26 ` [PATCH 09/12] i2c: zx2967: " Wolfram Sang
@ 2018-10-05 12:24 ` Wolfram Sang
2018-10-05 13:04 ` Shawn Guo
2018-10-05 16:08 ` Wolfram Sang
2 siblings, 0 replies; 11+ messages in thread
From: Wolfram Sang @ 2018-10-05 12:24 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Jul 23, 2018 at 10:26:13PM +0200, Wolfram Sang wrote:
> And don't reimplement in the driver.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Ping.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20181005/252e95a7/attachment.sig>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 09/12] i2c: zx2967: use core to detect 'no zero length' quirk
2018-07-23 20:26 ` [PATCH 09/12] i2c: zx2967: " Wolfram Sang
2018-10-05 12:24 ` Wolfram Sang
@ 2018-10-05 13:04 ` Shawn Guo
2018-10-05 16:08 ` Wolfram Sang
2 siblings, 0 replies; 11+ messages in thread
From: Shawn Guo @ 2018-10-05 13:04 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Jul 23, 2018 at 10:26:13PM +0200, Wolfram Sang wrote:
> And don't reimplement in the driver.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Shawn Guo <shawnguo@kernel.org>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 09/12] i2c: zx2967: use core to detect 'no zero length' quirk
2018-07-23 20:26 ` [PATCH 09/12] i2c: zx2967: " Wolfram Sang
2018-10-05 12:24 ` Wolfram Sang
2018-10-05 13:04 ` Shawn Guo
@ 2018-10-05 16:08 ` Wolfram Sang
2 siblings, 0 replies; 11+ messages in thread
From: Wolfram Sang @ 2018-10-05 16:08 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Jul 23, 2018 at 10:26:13PM +0200, Wolfram Sang wrote:
> And don't reimplement in the driver.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Applied to for-next, thanks!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20181005/04b9eb57/attachment.sig>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 00/12] i2c: quirks: add zero length checks and update drivers
2018-07-23 20:26 [PATCH 00/12] i2c: quirks: add zero length checks and update drivers Wolfram Sang
2018-07-23 20:26 ` [PATCH 07/12] i2c: stu300: use core to detect 'no zero length' quirk Wolfram Sang
2018-07-23 20:26 ` [PATCH 09/12] i2c: zx2967: " Wolfram Sang
@ 2018-07-23 20:47 ` Andy Shevchenko
2018-08-04 21:26 ` Wolfram Sang
2018-08-04 21:23 ` Wolfram Sang
3 siblings, 1 reply; 11+ messages in thread
From: Andy Shevchenko @ 2018-07-23 20:47 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Jul 23, 2018 at 11:26 PM, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> I had this idea for quite some time on my todo list but a soon to be
> implemented refactoring in the i2c-rcar driver now finally made me do it. Add a
> 'can't do 0 length messages' quirk to the quirk infrastructure for and remove
> the manual handling from the drivers. This makes the quirk much more visible.
> (Quite some prominent vendors in that list) We also have a centralized place to
> handle updates to the quirk detection if that is ever needed.
>
> I have tested this with the i2c-rcar and i2c-sh_mobile driver on a Renesas
> SalvatorXS board equipped with M3-N (r8a77965).
>
> A git branch can be found here:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/quirk-no-zero-len
>
> Looking forward to comments, reviews, tests...
Thanks!
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
for patches 1 and 2.
>
> Thanks,
>
> Wolfram
>
> Wolfram Sang (12):
> i2c: quirks: add zero length checks
> i2c: designware-master: use core to detect 'no zero length' quirk
> i2c: mxs: use core to detect 'no zero length' quirk
> i2c: omap: use core to detect 'no zero length' quirk
> i2c: pmcmsp: use core to detect 'no zero length' quirk
> i2c: qup: use core to detect 'no zero length' quirk
> i2c: stu300: use core to detect 'no zero length' quirk
> i2c: tegra: use core to detect 'no zero length' quirk
> i2c: zx2967: use core to detect 'no zero length' quirk
> i2c: rcar: use core to detect 'no zero length' quirk
> i2c: xlr: use core to detect 'no zero length' quirk
> i2c: sh_mobile: use core to detect 'no zero length read' quirk
>
> drivers/i2c/busses/i2c-designware-master.c | 12 +++++-------
> drivers/i2c/busses/i2c-mxs.c | 8 +++++---
> drivers/i2c/busses/i2c-omap.c | 8 +++++---
> drivers/i2c/busses/i2c-pmcmsp.c | 17 +----------------
> drivers/i2c/busses/i2c-qup.c | 14 ++++++--------
> drivers/i2c/busses/i2c-rcar.c | 13 ++++++-------
> drivers/i2c/busses/i2c-sh_mobile.c | 10 +++++-----
> drivers/i2c/busses/i2c-stu300.c | 12 ++++++------
> drivers/i2c/busses/i2c-tegra.c | 4 +---
> drivers/i2c/busses/i2c-xlr.c | 11 +++++------
> drivers/i2c/busses/i2c-zx2967.c | 8 +++++---
> drivers/i2c/i2c-core-base.c | 6 ++++++
> include/linux/i2c.h | 4 ++++
> 13 files changed, 60 insertions(+), 67 deletions(-)
>
> --
> 2.11.0
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 00/12] i2c: quirks: add zero length checks and update drivers
2018-07-23 20:26 [PATCH 00/12] i2c: quirks: add zero length checks and update drivers Wolfram Sang
` (2 preceding siblings ...)
2018-07-23 20:47 ` [PATCH 00/12] i2c: quirks: add zero length checks and update drivers Andy Shevchenko
@ 2018-08-04 21:23 ` Wolfram Sang
3 siblings, 0 replies; 11+ messages in thread
From: Wolfram Sang @ 2018-08-04 21:23 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Jul 23, 2018 at 10:26:04PM +0200, Wolfram Sang wrote:
> I had this idea for quite some time on my todo list but a soon to be
> implemented refactoring in the i2c-rcar driver now finally made me do it. Add a
> 'can't do 0 length messages' quirk to the quirk infrastructure for and remove
> the manual handling from the drivers. This makes the quirk much more visible.
> (Quite some prominent vendors in that list) We also have a centralized place to
> handle updates to the quirk detection if that is ever needed.
>
> I have tested this with the i2c-rcar and i2c-sh_mobile driver on a Renesas
> SalvatorXS board equipped with M3-N (r8a77965).
>
> A git branch can be found here:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/quirk-no-zero-len
>
> Looking forward to comments, reviews, tests...
I applied all the patches which either got acks from the maintainers or
have no maintainers. I'll reply individually to which I applied. I will
wait some more for other acks before I'll resend next cycle.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180804/347af39a/attachment-0001.sig>
^ permalink raw reply [flat|nested] 11+ messages in thread