[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250907115638.308729ef@jic23-huawei>
Date: Sun, 7 Sep 2025 11:56:38 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Andy Shevchenko <andriy.shevchenko@...el.com>
Cc: Jonathan Santos <Jonathan.Santos@...log.com>, linux-iio@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org, lars@...afoo.de,
dlechner@...libre.com, nuno.sa@...log.com, andy@...nel.org,
robh@...nel.org, krzk+dt@...nel.org, conor+dt@...nel.org,
marcelo.schmitt1@...il.com, jonath4nns@...il.com
Subject: Re: [PATCH v3 4/4] iio: adc: ad7768-1: add support for ADAQ776x-1
ADC Family
> > +static void ad7768_fill_scale_tbl(struct iio_dev *dev)
> > +{
> > + struct ad7768_state *st = iio_priv(dev);
> > + const struct iio_scan_type *scan_type;
> > + int val, val2, tmp0, tmp1, i;
> > + struct u64_fract fract;
> > + unsigned long n, d;
> > + u64 tmp2;
> > +
> > + scan_type = iio_get_current_scan_type(dev, &dev->channels[0]);
>
> Is it usual patter in IIO? Otherwise it can be written as
>
> scan_type = iio_get_current_scan_type(dev, dev->channels);
From a semantic / readability point of view I'd keep it referencing
the first element. We are querying the scan type of one specific
channel, rather than the array that is behind dev->channels.
>
> > + if (scan_type->sign == 's')
> > + val2 = scan_type->realbits - 1;
> > + else
> > + val2 = scan_type->realbits;
Powered by blists - more mailing lists