Re: [PATCH v4 02/17] iommu: Add device-centric DMA ownership interfaces

Jason Gunthorpe
2022-11-14T16:59:49Z

On Mon, Nov 14, 2022 at 02:33:41PM +0100, Eric Auger wrote:
> > +/**
> > + * iommu_device_release_dma_owner() - Release DMA ownership of a device
> > + * @group: The device.
> @dev: the device
> > + *
> > + * Release the DMA ownership claimed by iommu_device_claim_dma_owner().
> > + */
> > +void iommu_device_release_dma_owner(struct device *dev)
> > +{
> > + struct iommu_group *group = iommu_group_get(dev);
> > +
> > + mutex_lock(&group->mutex);
> > + if (group->owner_cnt > 1) {
> > + group->owner_cnt--;
> > + goto unlock_out;
> > + }
> > + __iommu_release_dma_ownership(group);
> > +unlock_out:
> > + mutex_unlock(&group->mutex);
>
> if (group->owner_cnt > 1)
>
> group->owner_cnt--;
> else
> __iommu_release_dma_ownership(group);
>
> mutex_unlock(&group->mutex);
>
> iommu_group_put(group);

Sure, thanks

Jason