Re: [PATCH v3 04/18] driver core: platform: Add driver dma ownership management

Christoph Hellwig
2021-12-07T13:25:31Z

On Tue, Dec 07, 2021 at 09:16:27AM -0400, Jason Gunthorpe wrote:
> Yes, the suggestion was to put everything that 'if' inside a function
> and then of course a matching undo function.

Can't we simplify things even more? Do away with the DMA API owner
entirely, and instead in iommu_group_set_dma_owner iterate over all
devices in a group and check that they all have the no_dma_api flag
set (plus a similar check on group join). With that most of the
boilerplate code goes away entirely in favor of a little more work at
iommu_group_set_dma_owner time.