Skip to content

Commit f2f68ec

Browse files
dbogdangregkh
authored andcommitted
iio: ad7793: Fix the serial interface reset
commit 7ee3b7ebcb74714df6d94c8f500f307e1ee5dda5 upstream. The serial interface can be reset by writing 32 consecutive 1s to the device. 'ret' was initialized correctly but its value was overwritten when ad7793_check_platform_data() was called. Since a dedicated reset function is present now, it should be used instead. Fixes: 2edb769 ("iio:ad7793: Add support for the ad7798 and ad7799") Signed-off-by: Dragos Bogdan <dragos.bogdan@analog.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 2c29a38 commit f2f68ec

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/iio/adc/ad7793.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ static int ad7793_setup(struct iio_dev *indio_dev,
257257
unsigned int vref_mv)
258258
{
259259
struct ad7793_state *st = iio_priv(indio_dev);
260-
int i, ret = -1;
260+
int i, ret;
261261
unsigned long long scale_uv;
262262
u32 id;
263263

@@ -266,7 +266,7 @@ static int ad7793_setup(struct iio_dev *indio_dev,
266266
return ret;
267267

268268
/* reset the serial interface */
269-
ret = spi_write(st->sd.spi, (u8 *)&ret, sizeof(ret));
269+
ret = ad_sd_reset(&st->sd, 32);
270270
if (ret < 0)
271271
goto out;
272272
usleep_range(500, 2000); /* Wait for at least 500us */

0 commit comments

Comments
 (0)