drm: Use of_property_present() for testing DT property presence
authorRob Herring <robh@kernel.org>
Fri, 10 Mar 2023 14:47:05 +0000 (08:47 -0600)
committerRob Herring <robh@kernel.org>
Tue, 28 Mar 2023 19:55:33 +0000 (14:55 -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.

Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Reviewed-by: Liu Ying <victor.liu@nxp.com> # i.MX bridge
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://lore.kernel.org/r/20230310144705.1542207-1-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c
drivers/gpu/drm/drm_mipi_dsi.c
drivers/gpu/drm/msm/adreno/adreno_gpu.c
drivers/gpu/drm/sun4i/sun4i_backend.c
drivers/gpu/drm/sun4i/sun8i_mixer.c
drivers/gpu/drm/tiny/simpledrm.c
drivers/gpu/drm/vc4/vc4_hdmi.c

index 25dc82a44ef4989c4dcdd7ac1cd58e2144d686fb..ed8b7a4e0e11fd6ac2c3a0ccd1e6edb84c9f5bdb 100644 (file)
@@ -313,7 +313,7 @@ imx8qxp_pixel_link_find_next_bridge(struct imx8qxp_pixel_link *pl)
                }
 
                /* specially select the next bridge with companion PXL2DPI */
-               if (of_find_property(remote, "fsl,companion-pxl2dpi", NULL))
+               if (of_property_present(remote, "fsl,companion-pxl2dpi"))
                        bridge_sel = ep_cnt;
 
                ep_cnt++;
index b41aaf2bb9f164d29bfcf1fe2b1cb73192de7d83..7900a4707d7c4694a92ae92c370410b31b254ca6 100644 (file)
@@ -329,7 +329,7 @@ int mipi_dsi_host_register(struct mipi_dsi_host *host)
 
        for_each_available_child_of_node(host->dev->of_node, node) {
                /* skip nodes without reg property */
-               if (!of_find_property(node, "reg", NULL))
+               if (!of_property_present(node, "reg"))
                        continue;
                of_mipi_dsi_device_add(host, node);
        }
index ce6b76c45b6f972adb664c4f780a054c5e461496..2359dca80492151b64f0509d97b169f8f1bdeb30 100644 (file)
@@ -964,7 +964,7 @@ static void adreno_get_pwrlevels(struct device *dev,
        gpu->fast_rate = 0;
 
        /* You down with OPP? */
-       if (!of_find_property(dev->of_node, "operating-points-v2", NULL))
+       if (!of_property_present(dev->of_node, "operating-points-v2"))
                ret = adreno_get_legacy_pwrlevels(dev);
        else {
                ret = devm_pm_opp_of_add_table(dev);
index 38070fc261f3af53aeb7dbb143943148b62fed38..b11dbd50d73e98fbcc3434dfbec08fea9d7531c2 100644 (file)
@@ -792,7 +792,7 @@ static int sun4i_backend_bind(struct device *dev, struct device *master,
        dev_set_drvdata(dev, backend);
        spin_lock_init(&backend->frontend_lock);
 
-       if (of_find_property(dev->of_node, "interconnects", NULL)) {
+       if (of_property_present(dev->of_node, "interconnects")) {
                /*
                 * This assume we have the same DMA constraints for all our the
                 * devices in our pipeline (all the backends, but also the
index bafee05f6b247697415ab126999fd5bf8a7576b0..11d5244a5aa5fc656f8e2ad8fda6419f7d1559c1 100644 (file)
@@ -391,7 +391,7 @@ static int sun8i_mixer_bind(struct device *dev, struct device *master,
        mixer->engine.ops = &sun8i_engine_ops;
        mixer->engine.node = dev->of_node;
 
-       if (of_find_property(dev->of_node, "iommus", NULL)) {
+       if (of_property_present(dev->of_node, "iommus")) {
                /*
                 * This assume we have the same DMA constraints for
                 * all our the mixers in our pipeline. This sounds
index c38d85848af8a4fccd8cd69cf739a8ab62d6a82c..25e11ef11c4ce3c2d3fbdc5f67231771530c7975 100644 (file)
@@ -204,7 +204,7 @@ simplefb_get_memory_of(struct drm_device *dev, struct device_node *of_node)
        if (err)
                return ERR_PTR(err);
 
-       if (of_get_property(of_node, "reg", NULL))
+       if (of_property_present(of_node, "reg"))
                drm_warn(dev, "preferring \"memory-region\" over \"reg\" property\n");
 
        return res;
index d30e4547b4c578f684fb4a8a5428d32329595366..464c3cc8e6fb22e55019854722b0332cd6d929f1 100644 (file)
@@ -3020,7 +3020,7 @@ static int vc4_hdmi_cec_init(struct vc4_hdmi *vc4_hdmi)
        struct device *dev = &pdev->dev;
        int ret;
 
-       if (!of_find_property(dev->of_node, "interrupts", NULL)) {
+       if (!of_property_present(dev->of_node, "interrupts")) {
                dev_warn(dev, "'interrupts' DT property is missing, no CEC\n");
                return 0;
        }