media: Use of_property_present() for testing DT property presence
authorRob Herring <robh@kernel.org>
Fri, 10 Mar 2023 14:47:11 +0000 (08:47 -0600)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Tue, 11 Apr 2023 16:54:01 +0000 (18:54 +0200)
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: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c
drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c
drivers/media/platform/xilinx/xilinx-vtc.c

index 2012801323587313c7de61a5fe393245dccf8752..6c7c5f3648df81197c3088570c5ada45fa1ee96c 100644 (file)
@@ -1782,7 +1782,7 @@ static int mtk_jpeg_probe(struct platform_device *pdev)
        jpeg->vdev->device_caps = V4L2_CAP_STREAMING |
                                  V4L2_CAP_VIDEO_M2M_MPLANE;
 
-       if (of_get_property(pdev->dev.of_node, "dma-ranges", NULL))
+       if (of_property_present(pdev->dev.of_node, "dma-ranges"))
                dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(34));
 
        ret = video_register_device(jpeg->vdev, VFL_TYPE_VIDEO, -1);
index 2fa5c5e6607c73e1abda3903bcb30680d9952703..3755acc61d7dd1b3f5db2dbd4ebdab2e4c3e32f1 100644 (file)
@@ -321,7 +321,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
                }
        }
 
-       if (of_get_property(pdev->dev.of_node, "dma-ranges", NULL)) {
+       if (of_property_present(pdev->dev.of_node, "dma-ranges")) {
                ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(34));
                if (ret) {
                        mtk_v4l2_err("Failed to set mask");
index cd0d5da8195a90d450f37c7ef60faebdc716ef75..997108da687c31a993b2c4fa26c7a522c3c54541 100644 (file)
@@ -344,7 +344,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
                goto err_event_workq;
        }
 
-       if (of_get_property(pdev->dev.of_node, "dma-ranges", NULL))
+       if (of_property_present(pdev->dev.of_node, "dma-ranges"))
                dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(34));
 
        ret = video_register_device(vfd_enc, VFL_TYPE_VIDEO, -1);
index 0d5e35c2948875aba58e51af2f15ba6b69d3ee5b..dda70719f0045a9b84f48475066d0c6b343bac1e 100644 (file)
@@ -254,7 +254,7 @@ struct xvtc_device *xvtc_of_get(struct device_node *np)
        struct xvtc_device *found = NULL;
        struct xvtc_device *xvtc;
 
-       if (!of_find_property(np, "xlnx,vtc", NULL))
+       if (!of_property_present(np, "xlnx,vtc"))
                return NULL;
 
        xvtc_node = of_parse_phandle(np, "xlnx,vtc", 0);