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 (Arm)" X-Patchwork-Id: 13169465 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 081E5C6FA99 for ; Fri, 10 Mar 2023 16:02:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=LNHA1V2nJFIjKBqO2MSmfrFhsbI39UdtQaanhiT0kpU=; b=Mx3FO8YjIQpoqk MqVLeZWWHmC3GHd1GppQcI67KdOTGzZ8DkTCnO6nNc9zrDTkSdRHJRCkwEJHOFMnac0/OKmoGycC8 GE5UgvodZkh8CXwW/mpMF6vTLNsGSKqQ2mrDMmbmgVqcxs27MU1Pf6sA6gAOYORimNOSn7CuuvO8i K18yhAlErNa5Qb6a48hiwJpAix3LTbZo5iw1CKP8pYdFja27FEeFfIjlCP0xKDG8Kjo3xIlYjjRkS JAPaT99f12CpZr8up2TA3NtJE24N0EsJ91VhZz91j15rS/ifCrhhK7Z7BYzl0dJPob+XauY8oE18W mKAdTSxD1sS4s/nXNZyQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pafBs-00FAHb-RZ; Fri, 10 Mar 2023 16:01:57 +0000 Received: from mail-ot1-f45.google.com ([209.85.210.45]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pae20-00Emj9-Q5 for linux-arm-kernel@lists.infradead.org; Fri, 10 Mar 2023 14:47:42 +0000 Received: by mail-ot1-f45.google.com with SMTP id m25-20020a05683026d900b006941a2838caso3032853otu.7 for ; 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=IQCA6eNVgZQnBK2lukKZuZNvADq6Gpiu4/36ke3WjG1F4rLBcDFWyAqrgpHF1nZEkd JmMWjdXSV9VuLO9/Lng3RNjyJGWM0l+QBDx2dYhuHoJ1V+nSAwaX2wCMSyn4sxwIoLFo BqCz2E3RxG1xtzvBVz7IAaQquIU8cXtYLxwtNDBPVN9tQUOZvfX8V6H0reqbNifPXLof IbTHjOl5jMXKWavEJWICUe2Qnfe2wW6dcJQLxPXy3h67zWpv06kFQ3h80SAuNYge7bvI MReoyxyBToXXuXJNfsZOUv3m9ziwdeylCeVIo9vBSwXvbdbhkJpF+KsQj6N4+h0IYtRG LH8w== X-Gm-Message-State: AO0yUKVRznPdCPoyUf/oGeWqDv8QTOxC4YNYsAY35Ru1LHpxPkDGthK3 VRJ8o3tp1iKHr5yP436ZqA== X-Google-Smtp-Source: AK7set+1v0Oy317O/GgYXBQ/6eEBO/u3ew/d9R+Nk1dh3yQXWhHfEHApW3jqyFaoPyN4Vuj/ZB6org== 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230310_064740_881596_145F3F74 X-CRM114-Status: GOOD ( 14.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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();