From patchwork Fri Mar 10 14:47:02 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: 13169462 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 B734AC64EC4 for ; Fri, 10 Mar 2023 16:02:15 +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=ctrLiOEjMOESg0LLL++33P6yK46u7wOcGAsTQUTPshY=; b=Lw9vPKWB4SxUpm uRMiLDni2lAQBMwQs9S4W6+XwRb1EmYlRiZKLpBsyDUlaauja7Aw2EMoFLeDYFbXnolkD107iN1Ig /Mirez2Dz8e+R8NVIul8ZuvFaXD+hmY6KYpvAZXpL6fsW9U9FiDgQQ2XtJR8C9t1Os8QVPoEo6cEl xk3I/BNzyhyJnOH5rKb/sqbev1aKfdVRjHyFCHPlxF57Q3zF0tKmnoK7V4dth/d6XSaeed/OW1cnv lqUHx+gBYWqmQJTqoQTVd80P4GRDaMNEYUWe7PWvIUURSDKcUthbL+pWkR9aSgj6QfjzgzyInLtTi v58TSba3qGLr9ThPFitA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pafBO-00FA6Y-9e; Fri, 10 Mar 2023 16:01:26 +0000 Received: from mail-oi1-f172.google.com ([209.85.167.172]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pae1c-00EmYj-4G for linux-arm-kernel@lists.infradead.org; Fri, 10 Mar 2023 14:47:17 +0000 Received: by mail-oi1-f172.google.com with SMTP id bp19so4405969oib.4 for ; Fri, 10 Mar 2023 06:47:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678459635; 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=vOScINdVt5AO68Lh+/aSSo0LSJcWlj/v+OQKQopbrfE=; b=Z7zhqqEOaxpjYn2pnQGfJxh+LAnRnfGOB/WChDhFmjCcP1ntPH2Tyfeztz85qYroGC zVr5lsqVIFPaidnwhDlyp1lKkhk0gyLcHjS6OvMDGRealn4E0+NK/8w46hfjb6hUmKqN pU9rzLvA5U0trGnSkF5f6thWc+9BycxxM2UZe5NUubNmqapMDEJRuw8I5VddHyLYk7mQ Qtk6LhzsgPluO/606J8EKqGiwTGzP0cLSoalccKpg5XySWcX80fS4Q9uBxOTbNlHMBZe 0recIWN4zan2SPTZPxFGzzg3t82xJp+H6z+QKShpxnglCgq/QOPRgXNBNNkArA3GqRtC FuzQ== X-Gm-Message-State: AO0yUKXLOowzcEZMUK3FModlcR0DiweRjwbpyshE0rZGadcYcLpIOC1y R49VS+8bYefVwVVS9vJYQg== X-Google-Smtp-Source: AK7set+A03WCNhhILxT+Im0HjPRwqAdlpSrjmwLHRwv5tCq6UJ03m7njDAzYDBsWlFqeSLAiKCrC0Q== X-Received: by 2002:a05:6808:8f1:b0:384:349a:15d0 with SMTP id d17-20020a05680808f100b00384349a15d0mr3352325oic.38.1678459634837; Fri, 10 Mar 2023 06:47:14 -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 q194-20020a4a33cb000000b00517fc5fdf5bsm801303ooq.17.2023.03.10.06.47.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Mar 2023 06:47:14 -0800 (PST) Received: (nullmailer pid 1541776 invoked by uid 1000); Fri, 10 Mar 2023 14:47:02 -0000 From: Rob Herring To: "Rafael J. Wysocki" , Viresh Kumar , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Sudeep Holla , Cristian Marussi , Thierry Reding , Jonathan Hunter Cc: devicetree@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org Subject: [PATCH] cpufreq: Use of_property_present() for testing DT property presence Date: Fri, 10 Mar 2023 08:47:02 -0600 Message-Id: <20230310144702.1541730-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_064716_196935_41720F40 X-CRM114-Status: GOOD ( 16.48 ) 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 --- drivers/cpufreq/cpufreq-dt-platdev.c | 2 +- drivers/cpufreq/imx-cpufreq-dt.c | 2 +- drivers/cpufreq/imx6q-cpufreq.c | 4 ++-- drivers/cpufreq/scmi-cpufreq.c | 2 +- drivers/cpufreq/tegra20-cpufreq.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/cpufreq/cpufreq-dt-platdev.c b/drivers/cpufreq/cpufreq-dt-platdev.c index e85703651098..5ac6b9e5270e 100644 --- a/drivers/cpufreq/cpufreq-dt-platdev.c +++ b/drivers/cpufreq/cpufreq-dt-platdev.c @@ -179,7 +179,7 @@ static bool __init cpu0_node_has_opp_v2_prop(void) struct device_node *np = of_cpu_device_node_get(0); bool ret = false; - if (of_get_property(np, "operating-points-v2", NULL)) + if (of_property_present(np, "operating-points-v2")) ret = true; of_node_put(np); diff --git a/drivers/cpufreq/imx-cpufreq-dt.c b/drivers/cpufreq/imx-cpufreq-dt.c index 76e553af2071..535867a7dfdd 100644 --- a/drivers/cpufreq/imx-cpufreq-dt.c +++ b/drivers/cpufreq/imx-cpufreq-dt.c @@ -89,7 +89,7 @@ static int imx_cpufreq_dt_probe(struct platform_device *pdev) cpu_dev = get_cpu_device(0); - if (!of_find_property(cpu_dev->of_node, "cpu-supply", NULL)) + if (!of_property_present(cpu_dev->of_node, "cpu-supply")) return -ENODEV; if (of_machine_is_compatible("fsl,imx7ulp")) { diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c index ad4ce8493144..48e1772e98fd 100644 --- a/drivers/cpufreq/imx6q-cpufreq.c +++ b/drivers/cpufreq/imx6q-cpufreq.c @@ -222,7 +222,7 @@ static int imx6q_opp_check_speed_grading(struct device *dev) u32 val; int ret; - if (of_find_property(dev->of_node, "nvmem-cells", NULL)) { + if (of_property_present(dev->of_node, "nvmem-cells")) { ret = nvmem_cell_read_u32(dev, "speed_grade", &val); if (ret) return ret; @@ -279,7 +279,7 @@ static int imx6ul_opp_check_speed_grading(struct device *dev) u32 val; int ret = 0; - if (of_find_property(dev->of_node, "nvmem-cells", NULL)) { + if (of_property_present(dev->of_node, "nvmem-cells")) { ret = nvmem_cell_read_u32(dev, "speed_grade", &val); if (ret) return ret; diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c index 513a071845c2..f34e6382a4c5 100644 --- a/drivers/cpufreq/scmi-cpufreq.c +++ b/drivers/cpufreq/scmi-cpufreq.c @@ -310,7 +310,7 @@ static int scmi_cpufreq_probe(struct scmi_device *sdev) #ifdef CONFIG_COMMON_CLK /* dummy clock provider as needed by OPP if clocks property is used */ - if (of_find_property(dev->of_node, "#clock-cells", NULL)) + if (of_property_present(dev->of_node, "#clock-cells")) devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, NULL); #endif diff --git a/drivers/cpufreq/tegra20-cpufreq.c b/drivers/cpufreq/tegra20-cpufreq.c index ab7ac7df9e62..dfd2de4f8e07 100644 --- a/drivers/cpufreq/tegra20-cpufreq.c +++ b/drivers/cpufreq/tegra20-cpufreq.c @@ -25,7 +25,7 @@ static bool cpu0_node_has_opp_v2_prop(void) struct device_node *np = of_cpu_device_node_get(0); bool ret = false; - if (of_get_property(np, "operating-points-v2", NULL)) + if (of_property_present(np, "operating-points-v2")) ret = true; of_node_put(np);