]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
sparc: Use of_property_present() for testing DT property presence
authorRob Herring <robh@kernel.org>
Fri, 10 Mar 2023 14:46:59 +0000 (08:46 -0600)
committerRob Herring <robh@kernel.org>
Tue, 18 Apr 2023 16:23:21 +0000 (11:23 -0500)
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.

Link: https://lore.kernel.org/r/20230310144659.1541247-1-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
arch/sparc/kernel/of_device_32.c
arch/sparc/kernel/of_device_64.c
arch/sparc/kernel/of_device_common.c
arch/sparc/kernel/prom_64.c
arch/sparc/kernel/time_32.c

index 4ebf51e6e78ec1a8d12f4cabbd3106b7cace359c..b60f58e041648342efc28b7261cd2b4f71446189 100644 (file)
@@ -29,7 +29,7 @@ static int of_bus_pci_match(struct device_node *np)
                 * parent as-is, not with the PCI translate
                 * method which chops off the top address cell.
                 */
-               if (!of_find_property(np, "ranges", NULL))
+               if (!of_property_present(np, "ranges"))
                        return 0;
 
                return 1;
@@ -223,7 +223,7 @@ static int __init build_one_resource(struct device_node *parent,
 static int __init use_1to1_mapping(struct device_node *pp)
 {
        /* If we have a ranges property in the parent, use it.  */
-       if (of_find_property(pp, "ranges", NULL) != NULL)
+       if (of_property_present(pp, "ranges"))
                return 0;
 
        /* Some SBUS devices use intermediate nodes to express
index 5a9f86b1d4e7e33cb7b60cca06b0c99e1f696dbf..5b5143e17ba3f5749fd7ab3567af14ebfddeb7e4 100644 (file)
@@ -58,7 +58,7 @@ static int of_bus_pci_match(struct device_node *np)
                 * parent as-is, not with the PCI translate
                 * method which chops off the top address cell.
                 */
-               if (!of_find_property(np, "ranges", NULL))
+               if (!of_property_present(np, "ranges"))
                        return 0;
 
                return 1;
@@ -78,7 +78,7 @@ static int of_bus_simba_match(struct device_node *np)
         * simba.
         */
        if (of_node_name_eq(np, "pci")) {
-               if (!of_find_property(np, "ranges", NULL))
+               if (!of_property_present(np, "ranges"))
                        return 1;
        }
 
@@ -283,7 +283,7 @@ static int __init build_one_resource(struct device_node *parent,
 static int __init use_1to1_mapping(struct device_node *pp)
 {
        /* If we have a ranges property in the parent, use it.  */
-       if (of_find_property(pp, "ranges", NULL) != NULL)
+       if (of_property_present(pp, "ranges"))
                return 0;
 
        /* If the parent is the dma node of an ISA bus, pass
index e717a56efc5d3d6743b2f0a42dd1a87e9fa90092..60f86b837658355af771eefd5c38e80774fdbb5e 100644 (file)
@@ -162,7 +162,7 @@ int of_bus_sbus_match(struct device_node *np)
                 * don't have some intervening real bus that provides
                 * ranges based translations.
                 */
-               if (of_find_property(dp, "ranges", NULL) != NULL)
+               if (of_property_present(dp, "ranges"))
                        break;
 
                dp = dp->parent;
index f883a50fa33395b4256f6c57e6d7c9653f2a137d..998aa693d491258b3e1346716b8832e776679607 100644 (file)
@@ -502,7 +502,7 @@ static void *fill_in_one_cpu(struct device_node *dp, int cpuid, int arg)
        struct device_node *portid_parent = NULL;
        int portid = -1;
 
-       if (of_find_property(dp, "cpuid", NULL)) {
+       if (of_property_present(dp, "cpuid")) {
                int limit = 2;
 
                portid_parent = dp;
index 8a08830e4a653fc7e6c46f8a431c67d730574940..958c2cf4479b22da2168af1a353543f849efb671 100644 (file)
@@ -277,7 +277,7 @@ static int clock_probe(struct platform_device *op)
                return -ENODEV;
 
        /* Only the primary RTC has an address property */
-       if (!of_find_property(dp, "address", NULL))
+       if (!of_property_present(dp, "address"))
                return -ENODEV;
 
        m48t59_rtc.resource = &op->resource[0];