From patchwork Fri Mar 10 14:47:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 67493 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp951624wrd; Fri, 10 Mar 2023 08:00:52 -0800 (PST) X-Google-Smtp-Source: AK7set/9iZVAG1ppRGMvSPn4TzReHzI2uS7tS/fccSNF+0SVT1iE5poreF9FtF2JJOjJHsumPok2 X-Received: by 2002:a62:7b58:0:b0:5a8:d364:62ab with SMTP id w85-20020a627b58000000b005a8d36462abmr21341655pfc.17.1678464051891; Fri, 10 Mar 2023 08:00:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678464051; cv=none; d=google.com; s=arc-20160816; b=pEx8WccJfs/gLl8KNY1RkyZm4G9bpGh8T0VwKC2GC7J2ipIRZfcQZqHdD2EW7uyP8F bPnUTeUi5Xmd4ljQV+IyTuHeF5IRbdw3QP53WzIr/4lizg0WaFwirgXM1q4og3H+tczA co4JuxVXGOyoku4uVwmoJilBH+dM10QsQFEKGVD5tecHNLVaYbYKZAgPKN3dd5haB9R7 zc5rEySkRG06IIQNtZm67/J1fgFyGNYp0N+odysLCfZh729Jd+QPbuAV5ENfSP2etVrX APn7veoGxFJqhPOJV4et/32Ok4z/YpXYL5CePr3BbUMjFuPNclG9nZQcOKws4ezHULsf LQjQ== 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=v0H5Wu4JK6lQArjMSAowLoAG+26f+c1LrnbxEzmAS4U=; b=ztTfuqsL0t1aAu+Phx5SI1aHK5qlRO6avaKFVLh6fxpPScIimFXYXMsXv0piUdkoCQ yFJKHRy7vhpDR+UWhyVSHtuSdPwH15gXjfNT8lUvy5WyINFAt7ydvI+iEgNNNVMvpHAK 3xzA3FYbjwGYumbXvOnJSCbNjNp+58K8DoZwsMyzuXeIcaDiH8zA+845oDVOjmLRETf7 FVTs4ELnT8MKoamUEz1pdiyNV5F/hQiEJmEu05Dns+yRtjVZ/4VaSJ+j1SvHMprBSUEL ccePGQsiJBUARo0YHx9MyMZsIgD6ikWGGiiJbqx4z4leCcHieYCs2MhnidgdEs4qhT8F cGKw== 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 140-20020a630492000000b00502f49f43easi128694pge.338.2023.03.10.08.00.37; Fri, 10 Mar 2023 08:00:51 -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 S233192AbjCJOuR (ORCPT + 99 others); Fri, 10 Mar 2023 09:50:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233193AbjCJOsj (ORCPT ); Fri, 10 Mar 2023 09:48:39 -0500 Received: from mail-ot1-f49.google.com (mail-ot1-f49.google.com [209.85.210.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B3DE1223A3; Fri, 10 Mar 2023 06:47:40 -0800 (PST) Received: by mail-ot1-f49.google.com with SMTP id r23-20020a05683001d700b00690eb18529fso3053402ota.1; Fri, 10 Mar 2023 06:47:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678459659; 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=v0H5Wu4JK6lQArjMSAowLoAG+26f+c1LrnbxEzmAS4U=; b=svkfSYyk/0FO4ObyJ5l2snPPQbxiDwyqbb4kN0P/EN97mWcvqAZl3y+Wxind441S46 P8dv+o2kcvWPUK9RU/6fe1svX6JICaqzHJ4Ats4k8Ft1cj2URC7jDfqxxaDZdfL6ToZw wCNrO+xK8FVBVJ+1s2G/1x6qlIJ0PBMuYup0m6dUcSAnFjrA/C8CzA9lGapJkLxwPMqo 43cC5lDWe0SYIDRHibwdIOGNC8CE/1ayzOjPvRs9qKynzAgd+1clWPfodIK21c9zhjNI R5I6NtEEBX3SCcb0rmSgiyckOcM3d2Ah+rZ7WzbhkMyORsQqKEIb5wcviGAU0KpF+S1k BMvg== X-Gm-Message-State: AO0yUKWdE5yTevJVY/YjkBtwf9KxDD3aLDS/+oUbA7taMzGF5eraR4bF drAJFE+XlP8JMBf0hZZsVw== X-Received: by 2002:a05:6830:807:b0:694:39e5:fdc8 with SMTP id r7-20020a056830080700b0069439e5fdc8mr12074773ots.32.1678459659397; Fri, 10 Mar 2023 06:47:39 -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 a26-20020a9d725a000000b00684c5211c58sm107392otk.60.2023.03.10.06.47.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Mar 2023 06:47:38 -0800 (PST) Received: (nullmailer pid 1542936 invoked by uid 1000); Fri, 10 Mar 2023 14:47:09 -0000 From: Rob Herring To: Will Deacon , Robin Murphy , Joerg Roedel Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH] iommu: Use of_property_present() for testing DT property presence Date: Fri, 10 Mar 2023 08:47:09 -0600 Message-Id: <20230310144709.1542910-1-robh@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-1.2 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_H3, RCVD_IN_MSPIKE_WL,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?1759997121906832046?= X-GMAIL-MSGID: =?utf-8?q?1759997121906832046?= 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: Robin Murphy --- drivers/iommu/arm/arm-smmu/arm-smmu.c | 2 +- drivers/iommu/ipmmu-vmsa.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c index 2ff7a72cf377..d0843caf8760 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c @@ -139,7 +139,7 @@ static int arm_smmu_register_legacy_master(struct device *dev, int err; np = dev_get_dev_node(dev); - if (!np || !of_find_property(np, "#stream-id-cells", NULL)) { + if (!np || !of_property_present(np, "#stream-id-cells")) { of_node_put(np); return -ENODEV; } diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c index bdf1a4e5eae0..f4470303d906 100644 --- a/drivers/iommu/ipmmu-vmsa.c +++ b/drivers/iommu/ipmmu-vmsa.c @@ -1014,7 +1014,7 @@ static int ipmmu_probe(struct platform_device *pdev) * the lack of has_cache_leaf_nodes flag or renesas,ipmmu-main property. */ if (!mmu->features->has_cache_leaf_nodes || - !of_find_property(pdev->dev.of_node, "renesas,ipmmu-main", NULL)) + !of_property_present(pdev->dev.of_node, "renesas,ipmmu-main")) mmu->root = mmu; else mmu->root = ipmmu_find_root();