On Thu, 28 Mar 2024 16:18:04 +0100 Nuno Sá <noname.nuno@xxxxxxxxx> wrote: > On Thu, 2024-03-28 at 14:36 +0000, Jonathan Cameron wrote: > > On Thu, 28 Mar 2024 14:22:25 +0100 > > Nuno Sa via B4 Relay <devnull+nuno.sa.analog.com@xxxxxxxxxx> wrote: > > > > > From: Nuno Sa <nuno.sa@xxxxxxxxxx> > > > > > > Simple helper for setting the buffer direction when it's allocated using > > > iio_dmaengine_buffer_alloc(). > > > > > > Signed-off-by: Nuno Sa <nuno.sa@xxxxxxxxxx> > > I wonder if we should align with the approach for triggered-buffers with and _ext > > form of the registration function that takes a direction. It seems odd to allocate > > one then change the direction. > > > > I agree it feels odd but I did not wanted to include buffer_impl.h in places that > should not have it :) > > This patchseries adds the direction to devm_iio_dmaengine_buffer_setup(). Maybe what > we need is to have a non devm variant iio_dmaengine_buffer_setup() and turn > iio_dmaengine_buffer_alloc() static again. Maybe that would make things a bit more > consistent. In fact looking closer into that file, I would get rid of: > > devm_iio_dmaengine_buffer_alloc() and __devm_iio_dmaengine_buffer_free() > > and have: > > devm_iio_dmaengine_buffer_setup() and iio_dmaengine_buffer_setup() that make use of > iio_dmaengine_buffer_free() and iio_dmaengine_buffer_alloc(). > > I think it would make more sense like the above. Thoughts? Sounds reasonable to me Jonathan > > - Nuno Sá >