Re: [PATCH v3 2/2] iio: adc: add driver for Texas Instruments TLA2528 adc
From: Joshua Crofts
Date: Wed Nov 04 2026 - 10:56:21 EST
On Wed, 4 Nov 2026 17:41:30 +0200
Andy Shevchenko <andriy.shevchenko@xxxxxxxxx> wrote:
> On Wed, Nov 04, 2026 at 02:56:41PM +0100, Joshua Crofts wrote:
> > On Wed, 4 Nov 2026 13:57:25 +0100
> > Maxime Chevallier <maxime.chevallier@xxxxxxxxxxx> wrote:
>
> ...
>
> > > +#include <linux/types.h>
> > > +#include <linux/units.h>
> > > +
> > > +#include <linux/iio/adc-helpers.h>
> > > +#include <linux/iio/iio.h>
> >
> > + #include <asm/byteorder.h> for be16_to_cpu()
>
> Yep, but please before linux/iio/* block.
>
> ...
>
> > > +static int tla2528_read(struct tla2528 *tla2528, u8 channel, int *val)
> > > +{
> > > + __be16 data;
> > > + int ret;
> > > +
> > > + guard(mutex)(&tla2528->lock);
> > > +
> > > + ret = regmap_update_bits(tla2528->regmap, TLA2528_CHANNEL_SEL_ADR,
> > > + TLA2528_CHANNEL_SEL_MANUAL_CHID, channel);
> > > + if (ret)
> > > + return ret;
> > > +
> > > + ret = i2c_master_recv(tla2528->client, (char *)&data, sizeof(data));
> > > + if (ret < 0)
> > > + return ret;
> >
> > As rare as short reads may be, perhaps add a check whether the expected amount
> > of bits have been returned from the device?
>
> Bits? You probably mistyped bytes?
Ugh yes, I was in between meetings and rushed my reply. Thanks for catching
this!
--
Kind regards,
Joshua Crofts