[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250825154723.2ba512d0@jic23-huawei>
Date: Mon, 25 Aug 2025 15:47:23 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Ioana Risteiu <Ioana.Risteiu@...log.com>
Cc: Lars-Peter Clausen <lars@...afoo.de>, Michael Hennerich
<Michael.Hennerich@...log.com>, "David Lechner" <dlechner@...libre.com>,
Nuno Sá <nuno.sa@...log.com>, Andy Shevchenko
<andy@...nel.org>, Rob Herring <robh@...nel.org>, Krzysztof Kozlowski
<krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>, Ramona Nechita
<ramona.nechita@...log.com>, <linux-iio@...r.kernel.org>,
<devicetree@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v5 4/4] iio: adc: update ad7779 to use IIO backend
On Mon, 25 Aug 2025 13:51:19 +0300
Ioana Risteiu <Ioana.Risteiu@...log.com> wrote:
> Add a new functionality to ad7779 driver that streams data through data
> output interface using IIO backend interface.
>
> Signed-off-by: Ioana Risteiu <Ioana.Risteiu@...log.com>
> ---
> changes in v5:
> - fix indentation
> - change num_lanes variable from int to u32 type
> - use unsigned int in for loop declaration
> drivers/iio/adc/ad7779.c | 115 ++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 114 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/adc/ad7779.c b/drivers/iio/adc/ad7779.c
> index b4e56983201c..3776af1c65e9 100644
> --- a/drivers/iio/adc/ad7779.c
> +++ b/drivers/iio/adc/ad7779.c
> @@ -25,6 +25,7 @@
> #include <linux/units.h>
>
> #include <linux/iio/iio.h>
> +#include <linux/iio/backend.h>
> #include <linux/iio/buffer.h>
> #include <linux/iio/sysfs.h>
> #include <linux/iio/trigger.h>
> @@ -116,6 +117,12 @@
> #define AD7779_CRC8_POLY 0x07
> DECLARE_CRC8_TABLE(ad7779_crc8_table);
>
> +enum ad7779_data_lines {
> + AD7779_1LINE = 1,
> + AD7779_2LINES = 2,
> + AD7779_4LINES = 4,
Probably crossed with the review I did earlier.
This enum doesn't add anything that I can see over just using the value inline.
If anything it hurts readability.
> +};
> +static int ad7779_set_data_lines(struct iio_dev *indio_dev, u32 num_lanes)
> +{
> + struct ad7779_state *st = iio_priv(indio_dev);
> + int ret;
> +
> + if (num_lanes != AD7779_1LINE &&
> + num_lanes != AD7779_2LINES &&
> + num_lanes != AD7779_4LINES)
> + return -EINVAL;
if (num_lanes != 4 && num_lanes != 2 && num_lanes != 1)
is much clearer to my eyes without the macros.
Powered by blists - more mailing lists