Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp3175390rwl; Mon, 27 Mar 2023 10:12:02 -0700 (PDT) X-Google-Smtp-Source: AKy350b0ZcYHh3aDoiFwOScEeTim5NDNzObGrNgA1i1+I/ZsVJE2kMToiDyxiI+eQttCggCN5bYX X-Received: by 2002:aa7:c9c6:0:b0:4ac:d8a1:7385 with SMTP id i6-20020aa7c9c6000000b004acd8a17385mr11815224edt.3.1679937122786; Mon, 27 Mar 2023 10:12:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679937122; cv=none; d=google.com; s=arc-20160816; b=MGFtgaECUCTE16XP93f9mdIzxVTo0TlCKUxjLQmLxnvzfuO5Ih9BszypZRxy7NNG3Y 0MRsybggPZ9DUYA8VZa3fJb8xn/mz04MwJXbirlZq8GNXzAoH7aQZ+t7JM9yRSavfiHQ GUwEJ/2ezw1iPH+TFTIb/zMwx7d8uuhU2abKgJU2SyTUVlDMdPP2NJD/Yeycne96Rr8t wtLdoWf6/At00Kd+K9E6J0l47HzXWKQJWUzkzORxy+4SMBYcmMBnc1kHNWlooo1698n4 /MNxzO++DyA81Ew3mnyEaq1HN/g+BzdxZEusBCFWmlIJS0vhfD06DVDwKOiK13az/M1l 4YEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=x3NPX7qP1fi9iqLhRk71dwh1UygXWL5aqDyQiR0krzQ=; b=bBFGnz8mK7itlEiEI5YctmpMCiXGXdsFtahIo03Riq0DNINiH2VIPcC2dwecHduC4D BNA5iRtYWIWHkY9thBPpMJ6MFguR5jh0sGXB3UydwxaXAhTr20Oqh9XF2ew9TP7RGoz4 10J7DEavLUlcOw4q8ksADfjUkK2hkQgNR08At0F8VONKSzzgKlceTXscePTFuuXNb0ZJ RUHcj89T8bxVSA0rER6lVDX0Uiq/vAgYU8WVZhhECzAeOWFdMHT5ZsR57ikTWvyTfh7K A9naIOA8Th3E0cbasfocXi29NDIfo5g0F1WNP0xvMirnp1QMsHj7U+ZaYmS5dLCWokZ1 h1Sw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j14-20020aa7ca4e000000b005024aad61cdsi957143edt.552.2023.03.27.10.11.37; Mon, 27 Mar 2023 10:12:02 -0700 (PDT) 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 S232318AbjC0RKf convert rfc822-to-8bit (ORCPT + 99 others); Mon, 27 Mar 2023 13:10:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231493AbjC0RKR (ORCPT ); Mon, 27 Mar 2023 13:10:17 -0400 Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA2184696; Mon, 27 Mar 2023 10:09:43 -0700 (PDT) Received: by mail-ed1-f51.google.com with SMTP id er18so27854570edb.9; Mon, 27 Mar 2023 10:09:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679936982; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=916y5uBFwWgOo9alDh+0q8lvXTnxrYU+/IU/mAeJkWc=; b=0A4bKicBw3OVXe1hkC02o9BBH13efEtdDb+1BSIsCJ0MGcATYu2BfSjK1gw+ELwQS2 a4KCH9sj8KmtJHRxz1N+5AhNOgupgWw1LtDxi/bhiAQaySmxorX/L6dZAIMwyWRQrSnA GknkHAjc8bXFZUuzQvWPuIVrZC+2kYWByNhQw/IdvXlTSgDu1sx+jOaRCMpPyxQxb2dG JueBkjQeT3XlGDBK/NjELoVSNKS0/D1tszLiMZVHtAhUFl4TkvLoPS1cBDewYauc1F7N ubYdbS4HkW4eeaubLLmKHSxt34kjdo49MCFCDpTBu6r1xPpJTG3OVwDWt6jTkHl+iCle UrhQ== X-Gm-Message-State: AAQBX9essL3M38COOhRUm3bvldGThoEsklp5L5PTeHmzYtOqOOy1XPk7 bv8HNe5UsFbZBEafmbb0w19Kng2tikpg8qvVvPWlhZkx X-Received: by 2002:a17:906:5fca:b0:930:310:abcf with SMTP id k10-20020a1709065fca00b009300310abcfmr6216312ejv.2.1679936982247; Mon, 27 Mar 2023 10:09:42 -0700 (PDT) MIME-Version: 1.0 References: <20230310144703.1541888-1-robh@kernel.org> In-Reply-To: From: "Rafael J. Wysocki" Date: Mon, 27 Mar 2023 19:09:30 +0200 Message-ID: Subject: Re: [PATCH] cpuidle: Use of_property_present() for testing DT property presence To: Ulf Hansson Cc: Rob Herring , "Rafael J. Wysocki" , Daniel Lezcano , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , devicetree@vger.kernel.org, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=0.5 required=5.0 tests=FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,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 On Fri, Mar 10, 2023 at 6:47 PM Ulf Hansson wrote: > > On Fri, 10 Mar 2023 at 15:47, Rob Herring wrote: > > > > 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: Ulf Hansson > > Rafael, can you please pick this via your tree. Done (queued up for 6.4), thanks! > > --- > > drivers/cpuidle/cpuidle-psci-domain.c | 2 +- > > drivers/cpuidle/cpuidle-riscv-sbi.c | 6 +++--- > > 2 files changed, 4 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidle-psci-domain.c > > index 6ad2954948a5..e875ddadc51b 100644 > > --- a/drivers/cpuidle/cpuidle-psci-domain.c > > +++ b/drivers/cpuidle/cpuidle-psci-domain.c > > @@ -165,7 +165,7 @@ static int psci_cpuidle_domain_probe(struct platform_device *pdev) > > * initialize a genpd/genpd-of-provider pair when it's found. > > */ > > for_each_child_of_node(np, node) { > > - if (!of_find_property(node, "#power-domain-cells", NULL)) > > + if (!of_property_present(node, "#power-domain-cells")) > > continue; > > > > ret = psci_pd_init(node, use_osi); > > diff --git a/drivers/cpuidle/cpuidle-riscv-sbi.c b/drivers/cpuidle/cpuidle-riscv-sbi.c > > index be383f4b6855..1fab1abc6eb6 100644 > > --- a/drivers/cpuidle/cpuidle-riscv-sbi.c > > +++ b/drivers/cpuidle/cpuidle-riscv-sbi.c > > @@ -497,7 +497,7 @@ static int sbi_genpd_probe(struct device_node *np) > > * initialize a genpd/genpd-of-provider pair when it's found. > > */ > > for_each_child_of_node(np, node) { > > - if (!of_find_property(node, "#power-domain-cells", NULL)) > > + if (!of_property_present(node, "#power-domain-cells")) > > continue; > > > > ret = sbi_pd_init(node); > > @@ -548,8 +548,8 @@ static int sbi_cpuidle_probe(struct platform_device *pdev) > > for_each_possible_cpu(cpu) { > > np = of_cpu_device_node_get(cpu); > > if (np && > > - of_find_property(np, "power-domains", NULL) && > > - of_find_property(np, "power-domain-names", NULL)) { > > + of_property_present(np, "power-domains") && > > + of_property_present(np, "power-domain-names")) { > > continue; > > } else { > > sbi_cpuidle_use_osi = false; > > -- > > 2.39.2 > >