Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1726026pxj; Wed, 19 May 2021 12:25:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwuubEnRkSkFgeKfMwtzs/jOo0dokKyHHhOrYJJqr8wNWlmcIsvegj96bp0vVyulXhsNnYk X-Received: by 2002:a6b:4105:: with SMTP id n5mr1142940ioa.148.1621452301779; Wed, 19 May 2021 12:25:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621452301; cv=none; d=google.com; s=arc-20160816; b=HQmMard78HCWa6RxbRrvfSYSzo3SRsLe0ElCFnTrvgynAr3i/O5C+bVhMLwYYetuzM 7161spTYsSv/6YVnzQqWwRvio17XWLIYU0YBHVCZTsBl0jOMH3bL5qsekWtUaHh0Gpcd XxnI9pA+o+K0ZObadWAUqEe5lbwPa7Bpjxjme1SNoYdmBUB8m0XswxZl4PgetUDMagSG VX5rbyiVG/wpklNvPDp2uwjiIicjZTJECg+K3b9e6VSF/lmc7hrXBWQA6QvxrxpkdlV7 hL2YZ9byv65z3V03U4VjMYZ8BgVOFEHGifIkIox45b2uvl8u3rotM6bkslWKHXVt/L9I sZoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=vAd6Ht1ixuBVz/gdvSyVNKTsumB6+8QElaJZAVu6rKk=; b=ebRDg1LtzhyQBfBTjKOvrZWW81iRr+HLsZsKdM2x8pXye+7dZj9dssWNw5LDc8KESJ Ne5x5odeD7ZvO9lVMMX0n8TGWg7gM+q3HsZZAxG0N7FY9BSVlS09gUOo/sZ8mNzOr3T/ hXw9V6jQQMBJMNSCkA0uFpHm6hEQEx/NUYgwSpsiiMW+UI9YSsdwVTYgYTfETmUQ4l0I sfEhFilyK+Qo5i35EsSS+ZjdkkRs9fdXdi584RtkkfVNtYadA8FGb33XAZVy4X+mNchm 6LpVhrClbUmga8Dvth0p/ge71IEB5YOwKpih4wBytkz3ekEsY/fZCpc1pDBd8ZESgFTk cV8A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h26si497733ila.99.2021.05.19.12.24.49; Wed, 19 May 2021 12:25:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345022AbhESJXH (ORCPT + 99 others); Wed, 19 May 2021 05:23:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345413AbhESJWd (ORCPT ); Wed, 19 May 2021 05:22:33 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DEBEC061347 for ; Wed, 19 May 2021 02:21:13 -0700 (PDT) Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ljIO2-0008FI-Vx; Wed, 19 May 2021 11:21:06 +0200 Received: from ukl by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1ljIO0-0005od-GC; Wed, 19 May 2021 11:21:04 +0200 Date: Wed, 19 May 2021 11:21:04 +0200 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Meng.Li@windriver.com Cc: lars@metafoo.de, Michael.Hennerich@analog.com, jic23@kernel.org, pmeerw@pmeerw.net, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org Subject: Re: [PATCH] driver: adc: ltc2497: return directly after reading the adc conversion value Message-ID: <20210519092104.pntanimcjg6s6fca@pengutronix.de> References: <20210512045725.23390-1-Meng.Li@windriver.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="toqk7euiytahbw7x" Content-Disposition: inline In-Reply-To: <20210512045725.23390-1-Meng.Li@windriver.com> X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --toqk7euiytahbw7x Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, May 12, 2021 at 12:57:25PM +0800, Meng.Li@windriver.com wrote: > From: Meng Li >=20 > When read adc conversion value with below command: > cat /sys/.../iio:device0/in_voltage0-voltage1_raw > There is an error reported as below: > ltc2497 0-0014: i2c transfer failed: -EREMOTEIO > This i2c transfer issue is introduced by commit 69548b7c2c4f ("iio: > adc: ltc2497: split protocol independent part in a separate module"). > When extract the common code into ltc2497-core.c, it change the > code logic of function ltc2497core_read(). With wrong reading > sequence, the action of enable adc channel is sent to chip again > during adc channel is in conversion status. In this way, there is > no ack from chip, and then cause i2c transfer failed. > In order to keep the code logic is the same with original ideal, > it is need to return direct after reading the adc conversion value. >=20 > Fixes: 69548b7c2c4f ("iio: adc: ltc2497: split protocol independent part = in a separate module ") > Cc: stable@vger.kernel.org > Signed-off-by: Meng Li > --- > drivers/iio/adc/ltc2497.c | 2 ++ > 1 file changed, 2 insertions(+) >=20 > diff --git a/drivers/iio/adc/ltc2497.c b/drivers/iio/adc/ltc2497.c > index 1adddf5a88a9..fd5a66860a47 100644 > --- a/drivers/iio/adc/ltc2497.c > +++ b/drivers/iio/adc/ltc2497.c > @@ -41,6 +41,8 @@ static int ltc2497_result_and_measure(struct ltc2497cor= e_driverdata *ddata, > } > =20 > *val =3D (be32_to_cpu(st->buf) >> 14) - (1 << 17); > + > + return ret; This looks wrong for me. The idea of the function ltc2497_result_and_measure is that it reads the result and starts a new measurement. I guess the problem is that ltc2497_result_and_measure is called to early, not that it does too much. But note I don't have such a system handy to actually debug this any more. Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --toqk7euiytahbw7x Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAmCk2H0ACgkQwfwUeK3K 7AmOowf8C5SX5w3Mlrpv6eP+p8p/f3M5PFSjEPPXpXbkewm9rttFdx8Y694Jc8PE Xab6b/KfczMhm0SZqmeBOlRrhD77LayokbT2451gtuVEy3uGzRhjVlCLCq3TY+ND YUGV/IUKIr4RhGtWnOacrCLbs4H6wQaTX1Njq2YjTyRlrYNjNiY9b6FUdMmKDWXp MBx5WHlM/V+8SR0qx7DlXLmLOKiUA1caoGBxdjXq9rke1AbGystKQUR4UrHPZKA3 spY+2b8+hQo1z93b6YpF/orHOPzTseecRNevJCo55rh7hhyI/ddrZ0Zg3CyyeG5g khwhIDFLaIQ7KdcuIUdoFA0N2DCOvg== =eD2f -----END PGP SIGNATURE----- --toqk7euiytahbw7x--