On Sat, 2024-04-06 at 17:23 +0100, Jonathan Cameron wrote: > On Fri, 5 Apr 2024 17:00:01 +0200 > Nuno Sa <nuno.sa@xxxxxxxxxx> wrote: > > > From: Paul Cercueil <paul@xxxxxxxxxxxxxxx> > > > > Adding write support to the buffer-dma code is easy - the write() > > function basically needs to do the exact same thing as the read() > > function: dequeue a block, read or write the data, enqueue the block > > when entirely processed. > > > > Therefore, the iio_buffer_dma_read() and the new iio_buffer_dma_write() > > now both call a function iio_buffer_dma_io(), which will perform this > > task. > > > > Note that we preemptively reset block->bytes_used to the buffer's size > > in iio_dma_buffer_request_update(), as in the future the > > iio_dma_buffer_enqueue() function won't reset it. > > > > Signed-off-by: Paul Cercueil <paul@xxxxxxxxxxxxxxx> > > Reviewed-by: Alexandru Ardelean <ardeleanalex@xxxxxxxxx> > > Signed-off-by: Nuno Sa <nuno.sa@xxxxxxxxxx> > > One trivial comment on alignment that I noticed whilst reminding > myself of this patch. Otherwise looks good. > > > > + > > +/** > > + * iio_dma_buffer_read() - DMA buffer read callback > > + * @buffer: Buffer to read form > > + * @n: Number of bytes to read > > + * @user_buffer: Userspace buffer to copy the data to > > + * > > + * Should be used as the read callback for iio_buffer_access_ops > > + * struct for DMA buffers. > > + */ > > +int iio_dma_buffer_read(struct iio_buffer *buffer, size_t n, > > + char __user *user_buffer) > > Prefer aligning char with after the ( I was keeping it as it was. But I can fix it up while doing the change, yes. - Nuno Sá