linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/12] i2c: quirks: add zero length checks and update drivers
@ 2018-07-23 20:26 Wolfram Sang
  2018-07-23 20:26 ` [PATCH 04/12] i2c: omap: use core to detect 'no zero length' quirk Wolfram Sang
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Wolfram Sang @ 2018-07-23 20:26 UTC (permalink / raw)
  To: linux-i2c
  Cc: linux-arm-msm, linux-kernel, linux-renesas-soc, Wolfram Sang,
	linux-tegra, linux-omap, linux-soc, linux-arm-kernel

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,

   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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 04/12] i2c: omap: 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-10-05 12:24   ` Wolfram Sang
  2018-10-05 16:07   ` Wolfram Sang
  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
  2 siblings, 2 replies; 9+ messages in thread
From: Wolfram Sang @ 2018-07-23 20:26 UTC (permalink / raw)
  To: linux-i2c
  Cc: linux-renesas-soc, Wolfram Sang, Tony Lindgren, Aaro Koskinen,
	linux-omap, linux-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-omap.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 65d06a819307..b1086bfb0465 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -661,9 +661,6 @@ static int omap_i2c_xfer_msg(struct i2c_adapter *adap,
 	dev_dbg(omap->dev, "addr: 0x%04x, len: %d, flags: 0x%x, stop: %d\n",
 		msg->addr, msg->len, msg->flags, stop);
 
-	if (msg->len == 0)
-		return -EINVAL;
-
 	omap->receiver = !!(msg->flags & I2C_M_RD);
 	omap_i2c_resize_fifo(omap, msg->len, omap->receiver);
 
@@ -1179,6 +1176,10 @@ static const struct i2c_algorithm omap_i2c_algo = {
 	.functionality	= omap_i2c_func,
 };
 
+static const struct i2c_adapter_quirks omap_i2c_quirks = {
+	.flags = I2C_AQ_NO_ZERO_LEN,
+};
+
 #ifdef CONFIG_OF
 static struct omap_i2c_bus_platform_data omap2420_pdata = {
 	.rev = OMAP_I2C_IP_VERSION_1,
@@ -1453,6 +1454,7 @@ omap_i2c_probe(struct platform_device *pdev)
 	adap->class = I2C_CLASS_DEPRECATED;
 	strlcpy(adap->name, "OMAP I2C adapter", sizeof(adap->name));
 	adap->algo = &omap_i2c_algo;
+	adap->quirks = &omap_i2c_quirks;
 	adap->dev.parent = &pdev->dev;
 	adap->dev.of_node = pdev->dev.of_node;
 	adap->bus_recovery_info = &omap_i2c_bus_recovery_info;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [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 04/12] i2c: omap: use core to detect 'no zero length' quirk Wolfram Sang
@ 2018-07-23 20:47 ` Andy Shevchenko
  2018-08-04 21:26   ` Wolfram Sang
  2018-08-04 21:23 ` Wolfram Sang
  2 siblings, 1 reply; 9+ messages in thread
From: Andy Shevchenko @ 2018-07-23 20:47 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, Linux-Renesas, linux-arm Mailing List, linux-arm-msm,
	Linux Kernel Mailing List, Linux OMAP Mailing List, linux-soc,
	linux-tegra

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] 9+ messages in thread

* Re: [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 04/12] i2c: omap: use core to detect 'no zero length' quirk Wolfram Sang
  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
  2 siblings, 0 replies; 9+ messages in thread
From: Wolfram Sang @ 2018-08-04 21:23 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, linux-renesas-soc, linux-arm-kernel, linux-arm-msm,
	linux-kernel, linux-omap, linux-soc, linux-tegra

[-- Attachment #1: Type: text/plain, Size: 1055 bytes --]

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.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 00/12] i2c: quirks: add zero length checks and update drivers
  2018-07-23 20:47 ` [PATCH 00/12] i2c: quirks: add zero length checks and update drivers Andy Shevchenko
@ 2018-08-04 21:26   ` Wolfram Sang
  0 siblings, 0 replies; 9+ messages in thread
From: Wolfram Sang @ 2018-08-04 21:26 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Wolfram Sang, linux-i2c, Linux-Renesas, linux-arm Mailing List,
	linux-arm-msm, Linux Kernel Mailing List, Linux OMAP Mailing List,
	linux-soc, linux-tegra

[-- Attachment #1: Type: text/plain, Size: 238 bytes --]


> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> 
> for patches 1 and 2.

Thanks, Andy. If you could reply with that to the individual patches,
then patchwork picks up the tags for me making my life a little easier.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 04/12] i2c: omap: use core to detect 'no zero length' quirk
  2018-07-23 20:26 ` [PATCH 04/12] i2c: omap: use core to detect 'no zero length' quirk Wolfram Sang
@ 2018-10-05 12:24   ` Wolfram Sang
  2018-10-05 14:11     ` Grygorii Strashko
  2018-10-05 16:07   ` Wolfram Sang
  1 sibling, 1 reply; 9+ messages in thread
From: Wolfram Sang @ 2018-10-05 12:24 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, linux-renesas-soc, Tony Lindgren, Aaro Koskinen,
	linux-omap, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 184 bytes --]

On Mon, Jul 23, 2018 at 10:26:08PM +0200, Wolfram Sang wrote:
> And don't reimplement in the driver.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Ping.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 04/12] i2c: omap: use core to detect 'no zero length' quirk
  2018-10-05 12:24   ` Wolfram Sang
@ 2018-10-05 14:11     ` Grygorii Strashko
  2018-10-05 14:30       ` Tony Lindgren
  0 siblings, 1 reply; 9+ messages in thread
From: Grygorii Strashko @ 2018-10-05 14:11 UTC (permalink / raw)
  To: Wolfram Sang, Wolfram Sang
  Cc: linux-i2c, linux-renesas-soc, Tony Lindgren, Aaro Koskinen,
	linux-omap, linux-kernel



On 10/05/2018 07:24 AM, Wolfram Sang wrote:
> On Mon, Jul 23, 2018 at 10:26:08PM +0200, Wolfram Sang wrote:
>> And don't reimplement in the driver.
>>
>> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> 
> Ping.
> 

Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>

-- 
regards,
-grygorii

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 04/12] i2c: omap: use core to detect 'no zero length' quirk
  2018-10-05 14:11     ` Grygorii Strashko
@ 2018-10-05 14:30       ` Tony Lindgren
  0 siblings, 0 replies; 9+ messages in thread
From: Tony Lindgren @ 2018-10-05 14:30 UTC (permalink / raw)
  To: Grygorii Strashko
  Cc: Wolfram Sang, Wolfram Sang, linux-i2c, linux-renesas-soc,
	Aaro Koskinen, linux-omap, linux-kernel

* Grygorii Strashko <grygorii.strashko@ti.com> [181005 14:16]:
> 
> 
> On 10/05/2018 07:24 AM, Wolfram Sang wrote:
> > On Mon, Jul 23, 2018 at 10:26:08PM +0200, Wolfram Sang wrote:
> > > And don't reimplement in the driver.
> > > 
> > > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> > 
> > Ping.
> > 
> 
> Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>

Acked-by: Tony Lindgren <tony@atomide.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 04/12] i2c: omap: use core to detect 'no zero length' quirk
  2018-07-23 20:26 ` [PATCH 04/12] i2c: omap: use core to detect 'no zero length' quirk Wolfram Sang
  2018-10-05 12:24   ` Wolfram Sang
@ 2018-10-05 16:07   ` Wolfram Sang
  1 sibling, 0 replies; 9+ messages in thread
From: Wolfram Sang @ 2018-10-05 16:07 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, linux-renesas-soc, Tony Lindgren, Aaro Koskinen,
	linux-omap, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 207 bytes --]

On Mon, Jul 23, 2018 at 10:26:08PM +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!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-10-05 16:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 04/12] i2c: omap: use core to detect 'no zero length' quirk Wolfram Sang
2018-10-05 12:24   ` Wolfram Sang
2018-10-05 14:11     ` Grygorii Strashko
2018-10-05 14:30       ` Tony Lindgren
2018-10-05 16:07   ` Wolfram Sang
2018-07-23 20:47 ` [PATCH 00/12] i2c: quirks: add zero length checks and update drivers Andy Shevchenko
2018-08-04 21:26   ` Wolfram Sang
2018-08-04 21:23 ` 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).