From patchwork Fri Mar 10 14:47:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 67438 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp943643wrd; Fri, 10 Mar 2023 07:43:48 -0800 (PST) X-Google-Smtp-Source: AK7set8aCOmJLfR8Vw48fzeHQByS9Gne22WtuSh7OY9fNs/45R4vzE/JX0U3/RERUmEUCX5BQZXs X-Received: by 2002:aa7:96d8:0:b0:5ef:b4e1:db0e with SMTP id h24-20020aa796d8000000b005efb4e1db0emr21861381pfq.16.1678463027641; Fri, 10 Mar 2023 07:43:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678463027; cv=none; d=google.com; s=arc-20160816; b=fNge7iLePN+VOd3CL6kMFBqDO+902Pd/R+PU0wo9rKBYzI02z3P9ynIn2HrScywaRc Uhv15UHOkZhgnjY9+VhjkuCLm2U82lgBK8lgJBttYTjy299fGlNdVB9wiXiJYW3mWggh gmslNIPbnEhP13BpiVkqHr3Gbn1uZAznGgn4QsMUGCUC4AlUODpZwdYRZahE18a/zoTt u9CG/u3XZrz3vSCmgTfVjHdoPDF394LCkVKifUaW29iQRRGYrOuCMqF1FqZ/7+CYF/u7 i6V8kdof6jPvzeJi+7wnDb2KwCT1MjdHNoF5s9cjWt0vPUG1g2r4MeacqSmxFs9MfWgW 5lZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=EIz7uldrpE/4a3Yn78TCMTOPk2yNsXBeiewFP++iTtI=; b=ofyGw0oUgAPrE9ciSBJmt7GTFVAHa8lurKdhcKhf56hy4xZ5SN5G0Vp5QP8g2ng2+O FLgK1CzihHbwrD6EgXlF6lJfOFz68KozMiKtCY1JyMQaCRRfsubA+8kxA6w5NpRjHYS0 6onWdhEU5Q9+wyxbacn96QdKPcGr5ehwMkQMciFj2vx4KpiZkTluswxIMQIGtDJbYJFz c9yLouUPN8l2EVDAr5Itfb2BxukqN3mszZizrcvk7k0ydMPU/P39HTNgMgsH8jWhsYn+ UnJ5j3+C+S9Xebpeutge0zoBcE6CIIP3ldKF5D3h/Hb2t+FYgRhqpXKEMI5O8Na+zYam ynEg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j125-20020a625583000000b00602eaac6646si20131pfb.26.2023.03.10.07.43.34; Fri, 10 Mar 2023 07:43:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233364AbjCJOt6 (ORCPT + 99 others); Fri, 10 Mar 2023 09:49:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233162AbjCJOsU (ORCPT ); Fri, 10 Mar 2023 09:48:20 -0500 Received: from mail-oi1-f170.google.com (mail-oi1-f170.google.com [209.85.167.170]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BFC3121153; Fri, 10 Mar 2023 06:47:35 -0800 (PST) Received: by mail-oi1-f170.google.com with SMTP id bh20so4393519oib.9; Fri, 10 Mar 2023 06:47:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678459654; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=EIz7uldrpE/4a3Yn78TCMTOPk2yNsXBeiewFP++iTtI=; b=piCRoVSjF4CJdI61gdGtwXSF21OkABigbQ0znd37VdclwKZuXIZoqcA0QMHAo/JcKD Clix07FBd5kIMr2c04xiFDMqtQe5RPoCSPdIAaHeLGPYLMePdbL/nH2XRGKu+gq4Z9gn ZwkQnHiKeW0NkpUqQP+6qIF0t7u+A8eaWPv8uXPTLptv01pXP1V8dRWVyGRWKXCgwZ/F eSWv/+6IIdOpA97TKGtztv/Lg5xJ4i27lWI0Gq4jZvHiXCIPE1MbXS5E9el6ThSfqOHJ Gwv6hxNACUx0cvzUwsE+/FiX2jRDRcNho9qtP+MAIH+WHg3MCosrVvwI847igqqLn1UK 5F+g== X-Gm-Message-State: AO0yUKX9DZcPcQgFMvSo8njwuDNkGIdMuBxyUfxhA0a6sxofKozB/Xb/ YqJZXfGdUBBQ0/x8o/oq4A== X-Received: by 2002:a05:6808:1d2:b0:384:167d:736b with SMTP id x18-20020a05680801d200b00384167d736bmr10994562oic.15.1678459654281; Fri, 10 Mar 2023 06:47:34 -0800 (PST) Received: from robh_at_kernel.org (66-90-144-107.dyn.grandenetworks.net. [66.90.144.107]) by smtp.gmail.com with ESMTPSA id q12-20020a4ad54c000000b005252e5b6604sm834079oos.36.2023.03.10.06.47.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Mar 2023 06:47:33 -0800 (PST) Received: (nullmailer pid 1543252 invoked by uid 1000); Fri, 10 Mar 2023 14:47:11 -0000 From: Rob Herring To: Bin Liu , Mauro Carvalho Chehab , Matthias Brugger , AngeloGioacchino Del Regno , Tiffany Lin , Andrew-CT Chen , Yunfei Dong , Hyun Kwon , Laurent Pinchart , Michal Simek Cc: devicetree@vger.kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH] media: Use of_property_present() for testing DT property presence Date: Fri, 10 Mar 2023 08:47:11 -0600 Message-Id: <20230310144711.1543225-1-robh@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759996047391372220?= X-GMAIL-MSGID: =?utf-8?q?1759996047391372220?= It is preferred to use typed property access functions (i.e. of_property_read_ 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 Reviewed-by: Laurent Pinchart Reviewed-by: AngeloGioacchino Del Regno 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); diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c index 174a6eec2f54..d2db8ccaa4c0 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c @@ -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"); diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c index 9095186d5495..199042034a3c 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c @@ -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); diff --git a/drivers/media/platform/xilinx/xilinx-vtc.c b/drivers/media/platform/xilinx/xilinx-vtc.c index 0ae0208d7529..cb4b421a348d 100644 --- a/drivers/media/platform/xilinx/xilinx-vtc.c +++ b/drivers/media/platform/xilinx/xilinx-vtc.c @@ -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);