Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp6205989imm; Mon, 23 Jul 2018 13:28:08 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeMipUyqLeY+eeAn5zMejK2SujlS4NglzF2xneTpHMkZopzZj0rRhlNj8b3qqe/8T0wyGgL X-Received: by 2002:a17:902:968c:: with SMTP id n12-v6mr14163135plp.15.1532377688156; Mon, 23 Jul 2018 13:28:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532377688; cv=none; d=google.com; s=arc-20160816; b=ACmHeSNHS7q8ZvVGhjKE8FZjylvb+GBIU39PUn2RpVMioDhQdbBKzCcM4Holiztddt jQXed/kahRLGI9WMoulxEfs/U2+7KP7RD6flpfxh9LNNR64aN52zrKfcRXkRPGK/7FED aa7srVQvlVOdYDL7ng0losJyyUMAP37OYuNkCEY11F8XozT95L/cpt/1SLuag7s+qTLA bFOlrXpO0lwPBYan/x/4sz6THSyQz78dgmcGXHuIjbBZ77C/w8tC8sL8pAQv8EGkSZhD yls7mieBhTkUbSC2/C8ou8XYOMVkysg/MCVwlAu8MSTKHQV66ubry764d4A6wMfpcigh tfng== 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=LQ9mdCnSnmghKogrGvfUkhVyChDspe6ENVG0o2CoC5o=; b=NSeXuc6rfK7lSY+57Qjf7mPdkOUgZdTObCb5/6kKL14xF5gUkc2DrLaBUH4JqCs0e7 iNqWgMpwjusK2gCv+VV1I1y3g2s2udZVEdvEtPzz8Oow5V/69mWEm5LF5WFre5EuFagw rFKWD9oQ6rSL9K9ARt0o9E6Fc6k3h3H6ODjGez6NM3SKz695VuOG08SM5pDh3pyr/zJf wzR5kyVmzXbKkIRGTX5ayzPRK6obgUt3RRVICq7aZOTIOm5mqEbCmcL2NeTTLFIrAv0f v81bI8J9SmyN8VVRE6N/kB9QF6fuk504exHIjDNd1uPKB/ctXQcINnIq1ASLJW9RqZOC XHjA== 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 b25-v6si9247338pgf.545.2018.07.23.13.27.53; Mon, 23 Jul 2018 13:28:08 -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 S2388274AbeGWV3v (ORCPT + 99 others); Mon, 23 Jul 2018 17:29:51 -0400 Received: from sauhun.de ([88.99.104.3]:51266 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388201AbeGWV3u (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 D17CC631A4A; 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 , Linus Walleij , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 07/12] i2c: stu300: use core to detect 'no zero length' quirk Date: Mon, 23 Jul 2018 22:26:11 +0200 Message-Id: <20180723202617.15230-8-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-stu300.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/i2c/busses/i2c-stu300.c b/drivers/i2c/busses/i2c-stu300.c index fce52bdab2b7..5503fa171df0 100644 --- a/drivers/i2c/busses/i2c-stu300.c +++ b/drivers/i2c/busses/i2c-stu300.c @@ -673,12 +673,6 @@ static int stu300_xfer_msg(struct i2c_adapter *adap, msg->addr, msg->len, msg->flags, stop); } - /* Zero-length messages are not supported by this hardware */ - if (msg->len == 0) { - ret = -EINVAL; - goto exit_disable; - } - /* * For some reason, sending the address sometimes fails when running * on the 13 MHz clock. No interrupt arrives. This is a work around, @@ -863,6 +857,10 @@ static const struct i2c_algorithm stu300_algo = { .functionality = stu300_func, }; +static const struct i2c_adapter_quirks stu300_quirks = { + .flags = I2C_AQ_NO_ZERO_LEN, +}; + static int stu300_probe(struct platform_device *pdev) { struct stu300_dev *dev; @@ -920,6 +918,8 @@ static int stu300_probe(struct platform_device *pdev) adap->algo = &stu300_algo; adap->dev.parent = &pdev->dev; adap->dev.of_node = pdev->dev.of_node; + adap->quirks = &stu300_quirks; + i2c_set_adapdata(adap, dev); /* i2c device drivers may be active on return from add_adapter() */ -- 2.11.0