On 12/6/24 3:36 PM, David Lechner wrote: > On 11/24/24 11:16 AM, Jonathan Cameron wrote: >> On Fri, 15 Nov 2024 14:18:49 -0600 >> David Lechner <dlechner@xxxxxxxxxxxx> wrote: >> >>> Add a new devm_iio_dmaengine_buffer_setup_ext2() function to handle >>> cases where the DMA channel is managed by the caller rather than being >>> requested and released by the iio_dmaengine module. >>> >>> Signed-off-by: David Lechner <dlechner@xxxxxxxxxxxx> >> Fresh read and I'm wondering if the lifetimes in here can be managed >> more simply either by pushing the DMA channel get down, or dragging >> the release up. Basically I'd like to see them at the same level >> of nesting in the code. If it ends up being necessary to duplicate >> more code that is fine if it makes this easier to reason about. >> > > One option could be instead of introducing a 2nd function, change Oops. The new function is devm_ so would still need a 2nd function but changing iio_dmaengine_buffer_setup_ext() to have basically the same signature would still avoid the asymmetry. > the existing iio_dmaengine_buffer_setup_ext() to use the signature > of the proposed devm_iio_dmaengine_buffer_setup_ext2(). There are > only two users of these functions. So we could move the dma chan > request/release out to the drivers for those. > > Otherwise, we can't completely get rid of the owns_chan bit. >