Skip to content

Commit a6c9e38

Browse files
robherringjoergroedel
authored andcommitted
iommu: Use of_property_present() for testing DT property presence
It is preferred to use typed property access functions (i.e. of_property_read_<type> functions) rather than low-level of_get_property/of_find_property functions for reading properties. As part of this, convert of_get_property/of_find_property calls to the recently added of_property_present() helper when we just want to test for presence of a property and nothing more. Signed-off-by: Rob Herring <robh@kernel.org> Reviewed-by: Robin Murphy <robin.murphy@arm.com> Link: https://lore.kernel.org/r/20230310144709.1542910-1-robh@kernel.org Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 1b0b5f5 commit a6c9e38

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/iommu/arm/arm-smmu/arm-smmu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ static int arm_smmu_register_legacy_master(struct device *dev,
139139
int err;
140140

141141
np = dev_get_dev_node(dev);
142-
if (!np || !of_find_property(np, "#stream-id-cells", NULL)) {
142+
if (!np || !of_property_present(np, "#stream-id-cells")) {
143143
of_node_put(np);
144144
return -ENODEV;
145145
}

drivers/iommu/ipmmu-vmsa.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,7 @@ static int ipmmu_probe(struct platform_device *pdev)
10141014
* the lack of has_cache_leaf_nodes flag or renesas,ipmmu-main property.
10151015
*/
10161016
if (!mmu->features->has_cache_leaf_nodes ||
1017-
!of_find_property(pdev->dev.of_node, "renesas,ipmmu-main", NULL))
1017+
!of_property_present(pdev->dev.of_node, "renesas,ipmmu-main"))
10181018
mmu->root = mmu;
10191019
else
10201020
mmu->root = ipmmu_find_root();

0 commit comments

Comments
 (0)