Re: [PATCH v1 06/13] iio: adc: ad4134: Add support for digital filter type selection

From: Andy Shevchenko

Date: Thu Sep 03 2026 - 02:33:09 EST


On Wed, Sep 02, 2026 at 02:23:22PM -0300, Marcelo Schmitt wrote:
> AD4134 supports four types of programmable digital filters that allow users
> to choose between different output data rates and input bandwidths. Enable
> basic digital filter configuration by providing a way to select which
> filter type is activated for each channel.

...

> +static const struct iio_chan_spec_ext_info ad4134_filter_type_ext_info[] = {
> + IIO_ENUM("filter_type", IIO_SEPARATE, &ad4134_filter_type_enum),
> + IIO_ENUM_AVAILABLE("filter_type", IIO_SEPARATE,
> + &ad4134_filter_type_enum),

Make it a single line (it's only 82 characters).

> + { }
> +};

...

> +static int ad4134_get_filter_type(struct iio_dev *indio_dev,
> + struct iio_chan_spec const *chan)

int

> +{
> + struct ad4134_state *st = iio_priv(indio_dev);
> + enum ad4134_filter_type f_type;

enum

> + unsigned int mask, reg_val;
> + int ret;
> +
> + IIO_DEV_ACQUIRE_DIRECT_MODE(indio_dev, claim);
> + if (IIO_DEV_ACQUIRE_FAILED(claim))
> + return -EBUSY;
> +
> + ret = regmap_read(st->regmap, AD4134_CHAN_DIG_FILTER_SEL_REG, &reg_val);
> + if (ret)
> + return ret;
> +
> + mask = AD4134_CHAN_DIG_FILTER_SEL_CH_MASK(chan->channel);

> + f_type = field_get(mask, reg_val);
> +
> + return f_type;

field_get() macro...

I think you can get rid of temporary variable if it's not used afterwards.

> +}

--
With Best Regards,
Andy Shevchenko