Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp6219135imm; Mon, 23 Jul 2018 13:45:33 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf6/jagQVfUX1Gvxph9kIqOLBf4nkFoS1/8BFXXeWS/Po019qldfnvbcCpE+p0wXHye6Oyn X-Received: by 2002:a63:6e08:: with SMTP id j8-v6mr13561285pgc.428.1532378733819; Mon, 23 Jul 2018 13:45:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532378733; cv=none; d=google.com; s=arc-20160816; b=c3QJnBn4TdgS2q9lOQ/+p+BjGHMigrNmZy4f3jEe5egb0RLQxePmlkk+eWKO5tkMMw RCpjOPK7Ty49tdHI/CdlX3l+UOjHKwOQxv3ZOUwHuI+yqU2S/TJCSkDY5V6QHedFXvpD wI+eZjUWCyrNtN0fBii9izVWpMdR2ejsEjQzlQMz7KANouRsvIiRv2PkC3WVqxtLjte2 lnYTOq0oZtPDh72jZFcQXCn4y8hWqlKHvuM0z0ffETAqLoVmmo7ZMhrQMrHmGJmEMYJ5 MR7MGKUW33iN41kVRzOTLtNDhML64aBCALd5HnbWTqoKEpR/90NLoBc2bM/RoqJHYkJi QxoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=zT/aNVdRalolKI5HF1lQ0LXAv/wZ+Yr3HVAQanpBEOk=; b=sZis4Vj1MiID9EIuPTTDEX/MA52MaLEVD4SMM3pZIzsyD8Fnquh3G7BK+q9pR4rLvX rGGHBTk+kSCN0TQOcgS07DzufR8usPNubq8vnPqx65grQHS56hv8GbY4Qk5/+uVEJ1Iy Zcc+IdXjrr+3q5VRrOl2B+paZNNbPrZjBwo7zUNQSAPQOaDjlO3r31UoIT54TWCRsCfF xgD5exEDurbu55k0T8n1joUn/ppvjvqWI6TDkT0g0DYtLCqXHmBlHLVH2XyPSOvVvU2p 3u+cbTgxvw06wm8O3zX5PHVRM/uufa24LF2WvLktxA+uh9k4vIB/1FPJ6ilnCp8TMf5P NEVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ragnatech-se.20150623.gappssmtp.com header.s=20150623 header.b=ejq8dMXC; 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 p11-v6si9645950pgh.274.2018.07.23.13.45.17; Mon, 23 Jul 2018 13:45:33 -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; dkim=pass header.i=@ragnatech-se.20150623.gappssmtp.com header.s=20150623 header.b=ejq8dMXC; 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 S2388096AbeGWVrS (ORCPT + 99 others); Mon, 23 Jul 2018 17:47:18 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:43354 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728366AbeGWVrS (ORCPT ); Mon, 23 Jul 2018 17:47:18 -0400 Received: by mail-lj1-f195.google.com with SMTP id r13-v6so1685261ljg.10 for ; Mon, 23 Jul 2018 13:44:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech-se.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=zT/aNVdRalolKI5HF1lQ0LXAv/wZ+Yr3HVAQanpBEOk=; b=ejq8dMXCq+pKYczk93neLeEcQrDPpkuucK6sypM0hdtthvjx0+9lpvagD7fMk0kDYH 3lF7+cH5KNkr8s1E8QbWDmZS3rrcBD34fQOSu/Ulu+dGjvCF177bVtLe7zD6uIy/FLxo ki/74liLHc9TE9MOcl6XYPmUG0LXS3XTfmHDtuQVR3PkimOJCBFJHvw7tYPko7lc9GU0 Fu7QmElckXpDP4uPhaKgobGrE8v5B/BILwTu/dIr0MXVAIncqR6wCgx+vVqtlfad+Hkp 5Pg8fVlpmj2In+lvxW369KFifQOh1gozFpsskqYR5fS8Ogs10G1UKkbqelKvyVIb/7jY S7Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=zT/aNVdRalolKI5HF1lQ0LXAv/wZ+Yr3HVAQanpBEOk=; b=G8aVkZ2spAd1I8hlghqxX56xKBZg6mWVGQpqGCoIBvJEOalO7nppe0jfgH9gRjZ+nl aF+0BDv7sKG1OWf2e8PwZUD6o50yt9nGmcSozjjDtlF2aOlsGyF3iSjM8laNWdp3+cIW sxmkUpH88QBNy64bCGfi+ye9blTZXmdkyARxelzn+PeCah91P1NBBxi/YumAsskH9/Tn p0wn1yybngtPKE080ONlkz5rolZuPUCDF67zEjib7BSwSOa9h15D+i/3pH+1WvJhZKIR yd+Ic+U9uaSJFOtLhQhlPy22vCXTQHwxOAXL7/Fxddz37gftSanw1xCNV9EX870bVduP hYoA== X-Gm-Message-State: AOUpUlHzhrxGMgRynzs/iRcXiyWpa6bDEdDrOuDhCrCwy/46+0mDBuEg BBgvLcQPNVApzdXZEWmE329c4A== X-Received: by 2002:a2e:84c6:: with SMTP id q6-v6mr10520916ljh.65.1532378660448; Mon, 23 Jul 2018 13:44:20 -0700 (PDT) Received: from localhost (89-233-230-99.cust.bredband2.com. [89.233.230.99]) by smtp.gmail.com with ESMTPSA id z90-v6sm1962025ljb.59.2018.07.23.13.44.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jul 2018 13:44:19 -0700 (PDT) Date: Mon, 23 Jul 2018 22:44:18 +0200 From: Niklas =?iso-8859-1?Q?S=F6derlund?= To: Wolfram Sang Cc: linux-i2c@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Wolfram Sang , linux-kernel@vger.kernel.org Subject: Re: [PATCH 01/12] i2c: quirks: add zero length checks Message-ID: <20180723204418.GG1432@bigcity.dyn.berto.se> References: <20180723202617.15230-1-wsa+renesas@sang-engineering.com> <20180723202617.15230-2-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180723202617.15230-2-wsa+renesas@sang-engineering.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Wolfram, Thanks for your patch. On 2018-07-23 22:26:05 +0200, Wolfram Sang wrote: > Some adapters do not support a message length of 0. Add this as a quirk > so drivers don't have to open code it. > > Signed-off-by: Wolfram Sang > --- > > Only build tested. Was this not tested when you also tested i2c-rcar and i2c-sh_mobile drivers? In any case I think this change make much sens. Reviewed-by: Niklas S?derlund > > drivers/i2c/i2c-core-base.c | 6 ++++++ > include/linux/i2c.h | 4 ++++ > 2 files changed, 10 insertions(+) > > diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c > index 02d6f27b19e4..a26b3e9cc441 100644 > --- a/drivers/i2c/i2c-core-base.c > +++ b/drivers/i2c/i2c-core-base.c > @@ -1839,9 +1839,15 @@ static int i2c_check_for_quirks(struct i2c_adapter *adap, struct i2c_msg *msgs, > if (msgs[i].flags & I2C_M_RD) { > if (do_len_check && i2c_quirk_exceeded(len, q->max_read_len)) > return i2c_quirk_error(adap, &msgs[i], "msg too long"); > + > + if (q->flags & I2C_AQ_NO_ZERO_LEN_READ && len == 0) > + return i2c_quirk_error(adap, &msgs[i], "no zero length"); > } else { > if (do_len_check && i2c_quirk_exceeded(len, q->max_write_len)) > return i2c_quirk_error(adap, &msgs[i], "msg too long"); > + > + if (q->flags & I2C_AQ_NO_ZERO_LEN_WRITE && len == 0) > + return i2c_quirk_error(adap, &msgs[i], "no zero length"); > } > } > > diff --git a/include/linux/i2c.h b/include/linux/i2c.h > index bc8d42f8544f..2a98d0886d2e 100644 > --- a/include/linux/i2c.h > +++ b/include/linux/i2c.h > @@ -661,6 +661,10 @@ struct i2c_adapter_quirks { > I2C_AQ_COMB_READ_SECOND | I2C_AQ_COMB_SAME_ADDR) > /* clock stretching is not supported */ > #define I2C_AQ_NO_CLK_STRETCH BIT(4) > +/* message cannot have length of 0 */ > +#define I2C_AQ_NO_ZERO_LEN_READ BIT(5) > +#define I2C_AQ_NO_ZERO_LEN_WRITE BIT(6) > +#define I2C_AQ_NO_ZERO_LEN (I2C_AQ_NO_ZERO_LEN_READ | I2C_AQ_NO_ZERO_LEN_WRITE) > > /* > * i2c_adapter is the structure used to identify a physical i2c bus along > -- > 2.11.0 > -- Regards, Niklas S?derlund