Re: [PATCH v2 5/8] iio: buffer-dmaengine: export buffer alloc and free functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 08 Dec 2023 16:14:12 +0100
Nuno Sa via B4 Relay <devnull+nuno.sa.analog.com@xxxxxxxxxx> wrote:

> From: Nuno Sa <nuno.sa@xxxxxxxxxx>
> 
> Export iio_dmaengine_buffer_free() and iio_dmaengine_buffer_alloc().
> This is in preparation of introducing IIO backends support. This will
> allow us to allocate a buffer and control it's lifetime from a device
> different from the one holding the DMA firmware properties. Effectively,
> in this case the struct device holding the firmware information about
> the DMA channels is not the same as iio_dev->dev.parent (typical case).
> 
> Signed-off-by: Nuno Sa <nuno.sa@xxxxxxxxxx>

Probably a good idea to namespace these and existing exports related
to buffer-dmaengine whilst you are at it.

> ---
>  drivers/iio/buffer/industrialio-buffer-dmaengine.c | 6 ++++--
>  include/linux/iio/buffer-dmaengine.h               | 4 +++-
>  2 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/buffer/industrialio-buffer-dmaengine.c b/drivers/iio/buffer/industrialio-buffer-dmaengine.c
> index 5f85ba38e6f6..5bf8c5eb1853 100644
> --- a/drivers/iio/buffer/industrialio-buffer-dmaengine.c
> +++ b/drivers/iio/buffer/industrialio-buffer-dmaengine.c
> @@ -159,7 +159,7 @@ static const struct iio_dev_attr *iio_dmaengine_buffer_attrs[] = {
>   * Once done using the buffer iio_dmaengine_buffer_free() should be used to
>   * release it.
>   */
> -static struct iio_buffer *iio_dmaengine_buffer_alloc(struct device *dev,
> +struct iio_buffer *iio_dmaengine_buffer_alloc(struct device *dev,
>  	const char *channel)
>  {
>  	struct dmaengine_buffer *dmaengine_buffer;
> @@ -210,6 +210,7 @@ static struct iio_buffer *iio_dmaengine_buffer_alloc(struct device *dev,
>  	kfree(dmaengine_buffer);
>  	return ERR_PTR(ret);
>  }
> +EXPORT_SYMBOL_GPL(iio_dmaengine_buffer_alloc);
>  
>  /**
>   * iio_dmaengine_buffer_free() - Free dmaengine buffer
> @@ -217,7 +218,7 @@ static struct iio_buffer *iio_dmaengine_buffer_alloc(struct device *dev,
>   *
>   * Frees a buffer previously allocated with iio_dmaengine_buffer_alloc().
>   */
> -static void iio_dmaengine_buffer_free(struct iio_buffer *buffer)
> +void iio_dmaengine_buffer_free(struct iio_buffer *buffer)
>  {
>  	struct dmaengine_buffer *dmaengine_buffer =
>  		iio_buffer_to_dmaengine_buffer(buffer);
> @@ -227,6 +228,7 @@ static void iio_dmaengine_buffer_free(struct iio_buffer *buffer)
>  
>  	iio_buffer_put(buffer);
>  }
> +EXPORT_SYMBOL_GPL(iio_dmaengine_buffer_free);
>  
>  static void __devm_iio_dmaengine_buffer_free(void *buffer)
>  {
> diff --git a/include/linux/iio/buffer-dmaengine.h b/include/linux/iio/buffer-dmaengine.h
> index 5c355be89814..6c44da550b2c 100644
> --- a/include/linux/iio/buffer-dmaengine.h
> +++ b/include/linux/iio/buffer-dmaengine.h
> @@ -10,8 +10,10 @@
>  struct iio_dev;
>  struct device;
>  
> +struct iio_buffer *iio_dmaengine_buffer_alloc(struct device *dev,
> +					      const char *channel);
> +void iio_dmaengine_buffer_free(struct iio_buffer *buffer);
>  int devm_iio_dmaengine_buffer_setup(struct device *dev,
>  				    struct iio_dev *indio_dev,
>  				    const char *channel);
> -
Unrelated change.

>  #endif
> 





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux