[PATCH] iommu: Clarify .of_xlate assumptions

Maxime Ripard maxime at cerno.tech
Thu Oct 29 12:09:53 EDT 2020


On Thu, Oct 29, 2020 at 03:34:48PM +0000, 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>

Acked-by: Maxime Ripard <mripard at kernel.org>

Thanks!
Maxime
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20201029/d133c566/attachment.sig>


More information about the linux-arm-kernel mailing list