Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp4044126ybc; Tue, 26 Nov 2019 02:54:36 -0800 (PST) X-Google-Smtp-Source: APXvYqzCi9xEU8CzrwTpk6cHHMV7pJNuxpH+JIq96XteJLTJPkLzpjmc0voZxh+pa3YB12lHnCY+ X-Received: by 2002:a05:6402:3046:: with SMTP id bu6mr2187288edb.139.1574765676613; Tue, 26 Nov 2019 02:54:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574765676; cv=none; d=google.com; s=arc-20160816; b=u5mvJSNA6lIjZE4iLsT4Q4wCNB6TnGtZFKYEGDCOn5k7gaklrqdilZuX5SDYkL+muB ur2rvVLkHnwYeYIlc661xwoBrpDNNU0KDl3Q//1t1h73P1h4+YwsS1Accvirl/lAN/h5 5lxCRnd13L1vbVqbBIWFaKuIthtj249/TAtZjcbpTaiBf3FeHFajTpwYyVZXq1pqut/z AvmvC3yAifuWfCHtldZQO7rhF1LcdxZYqD0gTKCiPWrEw7fOe5Dli38crWAK6DMs5YNd atmZu+jneM9QrouTn3yirRJCqj6oyFWRChNAYCYu8ocOqGS8cAKBj+I9hVa8POcnx/DV eYJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=IG9TLYSkqVjzWeyMD6yJCJ0YCx8KokmCBfk2uSt29gw=; b=yKoMfo7zvLkOa/srUu/7Ecced8PQvyrA4wpFJqkyZyYS/OuORVAG8wm9Jiio/4SnPo p9ZydIhUiYFeOw12+j2jwADODHQmI8V77jjEQlriONZGjazT5B4AxvUnYOXKgrj6bDpD M52KNNoKfD7v4YTzW37OKxP23R5MxCMlvM2LQnnXCbImeGD1UYqPEmnrfz68Na7Q5nz3 GE88pEUCh3v85rfFouQFOggUGo8iGnwrQFh2L4sb6HOMKVQvUkqVqSIiUKjASwco1Z+K 5lYPRx2QIjIa6mbvki856GuCyvnjxN+HG/q6795WAYC7A8NNq5NeCMqWLKD8ZKDDqGtA /ujQ== 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 g10si8209995edk.5.2019.11.26.02.54.13; Tue, 26 Nov 2019 02:54:36 -0800 (PST) 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 S1727909AbfKZKwq (ORCPT + 99 others); Tue, 26 Nov 2019 05:52:46 -0500 Received: from mx2.suse.de ([195.135.220.15]:43108 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727817AbfKZKwq (ORCPT ); Tue, 26 Nov 2019 05:52:46 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id AE4BDAD00; Tue, 26 Nov 2019 10:52:44 +0000 (UTC) Date: Tue, 26 Nov 2019 11:52:43 +0100 From: Jean Delvare To: Wolfram Sang Cc: Lei YU , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] docs: i2c: Fix return value of i2c_smbus_xxx functions Message-ID: <20191126115243.673fc164@endymion> In-Reply-To: <20191125144857.GA2412@kunai> References: <1574162632-65848-1-git-send-email-mine260309@gmail.com> <20191125144857.GA2412@kunai> Organization: SUSE Linux X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 25 Nov 2019 15:48:57 +0100, Wolfram Sang wrote: > On Tue, Nov 19, 2019 at 07:23:52PM +0800, Lei YU wrote: > > In i2c/dev-interface.rst it said > > > > > All these transactions return -1 on failure > > > > But actually the i2c_smbus_xxx functions return negative error numbers > > on failure, instead of -1. > > > > Fix the document and remove the following sentence. > > > > Signed-off-by: Lei YU > > --- > > Documentation/i2c/dev-interface.rst | 9 ++++----- > > 1 file changed, 4 insertions(+), 5 deletions(-) > > > > diff --git a/Documentation/i2c/dev-interface.rst b/Documentation/i2c/dev-interface.rst > > index 69c23a3..f2f2b28 100644 > > --- a/Documentation/i2c/dev-interface.rst > > +++ b/Documentation/i2c/dev-interface.rst > > @@ -163,11 +163,10 @@ for details) through the following functions:: > > __s32 i2c_smbus_write_block_data(int file, __u8 command, __u8 length, > > __u8 *values); > > > > -All these transactions return -1 on failure; you can read errno to see > > -what happened. The 'write' transactions return 0 on success; the > > -'read' transactions return the read value, except for read_block, which > > -returns the number of values read. The block buffers need not be longer > > -than 32 bytes. > > +All these transactions return a negative error number on failure. > > +The 'write' transactions return 0 on success; the 'read' transactions > > +return the read value, except for read_block, which returns the number > > +of values read. The block buffers need not be longer than 32 bytes. > > I think the correct solution is to remove this paragraph entirely. > Because the returned value does not depend on the kernel but on the > libi2c version. Check this commit from 2012 in the i2c-tools repo: > > 330bba2 ("libi2c: Properly propagate real error codes on read errors") > > So, I think we should document it there. Jean, what do you think? I would go further and move half of the document to i2c-tools. i2c-dev itself only provides the ioctls. Everything on top of that is in libi2c now, so the kernel documentation should point to libi2c and the detailed documentation should come with libi2c. So I guess I should review the whole document now to see what needs to be updated, what should stay, and what should move. -- Jean Delvare SUSE L3 Support