Re: [PATCH v6 3/6] iio: triggered-buffer: extend support to configure output buffers

From: Jonathan Cameron
Date: Sun Oct 10 2021 - 12:17:13 EST


On Thu, 7 Oct 2021 08:00:32 +0000
Mihail Chindris <mihail.chindris@xxxxxxxxxx> wrote:

> From: Alexandru Ardelean <alexandru.ardelean@xxxxxxxxxx>
>
> Now that output (kfifo) buffers are supported, we need to extend the
> {devm_}iio_triggered_buffer_setup_ext() parameter list to take a direction
> parameter.
>
> This allows us to attach an output triggered buffer to a DAC device.
> Unfortunately it's a bit difficult to add another macro to avoid changing 5
> drivers where {devm_}iio_triggered_buffer_setup_ext() is used.
> Well, it's doable, but may not be worth the trouble vs just updating all
> these 5 drivers.
>
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@xxxxxxxxxx>
> Signed-off-by: Mihail Chindris <mihail.chindris@xxxxxxxxxx>
This doesn't build... See inline and fixed whilst applying.

> diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
> index 28bde13003b7..e9f64da06f89 100644
> --- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
> +++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
> @@ -360,8 +360,9 @@ int cros_ec_sensors_core_init(struct platform_device *pdev,
> * The only way to get samples in buffer is to set a
> * software trigger (systrig, hrtimer).
> */
> - ret = devm_iio_triggered_buffer_setup(dev, indio_dev,
> - NULL, trigger_capture, NULL);

This isn't the _ext form...
so dropped this change.
> + ret = devm_iio_triggered_buffer_setup_ext(dev,
> + indio_dev, NULL, trigger_capture,
> + IIO_BUFFER_DIRECTION_IN, NULL);
> if (ret)
> return ret;
> }