From patchwork Fri Mar 10 14:47:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 67442 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp944270wrd; Fri, 10 Mar 2023 07:45:03 -0800 (PST) X-Google-Smtp-Source: AK7set80kJrrA01jPmoPDcq3kwq3s/Sf6BptgDYcjn8N0Ba/z0dwj6jEPOpTlsaN9DukXsbUiHtT X-Received: by 2002:a17:90a:db92:b0:237:44ad:5124 with SMTP id h18-20020a17090adb9200b0023744ad5124mr27032563pjv.42.1678463103699; Fri, 10 Mar 2023 07:45:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678463103; cv=none; d=google.com; s=arc-20160816; b=iuaSqmVlCnxWoytymV4fKG6VKUoMev0nwtWL41tmZ2cfYixf5ZPDF5bobsPkZsaIOa SEA8WBGp5eELGktwFQ8fxbjPiEdGaRajOucFBhnO71OY1u4t/GZp/Pg7Ev/IOFJP7qWi BI/+5gHnJCCTdCvtrqBAcd5iVlrXhmlSKp3pDYuNOuoqNbmneJG3d2A5LcnXw+OSK4ub F+f18n4Y2nAQp+fMyQ5Z7ANGL5FwvSiDq9tIk2eey7FuMSIRMuvrf8UfcSX7aQnalkaY VcsQKQ/YMUiAW7g6e6AhtwmJzbHsoPHCjbXKCz2v9EI69U8a3z34iQKxCswDZo9IulGc Upog== 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=qeturFWI0c03F8rWh31njjpGhdYT8mTfReK2FhO4MIc=; b=yZX8ei8GV+Zq5rneHhy7/t9QNYdeJG3LOSK1+VPoKgSJCsm9vEcLB32YGvb+ymF9Wn cM1CjPsaj53POEUdURCFiHWhzAX6df7XMAlTZHLhYh1+7Hzy02Q09798l14MX4gSmIkl CQ4/OcF1N6IfACE5mVPN4jj0yzyU6SW4XT4f4EsUZn6yQFBMRh6RDWmBcTi91yD8izqN Mza2NZBcEAE/5C9JfedJMMGGU4Q27T2rUIT2CfoZBiYhQeUSyUFOBXLUiTXNRJFBuLKd 2vcq7inG4HcE4w2T0KOwvMfSKheKIufjcnDlfLI3gaqnIsjixyeNml8QY4nM/8JQTXx2 bd5w== 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 q12-20020a17090a9f4c00b00233866f90e3si107167pjv.125.2023.03.10.07.44.48; Fri, 10 Mar 2023 07:45:03 -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 S233403AbjCJOx5 (ORCPT + 99 others); Fri, 10 Mar 2023 09:53:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233362AbjCJOx2 (ORCPT ); Fri, 10 Mar 2023 09:53:28 -0500 Received: from mail-oa1-f45.google.com (mail-oa1-f45.google.com [209.85.160.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4ADFC12A177; Fri, 10 Mar 2023 06:49:29 -0800 (PST) Received: by mail-oa1-f45.google.com with SMTP id 586e51a60fabf-176b90e14a9so6042731fac.9; Fri, 10 Mar 2023 06:49:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678459710; 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=qeturFWI0c03F8rWh31njjpGhdYT8mTfReK2FhO4MIc=; b=qpN68uxFMkAhzOOE2wZuiL6ROS2+ZhJGCmwTi51uEHDOuQhG4Lg1cx2LJurdycqZgA sb8bC/inS+RWh4+GYk+BhWuBY7BXmGtuZCgI1YZavz8L62jvDlwUPHD/yiPl+To6lOuc iHT5iHLLAu+aQtZuVd6TwLrtTSAO+AmZloZCk8uddjP9EzBlSUVXDo8SAj/3AY+2fxOd 8qbvVgRuI4xkl7aIX+y78gP0Bj/CilfD2TUsfSEPOcYk4CbH83IyMSP9vkZBWGcMPYWO NPYRcX3sEffuEZmw5/JqYw/mJ0wY9e+JwqKLOtl5GuWAR06dRgsSq692sfPgtbD/ymFN PDiA== X-Gm-Message-State: AO0yUKUxCbXbBBOKDYvtngtS6Gv6sfTCgXdCUe/wVbt9P4GLE/ml7ZHy KdqF9RT4HHzxAbkiqmnn0w== X-Received: by 2002:a05:6870:c10e:b0:172:2d0b:6121 with SMTP id f14-20020a056870c10e00b001722d0b6121mr5430915oad.36.1678459709956; Fri, 10 Mar 2023 06:48:29 -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 ax16-20020a05687c021000b00176d49bb898sm79608oac.44.2023.03.10.06.48.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Mar 2023 06:48:29 -0800 (PST) Received: (nullmailer pid 1544400 invoked by uid 1000); Fri, 10 Mar 2023 14:47:19 -0000 From: Rob Herring To: Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: devicetree@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] opp: Use of_property_present() for testing DT property presence Date: Fri, 10 Mar 2023 08:47:18 -0600 Message-Id: <20230310144719.1544374-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?1759996127533578287?= X-GMAIL-MSGID: =?utf-8?q?1759996127533578287?= 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/opp/of.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/opp/of.c b/drivers/opp/of.c index e55c6095adf0..bed2b651deb0 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -224,7 +224,7 @@ void _of_init_opp_table(struct opp_table *opp_table, struct device *dev, of_property_read_u32(np, "voltage-tolerance", &opp_table->voltage_tolerance_v1); - if (of_find_property(np, "#power-domain-cells", NULL)) + if (of_property_present(np, "#power-domain-cells")) opp_table->is_genpd = true; /* Get OPP table node */ @@ -536,7 +536,7 @@ static bool _opp_is_supported(struct device *dev, struct opp_table *opp_table, * an OPP then the OPP should not be enabled as there is * no way to see if the hardware supports it. */ - if (of_find_property(np, "opp-supported-hw", NULL)) + if (of_property_present(np, "opp-supported-hw")) return false; else return true;