From patchwork Thu Aug 8 07:45:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Zekun X-Patchwork-Id: 13757074 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 87AC6C3DA4A for ; Thu, 8 Aug 2024 07:57:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1245910E67B; Thu, 8 Aug 2024 07:57:54 +0000 (UTC) Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) by gabe.freedesktop.org (Postfix) with ESMTPS id CCF5710E67B for ; Thu, 8 Aug 2024 07:57:51 +0000 (UTC) Received: from mail.maildlp.com (unknown [172.19.88.214]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4WffRN4ftLz1S7LL; Thu, 8 Aug 2024 15:53:04 +0800 (CST) Received: from kwepemf500003.china.huawei.com (unknown [7.202.181.241]) by mail.maildlp.com (Postfix) with ESMTPS id 1A2111A016C; Thu, 8 Aug 2024 15:57:49 +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 15:57:48 +0800 From: Zhang Zekun To: , , , , , , CC: Subject: [PATCH] drm: Using for_each_available_child_of_node to simplify code logic Date: Thu, 8 Aug 2024 15:45:10 +0800 Message-ID: <20240808074510.3792-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: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemf500003.china.huawei.com (7.202.181.241) 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); }