soc: qcom: Use of_property_present() for testing DT property presence
authorRob Herring <robh@kernel.org>
Fri, 10 Mar 2023 14:47:24 +0000 (08:47 -0600)
committerBjorn Andersson <andersson@kernel.org>
Mon, 13 Mar 2023 12:43:07 +0000 (05:43 -0700)
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: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/r/20230310144724.1545153-1-robh@kernel.org
drivers/soc/qcom/qcom_aoss.c
drivers/soc/qcom/smem.c
drivers/soc/qcom/smsm.c

index 18c856056475ce04ef05919367be1fa91b07b7c9..e376c32cc16eb0cfd55d077ec67f34575d1e31bd 100644 (file)
@@ -395,7 +395,7 @@ static int qmp_cooling_devices_register(struct qmp *qmp)
                return -ENOMEM;
 
        for_each_available_child_of_node(np, child) {
-               if (!of_find_property(child, "#cooling-cells", NULL))
+               if (!of_property_present(child, "#cooling-cells"))
                        continue;
                ret = qmp_cooling_device_add(qmp, &qmp->cooling_devs[count++],
                                             child);
index 4f163d62942c1aa580bb54786a6430aa55f6b3f6..25f5925a8d51906db33f263791c055bfbefb1216 100644 (file)
@@ -1045,7 +1045,7 @@ static int qcom_smem_probe(struct platform_device *pdev)
        int i;
 
        num_regions = 1;
-       if (of_find_property(pdev->dev.of_node, "qcom,rpm-msg-ram", NULL))
+       if (of_property_present(pdev->dev.of_node, "qcom,rpm-msg-ram"))
                num_regions++;
 
        array_size = num_regions * sizeof(struct smem_region);
index 3e8994d6110e68ddaa1fcc4a59c8eb4f0b7c62de..8c137dff7dac89e90953808ac839a0d56fdad3b4 100644 (file)
@@ -510,7 +510,7 @@ static int qcom_smsm_probe(struct platform_device *pdev)
                return -ENOMEM;
 
        for_each_child_of_node(pdev->dev.of_node, local_node) {
-               if (of_find_property(local_node, "#qcom,smem-state-cells", NULL))
+               if (of_property_present(local_node, "#qcom,smem-state-cells"))
                        break;
        }
        if (!local_node) {