From patchwork Fri Mar 10 14:47:26 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: 13169437 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 08772C64EC4 for ; Fri, 10 Mar 2023 15:48:29 +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=D923ve0NeBK+9iiLNHYbvf9xK71mRUgppTZdhbsIdLw=; b=xlT1x7NFQNDNvs IK8FFtTaE/Q+TMWzJcG15kkiwSHSOLGYZprMe0iB+f39nAapkjf6nsVa8JwsilLeOFVv4aMKLXDmU XqWkESGGKxnPFLcVubs9fwPtACtjSMyEtMuTfzzbx3hddZutlAsp36tGepDp5wsh6QcEK0u2+HtqT 9UB3J5UyE5K16b288zGsRi4rKY2TAZYJvuiqyIhhzbPlcHaXdr1FZhXs3D50/e3TX+z6FVwXH9HJk fVfQ9CDVif50/v3uiEaMNEeL4ckHCKA97+EGLYKkMSa2WOfVnJzgWnAKN/yltwuTwxXD7MaVi4jWC orsZVdwh6A05M38Vsa/w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1paexn-00F4dh-GP; Fri, 10 Mar 2023 15:47:23 +0000 Received: from desiato.infradead.org ([90.155.92.199]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1paews-00F46e-Uj for linux-arm-kernel@bombadil.infradead.org; Fri, 10 Mar 2023 15:46:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:In-Reply-To:References; bh=5kDFnMhlDjXbQhhC8cyka2MH9qZ1qf0f7uQ7y1/E2wc=; b=P38ubYbXx6ozSIQ0mGn0yAJjt7 xOBoLllJiGFXu5kOzOQT9QCtx3r8Yx6kOkhwDFQwIwUplwnA1tDdCiTVnMF8RSsRiB0VIVzv8J/cj HDVG0L2lmmBEFKSRyzGakH0Sq92axbwmjZ/JNB9r79NJHjkBYiwSZIRydsF9fJ5X+tIsc50NfHMj9 pNf9of/7fq5SCvLGu8/x6GoMDjAqsmrDJ6UyX/qS1FbWBixReEL0FrwTuS15aCducyGAgklrJZhj0 2xYIwiBGk2IDYDcFSTbVS1LU6qaw+eLMpk1u7GgAuWkkz/sqLyH5aA9+lwxDHM7K1V65+LtPo1Z4j sO282FtQ==; Received: from mail-oi1-f177.google.com ([209.85.167.177]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pae2N-000UWH-20 for linux-arm-kernel@lists.infradead.org; Fri, 10 Mar 2023 14:48:06 +0000 Received: by mail-oi1-f177.google.com with SMTP id bp19so4407843oib.4 for ; Fri, 10 Mar 2023 06:48:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678459681; 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=5kDFnMhlDjXbQhhC8cyka2MH9qZ1qf0f7uQ7y1/E2wc=; b=dREMipcLLKi3i8Sg51sfAMajPKVSlDrthZA0qQG3gUZr059nsXJaoz2MDm3vEs77P6 DJdTh82ZcO/5JCLDtu0HzYrzps9x0hE87zpxiehObu/jCrLbp0BcNJhv4+1Zej72Nt3d aqNKASf1UGiG0zoig8exOMHJlWxprscmRmwuXsdf6Yj1wDOFob5VLxQ4Vmhk/rWX/tQr f2jJLoAFOvTVarkDjtbktwBb5eQ4nWf0gKiEDhBo0IwhfYk4ZJH6+5MF5L0oONy0PurD 3SI/C6JJNAc8RZxtp6Cm1R9DIeAlgj+bnKH9XoQPoC15y9jyKVUtJseHs0zygGwptPkr P8Vg== X-Gm-Message-State: AO0yUKW2tIIoi3Gff8spORrPclRSMS5hT1K2a5VJ6zJXOg5PnSNRkyPC 0QS5lW+BtOPQYU3XRlC33g== X-Google-Smtp-Source: AK7set8wyTPqB0zymJsFHoosApuhG8yLkiRC9jhDOWpmPaOxeYvrXuRmGrs8h0Q1Jwi9MFpU5m2ehQ== X-Received: by 2002:a05:6808:481:b0:383:b2c0:4ea1 with SMTP id z1-20020a056808048100b00383b2c04ea1mr11230371oid.16.1678459680625; Fri, 10 Mar 2023 06:48:00 -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 u25-20020a544399000000b0038467f03345sm971615oiv.10.2023.03.10.06.47.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Mar 2023 06:48:00 -0800 (PST) Received: (nullmailer pid 1545569 invoked by uid 1000); Fri, 10 Mar 2023 14:47:26 -0000 From: Rob Herring To: Amit Daniel Kachhap , Daniel Lezcano , Viresh Kumar , Lukasz Luba , "Rafael J. Wysocki" , Amit Kucheria , Zhang Rui , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Eduardo Valentin , Keerthy Cc: devicetree@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org Subject: [PATCH] thermal: Use of_property_present() for testing DT property presence Date: Fri, 10 Mar 2023 08:47:26 -0600 Message-Id: <20230310144726.1545543-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_144803_846018_119A2CFE X-CRM114-Status: GOOD ( 17.08 ) 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 Acked-by: Viresh Kumar --- drivers/thermal/cpufreq_cooling.c | 2 +- drivers/thermal/imx8mm_thermal.c | 2 +- drivers/thermal/imx_thermal.c | 4 ++-- drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/thermal/cpufreq_cooling.c b/drivers/thermal/cpufreq_cooling.c index 9f8b438fcf8f..4608555b7ec3 100644 --- a/drivers/thermal/cpufreq_cooling.c +++ b/drivers/thermal/cpufreq_cooling.c @@ -633,7 +633,7 @@ of_cpufreq_cooling_register(struct cpufreq_policy *policy) return NULL; } - if (of_find_property(np, "#cooling-cells", NULL)) { + if (of_property_present(np, "#cooling-cells")) { struct em_perf_domain *em = em_cpu_get(policy->cpu); cdev = __cpufreq_cooling_register(np, policy, em); diff --git a/drivers/thermal/imx8mm_thermal.c b/drivers/thermal/imx8mm_thermal.c index 72b5d6f319c1..334ce8e9830b 100644 --- a/drivers/thermal/imx8mm_thermal.c +++ b/drivers/thermal/imx8mm_thermal.c @@ -282,7 +282,7 @@ static int imx8mm_tmu_probe_set_calib(struct platform_device *pdev, * strongly recommended to update such old DTs to get correct * temperature compensation values for each SoC. */ - if (!of_find_property(pdev->dev.of_node, "nvmem-cells", NULL)) { + if (!of_property_present(pdev->dev.of_node, "nvmem-cells")) { dev_warn(dev, "No OCOTP nvmem reference found, SoC-specific calibration not loaded. Please update your DT.\n"); return 0; diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index fb0d5cab70af..77d6567a3f47 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c @@ -594,7 +594,7 @@ static int imx_thermal_register_legacy_cooling(struct imx_thermal_data *data) np = of_get_cpu_node(data->policy->cpu, NULL); - if (!np || !of_find_property(np, "#cooling-cells", NULL)) { + if (!np || !of_property_present(np, "#cooling-cells")) { data->cdev = cpufreq_cooling_register(data->policy); if (IS_ERR(data->cdev)) { ret = PTR_ERR(data->cdev); @@ -671,7 +671,7 @@ static int imx_thermal_probe(struct platform_device *pdev) platform_set_drvdata(pdev, data); - if (of_find_property(pdev->dev.of_node, "nvmem-cells", NULL)) { + if (of_property_present(pdev->dev.of_node, "nvmem-cells")) { ret = imx_init_from_nvmem_cells(pdev); if (ret) return dev_err_probe(&pdev->dev, ret, diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c index 8a9055bd376e..dace6591220e 100644 --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c @@ -223,7 +223,7 @@ int ti_thermal_register_cpu_cooling(struct ti_bandgap *bgp, int id) * using DT, then it must be aware that the cooling device * loading has to happen via cpufreq driver. */ - if (of_find_property(np, "#thermal-sensor-cells", NULL)) + if (of_property_present(np, "#thermal-sensor-cells")) return 0; data = ti_bandgap_get_sensor_data(bgp, id);