From patchwork Fri Aug 18 07:01:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Zekun X-Patchwork-Id: 715645 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7304EC05052 for ; Fri, 18 Aug 2023 07:11:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237838AbjHRHKl (ORCPT ); Fri, 18 Aug 2023 03:10:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358130AbjHRHK3 (ORCPT ); Fri, 18 Aug 2023 03:10:29 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 056E230D1 for ; Fri, 18 Aug 2023 00:10:27 -0700 (PDT) Received: from kwepemi500019.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RRtGD6NH1ztRtk; Fri, 18 Aug 2023 15:06:44 +0800 (CST) Received: from huawei.com (10.175.112.208) by kwepemi500019.china.huawei.com (7.221.188.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 18 Aug 2023 15:10:22 +0800 From: Zhang Zekun To: , , , , CC: Subject: [PATCH] soc: ti: Use for_each_node_with_property() simplify code logic Date: Fri, 18 Aug 2023 15:01:49 +0800 Message-ID: <20230818070149.23103-1-zhangzekun11@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.175.112.208] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemi500019.china.huawei.com (7.221.188.117) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Introduct for_each_node_with_property() to iterate through the nodes, this can simplify the code logic a bit, no functional change here. Signed-off-by: Zhang Zekun Acked-by: Nishanth Menon --- drivers/genpd/ti/ti_sci_pm_domains.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/genpd/ti/ti_sci_pm_domains.c b/drivers/genpd/ti/ti_sci_pm_domains.c index a33ec7eaf23d..34645104fe45 100644 --- a/drivers/genpd/ti/ti_sci_pm_domains.c +++ b/drivers/genpd/ti/ti_sci_pm_domains.c @@ -119,7 +119,7 @@ static int ti_sci_pm_domain_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct ti_sci_genpd_provider *pd_provider; struct ti_sci_pm_domain *pd; - struct device_node *np = NULL; + struct device_node *np; struct of_phandle_args args; int ret; u32 max_id = 0; @@ -138,11 +138,7 @@ static int ti_sci_pm_domain_probe(struct platform_device *pdev) INIT_LIST_HEAD(&pd_provider->pd_list); /* Find highest device ID used for power domains */ - while (1) { - np = of_find_node_with_property(np, "power-domains"); - if (!np) - break; - + for_each_node_with_property(np, "power-domains") { index = 0; while (1) {