From patchwork Thu Aug 8 03:29:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "zhangzekun (A)" X-Patchwork-Id: 13757000 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 87C16C52D73 for ; Thu, 8 Aug 2024 07:07:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 039A410E66B; Thu, 8 Aug 2024 07:07:45 +0000 (UTC) X-Greylist: delayed 1076 seconds by postgrey-1.36 at gabe; Thu, 08 Aug 2024 04:00:14 UTC Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by gabe.freedesktop.org (Postfix) with ESMTPS id 40BB110E638 for ; Thu, 8 Aug 2024 04:00:14 +0000 (UTC) Received: from mail.maildlp.com (unknown [172.19.88.194]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4WfXsq29HGzcdQL; Thu, 8 Aug 2024 11:42:07 +0800 (CST) Received: from kwepemf500003.china.huawei.com (unknown [7.202.181.241]) by mail.maildlp.com (Postfix) with ESMTPS id 53A42140604; Thu, 8 Aug 2024 11:42:15 +0800 (CST) Received: from huawei.com (10.175.112.208) by kwepemf500003.china.huawei.com (7.202.181.241) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 8 Aug 2024 11:42:14 +0800 From: Zhang Zekun To: , , , , , , Subject: [PATCH] drm: Using for_each_available_child_of_node to simplify code logic Date: Thu, 8 Aug 2024 11:29:37 +0800 Message-ID: <20240808032937.103565-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: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemf500003.china.huawei.com (7.202.181.241) X-Mailman-Approved-At: Thu, 08 Aug 2024 07:07:43 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The while loop of of_get_next_available_child() can be replaced by for_each_available_child_of_node(). Using this helper function to make code logic more simple. Signed-off-by: Zhang Zekun --- drivers/gpu/drm/sti/sti_drv.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c index 1799c12babf5..3a2cf3dc880f 100644 --- a/drivers/gpu/drm/sti/sti_drv.c +++ b/drivers/gpu/drm/sti/sti_drv.c @@ -239,13 +239,9 @@ static int sti_platform_probe(struct platform_device *pdev) devm_of_platform_populate(dev); - child_np = of_get_next_available_child(node, NULL); - - while (child_np) { + for_each_available_child_of_node(node, child_np) drm_of_component_match_add(dev, &match, component_compare_of, child_np); - child_np = of_get_next_available_child(node, child_np); - } return component_master_add_with_match(dev, &sti_ops, match); }