[PATCH] iommu: Clarify .of_xlate assumptions

Marek Szyprowski m.szyprowski at samsung.com
Fri Oct 30 05:38:22 EDT 2020


Hi Robin,

On 29.10.2020 16:34, Robin Murphy wrote:
> A common idiom for .of_xlate is to use of_find_device_by_node() to
> retrieve the relevant IOMMU instance data when translating IOMMU
> specifiers for a client device. Although it's slightly roundabout,
> this is simply looking up something we know exists - if it *were*
> to return NULL, that would mean that no platform device is associated
> with the given DT node, therefore the driver couldn't have probed
> and called iommu_device_register() with the ops that .of_xlate was
> called from in the first place. By construction, we can also assume
> that the instance data for any registered IOMMU must be valid.
>
> This isn't necessarily obvious at first glance, though, so add some
> comments to document these assumptions in-place.
>
> Suggested-by: Yu Kuai <yukuai3 at huawei.com>
> Signed-off-by: Robin Murphy <robin.murphy at arm.com>
> ---
>   drivers/iommu/arm/arm-smmu/qcom_iommu.c |  7 ++++---
>   drivers/iommu/exynos-iommu.c            | 15 ++++++---------
Acked-by: Marek Szyprowski <m.szyprowski at samsung.com>
>   drivers/iommu/ipmmu-vmsa.c              | 13 ++++++-------
>   drivers/iommu/mtk_iommu.c               |  8 ++++----
>   drivers/iommu/rockchip-iommu.c          |  5 ++++-
>   drivers/iommu/sun50i-iommu.c            |  5 ++++-
>   6 files changed, 28 insertions(+), 25 deletions(-)
>
>
Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland




More information about the linux-arm-kernel mailing list