Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp6206957imm; Mon, 23 Jul 2018 13:29:25 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdMo0Kq8uzDSHKJaf6A+ToxN8zgTIbbUG4VzOc7iVujFOGmt63Y6Q9hRlDWoEhoY2sLDHSl X-Received: by 2002:a62:4b48:: with SMTP id y69-v6mr14693351pfa.93.1532377765233; Mon, 23 Jul 2018 13:29:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532377765; cv=none; d=google.com; s=arc-20160816; b=UHjBdKRqU/ii1+qul2423vEHBJgr7meBT2/6GMEVVCqwuMpL0MNm04rElG7SjN9pob oPZ71L4jp2ZhoDpuY50jkKu3imf55OK4vavO2CUo2QQ0D/G/d4L346BDl3wbh8VUSpzw qfkZ5qJeR6prkHb9qxCVhNRcLmePLpxVpn6wFTQWFLjlja6LXynJ5tdhrnK3LlP6eYak tHn+r+1b7dEO6TZnT5nVUWJbhwyFOi7UJl5AkexBJJgJ2KGWnOkZK8Mz18/hGMybED+H JudS+HqAydfMhzW8D8sMNmJsYav9YGgyDsnjV90oqdLiSYQwuQI7RjCu+Y5eX0QIN1XV BI5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=wAJjGBN7BnWQ1UrCECujk+IAU9SbPk0UWm3rj4Zy5c0=; b=agmd/oCkz1ohDb46OC9aEod5lk926Iq2zmfozJwOWOZZOKU3A07f3ZJqwlTcZdjx+3 NKEdwhLLfFyStaQK39+Xy8yMgbI4Z1AIC1X4YAtBu03Cb7nU47MSfbGX1axvLdEdA4t2 7Q3UU7qpb7F/bLlm09XWy/conf4falMMt07f4+ra4XFqr+zg+Pso4Zc3OJXHDOxl3For gdzTJgYvSNZmNI5ugZELgkawlNTety0zWAZjSQ/oSWINiXT1NjtaEEpu9ChkOdTEgG5Q xz7ryJvBFuTgkCnNiCKY6mwIXubZ/a5+BnHykG2TZ8kEwujQO9oekPIxgwMmTyqT83sM ouCQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 87-v6si9890599pfi.60.2018.07.23.13.29.10; Mon, 23 Jul 2018 13:29:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388256AbeGWV3v (ORCPT + 99 others); Mon, 23 Jul 2018 17:29:51 -0400 Received: from sauhun.de ([88.99.104.3]:51260 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388039AbeGWV3u (ORCPT ); Mon, 23 Jul 2018 17:29:50 -0400 Received: from localhost (p54B3377D.dip0.t-ipconnect.de [84.179.55.125]) by pokefinder.org (Postfix) with ESMTPSA id 2CDAE631A4F; Mon, 23 Jul 2018 22:26:56 +0200 (CEST) From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, Wolfram Sang , Andy Gross , David Brown , linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 06/12] i2c: qup: use core to detect 'no zero length' quirk Date: Mon, 23 Jul 2018 22:26:10 +0200 Message-Id: <20180723202617.15230-7-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180723202617.15230-1-wsa+renesas@sang-engineering.com> References: <20180723202617.15230-1-wsa+renesas@sang-engineering.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org And don't reimplement in the driver. Signed-off-by: Wolfram Sang --- 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