Re: [PATCH v5 1/7] iommu: Factor out some helpers

From: Jerry Snitselaar
Date: Wed Oct 18 2023 - 19:05:09 EST


On Wed, Oct 11, 2023 at 07:14:48PM +0100, Robin Murphy wrote:
> The pattern for picking the first device out of the group list is
> repeated a few times now, so it's clearly worth factoring out, which
> also helps hide the iommu_group_dev detail from places that don't need
> to know. Similarly, the safety check for dev_iommu_ops() at certain
> public interfaces starts looking a bit repetitive, and might not be
> completely obvious at first glance, so let's factor that out for clarity
> as well, in preparation for more uses of both.
>
> Reviewed-by: Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx>
> Signed-off-by: Robin Murphy <robin.murphy@xxxxxxx>
>
> ---
>
> v3: Rename dev_iommu_ops_valid() to reflect what it's actually checking,
> rather than an implied consequence.
> v4: Rebase, also catch the sneaky one in iommu_get_group_resv_regions()
> which wasn't the full pattern (but really should be since it guards
> the dev_iommu_ops() invocation in iommu_get_resv_regions()).
> ---


Reviewed-by: Jerry Snitselaar <jsnitsel@xxxxxxxxxx>