> > > > > > > + 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);