Re: [PATCH 15/22] iio: dac: ad5686: create bus ops struct

Jonathan Cameron
2026-04-23T18:09:24Z

On Wed, 22 Apr 2026 15:45:49 +0100
Rodrigo Alencar via B4 Relay <devnull+rodrigo.alencar.analog.com@kernel.org> wrote:

> From: Rodrigo Alencar <rodrigo.alencar@analog.com>
>
> Create struct with bus operations, including a sync() operation that will
> be used to flush multiple channel writes at once. Auxiliary functions
> ad5686_write() and ad5686_read() are created and ad5686_probe() now
> receives an ops struct pointer rather than individual read and write
> functions. Documentation header of ad5686_state struct is updated
> accordingly (adjusting renamed fields and formatting).
>
> Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>

Trivial stuff inline.

Thanks,

> diff --git a/drivers/iio/dac/ad5686.h b/drivers/iio/dac/ad5686.h
> index 7004d0d1d97a..55f49dbbbd39 100644
> --- a/drivers/iio/dac/ad5686.h
> +++ b/drivers/iio/dac/ad5686.h

> /**
> * struct ad5686_chip_info - chip specific information
> @@ -106,24 +113,23 @@ extern const struct ad5686_chip_info ad5679r_chip_info;
>
> /**
> * struct ad5686_state - driver instance specific data
> - * @spi: spi_device
> + * @dev: device instance

Unrelated fix. Separate patch.

> * @chip_info: chip model specific constants, available modes etc
> + * @ops: bus specific operations
> * @vref_mv: actual reference voltage used
> * @pwr_down_mask: power down mask
> * @pwr_down_mode: current power down mode
> * @use_internal_vref: set to true if the internal reference voltage is used
> - * @lock lock to protect the data buffer during regmap ops
> - * @data: spi transfer buffers
> + * @lock: lock to protect the data buffer during regmap ops
> + * @data: transfer buffers
> */
> -
Likewise - though feel free to do this one in the same patch as spi -> dev.

> struct ad5686_state {
> struct device *dev;
> const struct ad5686_chip_info *chip_info;
> + const struct ad5686_bus_ops *ops;
> unsigned short vref_mv;
> unsigned int pwr_down_mask;
> unsigned int pwr_down_mode;
> - ad5686_write_func write;
> - ad5686_read_func read;
> bool use_internal_vref;
> struct mutex lock;