[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240210174239.550c5d64@jic23-huawei>
Date: Sat, 10 Feb 2024 17:42:39 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: Nuno Sá <noname.nuno@...il.com>
Cc: David Lechner <dlechner@...libre.com>, linux-iio@...r.kernel.org,
Michael Hennerich <Michael.Hennerich@...log.com>, Rob Herring
<robh+dt@...nel.org>, Krzysztof Kozlowski
<krzysztof.kozlowski+dt@...aro.org>, Conor Dooley <conor+dt@...nel.org>,
Nuno Sá <nuno.sa@...log.com>, Liam Girdwood
<lgirdwood@...il.com>, Mark Brown <broonie@...nel.org>,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] iio: adc: ad7944: add driver for
AD7944/AD7985/AD7986
> > >
> > > > + if (chan->scan_type.sign == 's')
> > > > + *val = sign_extend32(*val, chan->scan_type.realbits - 1);
> > > > +
> > > > + return IIO_VAL_INT;
> > > > +}
> > > > +
> > > > +static int ad7944_read_raw(struct iio_dev *indio_dev,
> > > > + const struct iio_chan_spec *chan,
> > > > + int *val, int *val2, long info)
> > > > +{
> > > > + struct ad7944_adc *adc = iio_priv(indio_dev);
> > > > + int ret;
> > > > +
> > > > + switch (info) {
> > > > + case IIO_CHAN_INFO_RAW:
> > > > + ret = iio_device_claim_direct_mode(indio_dev);
> > > > + if (ret)
> > > > + return ret;
> > > > +
> > >
> > > I'm not totally sure but I think Jonathan already merged his series for the
> > > cleanup stuff for the claim direct mode. Maybe take a look and use it? Not a
> > > big
> > > win in here but I guess we could still reduce some LOC.
> >
> > Yes, if it is merged already, happy to make use of it here.
It is in my tree, but I'd rather maintain some separation between
patch sets (incase I need to pull it out again for some reason).
Given the saving here is minor, we can just follow up with a patch
making the conversion after both are in place.
> >
> > >
> > > > + ret = ad7944_single_conversion(adc, chan, val);
> > > > + iio_device_release_direct_mode(indio_dev);
Powered by blists - more mailing lists