linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa+renesas@sang-engineering.com>
To: linux-i2c@vger.kernel.org
Cc: linux-renesas-soc@vger.kernel.org,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	Jarkko Nikula <jarkko.nikula@linux.intel.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 02/12] i2c: designware-master: use core to detect 'no zero length' quirk
Date: Mon, 23 Jul 2018 22:26:06 +0200	[thread overview]
Message-ID: <20180723202617.15230-3-wsa+renesas@sang-engineering.com> (raw)
In-Reply-To: <20180723202617.15230-1-wsa+renesas@sang-engineering.com>

And don't reimplement in the driver.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Only build tested.

 drivers/i2c/busses/i2c-designware-master.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c
index fc7c255c80af..a1717bff06a8 100644
--- a/drivers/i2c/busses/i2c-designware-master.c
+++ b/drivers/i2c/busses/i2c-designware-master.c
@@ -274,13 +274,6 @@ i2c_dw_xfer_msg(struct dw_i2c_dev *dev)
 			break;
 		}
 
-		if (msgs[dev->msg_write_idx].len == 0) {
-			dev_err(dev->dev,
-				"%s: invalid message length\n", __func__);
-			dev->msg_err = -EINVAL;
-			break;
-		}
-
 		if (!(dev->status & STATUS_WRITE_IN_PROGRESS)) {
 			/* new i2c_msg */
 			buf = msgs[dev->msg_write_idx].buf;
@@ -523,6 +516,10 @@ static const struct i2c_algorithm i2c_dw_algo = {
 	.functionality = i2c_dw_func,
 };
 
+static const struct i2c_adapter_quirks i2c_dw_quirks = {
+	.flags = I2C_AQ_NO_ZERO_LEN,
+};
+
 static u32 i2c_dw_read_clear_intrbits(struct dw_i2c_dev *dev)
 {
 	u32 stat;
@@ -718,6 +715,7 @@ int i2c_dw_probe(struct dw_i2c_dev *dev)
 		 "Synopsys DesignWare I2C adapter");
 	adap->retries = 3;
 	adap->algo = &i2c_dw_algo;
+	adap->quirks = &i2c_dw_quirks;
 	adap->dev.parent = dev->dev;
 	i2c_set_adapdata(adap, dev);
 
-- 
2.11.0


  parent reply	other threads:[~2018-07-23 20:28 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 01/12] i2c: quirks: add zero length checks Wolfram Sang
2018-07-23 20:44   ` Niklas Söderlund
2018-07-23 21:05     ` Wolfram Sang
2018-08-04 21:26   ` Wolfram Sang
2018-07-23 20:26 ` Wolfram Sang [this message]
2018-08-02 14:00   ` [PATCH 02/12] i2c: designware-master: use core to detect 'no zero length' quirk Jarkko Nikula
2018-08-04 21:26   ` Wolfram Sang
2018-07-23 20:26 ` [PATCH 03/12] i2c: mxs: " Wolfram Sang
2018-08-04 21:27   ` Wolfram Sang
2018-07-23 20:26 ` [PATCH 04/12] i2c: omap: " 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:26 ` [PATCH 05/12] i2c: pmcmsp: " Wolfram Sang
2018-08-04 21:27   ` Wolfram Sang
2018-07-23 20:26 ` [PATCH 06/12] i2c: qup: " 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:26 ` [PATCH 07/12] i2c: stu300: " Wolfram Sang
2018-07-25 20:52   ` Linus Walleij
2018-08-04 21:27   ` Wolfram Sang
2018-07-23 20:26 ` [PATCH 08/12] i2c: tegra: " Wolfram Sang
2018-10-05 12:24   ` Wolfram Sang
2018-10-05 13:52   ` Jon Hunter
2018-10-05 16:08   ` Wolfram Sang
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
2018-07-23 20:26 ` [PATCH 10/12] i2c: rcar: " Wolfram Sang
2018-07-23 20:46   ` Niklas Söderlund
2018-08-04 21:27   ` Wolfram Sang
2018-07-23 20:26 ` [PATCH 11/12] i2c: xlr: " Wolfram Sang
2018-08-04 21:27   ` Wolfram Sang
2018-07-23 20:26 ` [PATCH 12/12] i2c: sh_mobile: use core to detect 'no zero length read' quirk Wolfram Sang
2018-07-23 20:54   ` Niklas Söderlund
2018-08-04 21:27   ` 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

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=20180723202617.15230-3-wsa+renesas@sang-engineering.com \
    --to=wsa+renesas@sang-engineering.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    /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).