Message ID | 20231208-dev-iio-backend-v2-5-5450951895e1@analog.com (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show |
Series | iio: add new backend framework | expand |
On Fri, 08 Dec 2023 16:14:12 +0100 Nuno Sa via B4 Relay <devnull+nuno.sa.analog.com@kernel.org> wrote: > From: Nuno Sa <nuno.sa@analog.com> > > 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@analog.com> 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 >
On Sun, 2023-12-10 at 14:24 +0000, Jonathan Cameron wrote: > On Fri, 08 Dec 2023 16:14:12 +0100 > Nuno Sa via B4 Relay <devnull+nuno.sa.analog.com@kernel.org> wrote: > > > From: Nuno Sa <nuno.sa@analog.com> > > > > 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@analog.com> > > Probably a good idea to namespace these and existing exports related > to buffer-dmaengine whilst you are at it. > Will do that... > - Nuno Sá
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); - #endif