Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp6206465imm; Mon, 23 Jul 2018 13:28:45 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe4AUobuVMZPjxkw1lBwZSU9ERVnoA+ZQR0vLj5U1JjvMdb+Vrgi4V8I6pdcQ9IWxhps5CF X-Received: by 2002:a65:5a01:: with SMTP id y1-v6mr13516827pgs.125.1532377725025; Mon, 23 Jul 2018 13:28:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532377725; cv=none; d=google.com; s=arc-20160816; b=m/hmjznFZIGR6V/p6sI+B2glewIgzbjkfxk3uRg6UIwh9W+ZqoyXmZta5PHPx0IU0p zP3XlyzyF4Be8vmHkoLZEEw9eH/M9cZOGY0DUrMsSBNzbDVNHT4xJWkCVZlVELvtNWYG gfkbgiYibgpSze4jSe8csB1QeafimpElt0+rDW+SjDZ9wUyyM02Uq8Fv+wAa5WffjD8K uSo5jTaQ6ypdnPAv5hC+eC471S1UkPhmJb2PIgkaPpQCEvTf8nrPlJ3By2qDUhpFJXUo PXtIzyxvjNwHy/w+9hlXtVmK8hTefhAMpInJ8jxA4j6P9M3A0Bf0cR4BmFJjbOZiHX6a D8kw== 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=GiY73/VBGq7v4bL3Qs8jtpjWy8Obus7wWkUUX+YwNuc=; b=ukl08ZPcXFGoUmBkTKwH1U6hbo1qUJ7V6IJqThq1kXAzprpPyuKvE8d9pzt0UQvfZ5 ntFR7k/KOz2pAHj63cX7JNTLEPvDBj79WHGODu6UrUt5ODpyHnuZiDGgYrfBhQgvrPuK hCRbsYI5OsTlcVwZGR/qZoilZRIueEoqWfxK/Ny1of+rQ6p4Eghf8wDXd70eiq2nX89d DtHcPMUFd/LUMjGUGnFznxE7+nBgQtQFcQIHtM1P5+PHONfdbLInZM3X2lWivmj7lSgD qS1SOZvzp9a9Axjnp1YxVlnUe2U1VNlulOfiyOBckGekrqNj/snqmsaYGd8uEOr/LuJm 1FMw== 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 x3-v6si10469097pfj.289.2018.07.23.13.28.30; Mon, 23 Jul 2018 13:28:44 -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 S2388325AbeGWV34 (ORCPT + 99 others); Mon, 23 Jul 2018 17:29:56 -0400 Received: from sauhun.de ([88.99.104.3]:51290 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388280AbeGWV3z (ORCPT ); Mon, 23 Jul 2018 17:29:55 -0400 Received: from localhost (p54B3377D.dip0.t-ipconnect.de [84.179.55.125]) by pokefinder.org (Postfix) with ESMTPSA id B5D24631A53; Mon, 23 Jul 2018 22:27:01 +0200 (CEST) From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, Wolfram Sang , linux-kernel@vger.kernel.org Subject: [PATCH 11/12] i2c: xlr: use core to detect 'no zero length' quirk Date: Mon, 23 Jul 2018 22:26:15 +0200 Message-Id: <20180723202617.15230-12-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-xlr.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/i2c/busses/i2c-xlr.c b/drivers/i2c/busses/i2c-xlr.c index 484bfa15d58e..34cd4b308540 100644 --- a/drivers/i2c/busses/i2c-xlr.c +++ b/drivers/i2c/busses/i2c-xlr.c @@ -173,9 +173,6 @@ static int xlr_i2c_tx(struct xlr_i2c_private *priv, u16 len, u8 offset; u32 xfer; - if (!len) - return -EOPNOTSUPP; - offset = buf[0]; xlr_i2c_wreg(priv->iobase, XLR_I2C_ADDR, offset); xlr_i2c_wreg(priv->iobase, XLR_I2C_DEVADDR, addr); @@ -241,9 +238,6 @@ static int xlr_i2c_rx(struct xlr_i2c_private *priv, u16 len, u8 *buf, u16 addr) unsigned long timeout, stoptime, checktime; int nbytes, timedout; - if (!len) - return -EOPNOTSUPP; - xlr_i2c_wreg(priv->iobase, XLR_I2C_CFG, XLR_I2C_CFG_NOADDR | priv->cfg->cfg_extra); xlr_i2c_wreg(priv->iobase, XLR_I2C_BYTECNT, len - 1); @@ -340,6 +334,10 @@ static const struct i2c_algorithm xlr_i2c_algo = { .functionality = xlr_func, }; +static const struct i2c_adapter_quirks xlr_i2c_quirks = { + .flags = I2C_AQ_NO_ZERO_LEN, +}; + static const struct xlr_i2c_config xlr_i2c_config_default = { .status_busy = XLR_I2C_BUS_BUSY, .cfg_extra = 0, @@ -427,6 +425,7 @@ static int xlr_i2c_probe(struct platform_device *pdev) priv->adap.owner = THIS_MODULE; priv->adap.algo_data = priv; priv->adap.algo = &xlr_i2c_algo; + priv->adap.quirks = &xlr_i2c_quirks; priv->adap.nr = pdev->id; priv->adap.class = I2C_CLASS_HWMON; snprintf(priv->adap.name, sizeof(priv->adap.name), "xlr-i2c"); -- 2.11.0