On Tue, 16 Nov 2021 12:59:30 +0200 Alexandru Ardelean <ardeleanalex@xxxxxxxxx> wrote: > On Mon, Nov 15, 2021 at 4:20 PM Paul Cercueil <paul@xxxxxxxxxxxxxxx> wrote: > > > > From: Alexandru Ardelean <alexandru.ardelean@xxxxxxxxxx> > > > > A part of the logic in the iio_dma_buffer_exit() is required for the change > > to add mmap support to IIO buffers. > > This change splits the logic into a separate function, which will be > > re-used later. > > > > Not sure how the protocol is here, since my old @analog.com email > isn't working anymore. > > But: > > Signed-off-by: Alexandru Ardelean <ardeleanalex@xxxxxxxxx> If you want to both document your email address change and make various scripts find you more easily, send a patch for .mailmap In meantime we can probably leave your original sign off in place but add a Cc: with an up to date email address. That will reflect that the sign off for this was (I assume) given back when you were at Analog. > > Thanks :) > Alex > > > Signed-off-by: Alexandru Ardelean <alexandru.ardelean@xxxxxxxxxx> > > Signed-off-by: Paul Cercueil <paul@xxxxxxxxxxxxxxx> > > --- > > drivers/iio/buffer/industrialio-buffer-dma.c | 39 +++++++++++--------- > > 1 file changed, 22 insertions(+), 17 deletions(-) > > > > diff --git a/drivers/iio/buffer/industrialio-buffer-dma.c b/drivers/iio/buffer/industrialio-buffer-dma.c > > index eeeed6b2e0cf..eb8cfd3af030 100644 > > --- a/drivers/iio/buffer/industrialio-buffer-dma.c > > +++ b/drivers/iio/buffer/industrialio-buffer-dma.c > > @@ -358,6 +358,27 @@ int iio_dma_buffer_request_update(struct iio_buffer *buffer) > > } > > EXPORT_SYMBOL_GPL(iio_dma_buffer_request_update); > > > > +static void iio_dma_buffer_fileio_free(struct iio_dma_buffer_queue *queue) > > +{ > > + unsigned int i; > > + > > + spin_lock_irq(&queue->list_lock); > > + for (i = 0; i < ARRAY_SIZE(queue->fileio.blocks); i++) { > > + if (!queue->fileio.blocks[i]) > > + continue; > > + queue->fileio.blocks[i]->state = IIO_BLOCK_STATE_DEAD; > > + } > > + spin_unlock_irq(&queue->list_lock); > > + > > + for (i = 0; i < ARRAY_SIZE(queue->fileio.blocks); i++) { > > + if (!queue->fileio.blocks[i]) > > + continue; > > + iio_buffer_block_put(queue->fileio.blocks[i]); > > + queue->fileio.blocks[i] = NULL; > > + } > > + queue->fileio.active_block = NULL; > > +} > > + > > static void iio_dma_buffer_submit_block(struct iio_dma_buffer_queue *queue, > > struct iio_dma_buffer_block *block) > > { > > @@ -681,25 +702,9 @@ EXPORT_SYMBOL_GPL(iio_dma_buffer_init); > > */ > > void iio_dma_buffer_exit(struct iio_dma_buffer_queue *queue) > > { > > - unsigned int i; > > - > > mutex_lock(&queue->lock); > > > > - spin_lock_irq(&queue->list_lock); > > - for (i = 0; i < ARRAY_SIZE(queue->fileio.blocks); i++) { > > - if (!queue->fileio.blocks[i]) > > - continue; > > - queue->fileio.blocks[i]->state = IIO_BLOCK_STATE_DEAD; > > - } > > - spin_unlock_irq(&queue->list_lock); > > - > > - for (i = 0; i < ARRAY_SIZE(queue->fileio.blocks); i++) { > > - if (!queue->fileio.blocks[i]) > > - continue; > > - iio_buffer_block_put(queue->fileio.blocks[i]); > > - queue->fileio.blocks[i] = NULL; > > - } > > - queue->fileio.active_block = NULL; > > + iio_dma_buffer_fileio_free(queue); > > queue->ops = NULL; > > > > mutex_unlock(&queue->lock); > > -- > > 2.33.0 > >