Re: [PATCH v3 07/13] iio: adc: ad7091r: Set device mode through chip_info callback

From: Jonathan Cameron
Date: Sun Dec 10 2023 - 07:35:23 EST


On Thu, 7 Dec 2023 15:41:03 -0300
Marcelo Schmitt <marcelo.schmitt@xxxxxxxxxx> wrote:

> AD7091R-5 devices have a few modes of operation (sample, command,
> autocycle) which are set by writing to configuration register fields.
> Follow up patches will add support for AD7091R-2/-4/-8 which don't have
> those operation modes nor the register fields for setting them.
> Make ad7091r_set_mode() a callback function of AD7091R chip_info struct
> so the base driver can appropriately handle each design without having
> to check which actual chip is connected.
>
> Signed-off-by: Marcelo Schmitt <marcelo.schmitt@xxxxxxxxxx>

Hi Marcelo,
> +
> #define AD7091R_CHANNEL(idx, bits, ev, num_ev) { \
> .type = IIO_VOLTAGE, \
> .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
> @@ -52,6 +60,7 @@ struct ad7091r_chip_info {
> unsigned int num_channels;
> const struct iio_chan_spec *channels;
> unsigned int vref_mV;
> + int (*ad7091r_set_mode)(struct ad7091r_state *st, enum ad7091r_mode mode);
Given it's embedded in a driver specific structure, I'm not seeing a clear
reason to prefix the callback with ad7091r. set_mode is probably enough.
Same for the ones introduced in later patches.