Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2955269ybc; Mon, 25 Nov 2019 06:50:42 -0800 (PST) X-Google-Smtp-Source: APXvYqw9uEjJtP24sqPM3oSawigho12qCYjDNOe4vN799W7eyRnzfgfoSr72/1C+fDWbAGzJj/IE X-Received: by 2002:a50:a7c5:: with SMTP id i63mr18734065edc.79.1574693442200; Mon, 25 Nov 2019 06:50:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574693442; cv=none; d=google.com; s=arc-20160816; b=QEjvvpLNbEmaaLWTWVQZZnwIVvo5a8IwE3U/WNsLw1oIaeinS7FAer/8A/DwJU4frI IY8L4QXV3g9CxnFEPfCIN9w1C6YY4JeVkN966IhixMDwJxzwfGY2Uj3yuDDHSJsLIayH UOT2oO0O/YC+MKtsrh2h0+MZdu4MLaoSwTYyIxKDJSr6AJNmV1MKmw+3rtDHE7uR0DOj D94QFuhbJYzl8Aih/TqRTwDaEXBW03M8COQBpR7Mn9157Lv4UgNBRCuWdEMoaZ/FpKyB KXpH3R10m5TwPuCtefmPKLT01pyH7rqA6KEMB4vCwAhnBl4me6xZHuQYOTxh2YQTO2h/ D7tA== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=EEEQgCvdzurvP4o3+0P6J9fB8aCbm2M4ZoZM9sAdZoc=; b=TTnnBfGBcGIkvt6kAW3qLk8jXWxUHXXbq1jmRBJ4mI4OzH1+K84WeHxOZA5utMtq55 yEziyy/Yr1NaBejW7UsEzKSzEmpa2MptNaFsjK9uR0/dRK6Hf35QG7bXk19DJFZ2LCse yyrqIAjLI0gcUQ32hrpWK9VhAHumESyGFBdlz5Gruy2Ucbk5Ph7ZmQwy/VqvxdBrLNgp q7qcxRv0bzSiPypajAXgw4iSexgx7HQDmA4sed+CqTBni/nRp2yRYHHVhR/D2yvtkOrD iMWfMJd31yg6JK+Ddbj5DANPKtdgbD260pOBLJJ8iiY+zLc/7s6hqO23EEHrruyN25nd r6ww== 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 w7si4774040ejv.235.2019.11.25.06.50.18; Mon, 25 Nov 2019 06:50:42 -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 S1728264AbfKYOtB (ORCPT + 99 others); Mon, 25 Nov 2019 09:49:01 -0500 Received: from sauhun.de ([88.99.104.3]:54938 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728021AbfKYOtB (ORCPT ); Mon, 25 Nov 2019 09:49:01 -0500 Received: from localhost (x4e37056e.dyn.telefonica.de [78.55.5.110]) by pokefinder.org (Postfix) with ESMTPSA id 06B0F2C0456; Mon, 25 Nov 2019 15:48:57 +0100 (CET) Date: Mon, 25 Nov 2019 15:48:57 +0100 From: Wolfram Sang To: Lei YU , Jean Delvare Cc: 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: <20191125144857.GA2412@kunai> References: <1574162632-65848-1-git-send-email-mine260309@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="vtzGhvizbBRQ85DL" Content-Disposition: inline In-Reply-To: <1574162632-65848-1-git-send-email-mine260309@gmail.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 --vtzGhvizbBRQ85DL Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Nov 19, 2019 at 07:23:52PM +0800, Lei YU wrote: > In i2c/dev-interface.rst it said >=20 > > All these transactions return -1 on failure >=20 > But actually the i2c_smbus_xxx functions return negative error numbers > on failure, instead of -1. >=20 > Fix the document and remove the following sentence. >=20 > Signed-off-by: Lei YU > --- > Documentation/i2c/dev-interface.rst | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) >=20 > 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); > =20 > -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? > The above functions are made available by linking against the libi2c lib= rary, > which is provided by the i2c-tools project. See: > --=20 > 2.7.4 >=20 --vtzGhvizbBRQ85DL Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAl3b6dUACgkQFA3kzBSg KbaPQg/+MmrOr+FUSQ7FXtf8yk4h1WIUeMafkVFytIXVI/oAwIba9jTOK796qwem wgpThFpOjIVw2IxKC/bx2FEYys39aOJBU+1X+qyvhlqvxI96a36seSXLArzoAQBO xvn2v1xCB8TqlQAqMr80vnp5lz30kLVcW0KIiJuF9ayHsn/wqdGEBy2yz93hf8n9 wk+SSj5lR5aF71lcgSyypq8y79NbKjJhLfx2lU48sgw6VIn5PR7XjL0A/XEw29uk lcJOI9VTaaWhSR+X553GSewJ4f5xmLWn7aMf5fLa8eilBkf/JAp2yM+Hxzu9E5uj fNhWBDkjVCNsYZdfdEhy+QWkVH5Jxe2dpjOf3sUic5TCC9cxqDgl9OAZRnnEethH f2MorU7coV7RyqLIrS89xUew0dkEKZAAln3n8uAKPOLLsS5LJXRYgxe1X+d1sqGW 9OkGxzbzpPgZ/TjvAC9KbRzHkBRLoqejPUBvXIFSC7PFqwz93chObKmdMZnK0x4I gEZe86wt2k9p4I/7J+zEKXcDe45jMAmo6MBsO9Dq9vayo8GwAk5bQW/6Sf6cf6IG 80iZA1dFFSAALauR1vmRx6itOSR1IAIJXfQHiKSOfUhBh2+7iJbXBKpbCv7BWoql ETGd6JizdPYFzZjy5Q0cCRJd0Seh58uQMfAc7KgOJWLDDXdeF/0= =cVqu -----END PGP SIGNATURE----- --vtzGhvizbBRQ85DL--