[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210518184607.45b8ccb5@jic23-huawei>
Date: Tue, 18 May 2021 18:46:07 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Meng.Li@...driver.com
Cc: lars@...afoo.de, Michael.Hennerich@...log.com, pmeerw@...erw.net,
u.kleine-koenig@...gutronix.de, linux-kernel@...r.kernel.org,
linux-iio@...r.kernel.org
Subject: Re: [PATCH] driver: adc: ltc2497: return directly after reading the
adc conversion value
On Wed, 12 May 2021 12:57:25 +0800
Meng.Li@...driver.com wrote:
> From: Meng Li <Meng.Li@...driver.com>
>
> 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.
>
> Fixes: 69548b7c2c4f ("iio: adc: ltc2497: split protocol independent part in a separate module ")
> Cc: stable@...r.kernel.org
> Signed-off-by: Meng Li <Meng.Li@...driver.com>
@Uwe, I'm far from sure looking at the code what the intent is here.
whilst it definitely changed as Meng Li has outlined, I'm not sure
the fix is correct.
Jonathan
> ---
> drivers/iio/adc/ltc2497.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> 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 ltc2497core_driverdata *ddata,
> }
>
> *val = (be32_to_cpu(st->buf) >> 14) - (1 << 17);
> +
> + return ret;
> }
>
> ret = i2c_smbus_write_byte(st->client,
Powered by blists - more mailing lists