* [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 06/12] i2c: qup: use core to detect 'no zero length' quirk Wolfram Sang
` (2 more replies)
0 siblings, 3 replies; 8+ 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] 8+ messages in thread
* [PATCH 06/12] i2c: qup: 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
` (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
2 siblings, 3 replies; 8+ messages in thread
From: Wolfram Sang @ 2018-07-23 20:26 UTC (permalink / raw)
To: linux-i2c
Cc: linux-renesas-soc, Wolfram Sang, Andy Gross, David Brown,
linux-arm-msm, linux-soc, 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-qup.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c
index c86c3ae1318f..e09cd0775ae9 100644
--- a/drivers/i2c/busses/i2c-qup.c
+++ b/drivers/i2c/busses/i2c-qup.c
@@ -1088,11 +1088,6 @@ static int qup_i2c_xfer(struct i2c_adapter *adap,
writel(I2C_MINI_CORE | I2C_N_VAL, qup->base + QUP_CONFIG);
for (idx = 0; idx < num; idx++) {
- if (msgs[idx].len == 0) {
- ret = -EINVAL;
- goto out;
- }
-
if (qup_i2c_poll_state_i2c_master(qup)) {
ret = -EIO;
goto out;
@@ -1520,9 +1515,6 @@ qup_i2c_determine_mode_v2(struct qup_i2c_dev *qup,
/* All i2c_msgs should be transferred using either dma or cpu */
for (idx = 0; idx < num; idx++) {
- if (msgs[idx].len == 0)
- return -EINVAL;
-
if (msgs[idx].flags & I2C_M_RD)
max_rx_len = max_t(unsigned int, max_rx_len,
msgs[idx].len);
@@ -1636,9 +1628,14 @@ static const struct i2c_algorithm qup_i2c_algo_v2 = {
* which limits the possible read to 256 (QUP_READ_LIMIT) bytes.
*/
static const struct i2c_adapter_quirks qup_i2c_quirks = {
+ .flags = I2C_AQ_NO_ZERO_LEN,
.max_read_len = QUP_READ_LIMIT,
};
+static const struct i2c_adapter_quirks qup_i2c_quirks_v2 = {
+ .flags = I2C_AQ_NO_ZERO_LEN,
+};
+
static void qup_i2c_enable_clocks(struct qup_i2c_dev *qup)
{
clk_prepare_enable(qup->clk);
@@ -1701,6 +1698,7 @@ static int qup_i2c_probe(struct platform_device *pdev)
is_qup_v1 = true;
} else {
qup->adap.algo = &qup_i2c_algo_v2;
+ qup->adap.quirks = &qup_i2c_quirks_v2;
is_qup_v1 = false;
if (acpi_match_device(qup_i2c_acpi_match, qup->dev))
goto nodma;
--
2.11.0
^ permalink raw reply related [flat|nested] 8+ 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 06/12] i2c: qup: 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; 8+ 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] 8+ 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 06/12] i2c: qup: 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; 8+ 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] 8+ 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; 8+ 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] 8+ messages in thread
* Re: [PATCH 06/12] i2c: qup: use core to detect 'no zero length' quirk
2018-07-23 20:26 ` [PATCH 06/12] i2c: qup: use core to detect 'no zero length' quirk Wolfram Sang
@ 2018-10-05 12:24 ` Wolfram Sang
2018-10-05 14:23 ` Andy Gross
2018-10-05 16:07 ` Wolfram Sang
2 siblings, 0 replies; 8+ messages in thread
From: Wolfram Sang @ 2018-10-05 12:24 UTC (permalink / raw)
To: Wolfram Sang
Cc: linux-i2c, linux-renesas-soc, Andy Gross, David Brown,
linux-arm-msm, linux-soc, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 184 bytes --]
On Mon, Jul 23, 2018 at 10:26:10PM +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] 8+ messages in thread
* Re: [PATCH 06/12] i2c: qup: use core to detect 'no zero length' quirk
2018-07-23 20:26 ` [PATCH 06/12] i2c: qup: use core to detect 'no zero length' quirk Wolfram Sang
2018-10-05 12:24 ` Wolfram Sang
@ 2018-10-05 14:23 ` Andy Gross
2018-10-05 16:07 ` Wolfram Sang
2 siblings, 0 replies; 8+ messages in thread
From: Andy Gross @ 2018-10-05 14:23 UTC (permalink / raw)
To: Wolfram Sang
Cc: linux-i2c, linux-renesas-soc, David Brown, linux-arm-msm,
linux-soc, linux-kernel
On Mon, Jul 23, 2018 at 10:26:10PM +0200, Wolfram Sang wrote:
> And don't reimplement in the driver.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
Reviewed-by: Andy Gross <andy.gross@linaro.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 06/12] i2c: qup: use core to detect 'no zero length' quirk
2018-07-23 20:26 ` [PATCH 06/12] i2c: qup: use core to detect 'no zero length' quirk Wolfram Sang
2018-10-05 12:24 ` Wolfram Sang
2018-10-05 14:23 ` Andy Gross
@ 2018-10-05 16:07 ` Wolfram Sang
2 siblings, 0 replies; 8+ messages in thread
From: Wolfram Sang @ 2018-10-05 16:07 UTC (permalink / raw)
To: Wolfram Sang
Cc: linux-i2c, linux-renesas-soc, Andy Gross, David Brown,
linux-arm-msm, linux-soc, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 207 bytes --]
On Mon, Jul 23, 2018 at 10:26:10PM +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] 8+ messages in thread
end of thread, other threads:[~2018-10-05 16:07 UTC | newest]
Thread overview: 8+ 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 06/12] i2c: qup: use core to detect 'no zero length' quirk Wolfram Sang
2018-10-05 12:24 ` Wolfram Sang
2018-10-05 14:23 ` Andy Gross
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).