From patchwork Wed Sep 4 06:11:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13789828 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 E068ACD37AE for ; Wed, 4 Sep 2024 06:54:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Date: Content-Type:Subject:From:References:In-Reply-To:To:Message-ID:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=cBdK7XNGwAFifeMrF8StvwRs0AlEsC+Eo4kDsXyG4t4=; b=Mpzo1cnzHXXAP3M2nAP+Jw9fG4 vyJD71DJWakg20tpfmRbZ2CujC0uz+uGhbqf4bdJFx+asBf7yrY3ka7M3f4SKBqlanMxtJPXkgzSi xAK+6O9w1317FZ76byR2Jnd0XZaBIsKBtiG6VnXBul5p3NuuqWgUoP4kozA64Y0ApYpM/uh7alcy2 CQMjvnQcyYNHfa04xtmTsmidfDmgBkUKyg7aFU42F7mP52PYRPmqlQoQYbjtkRVdoQqFBf4eTA0KF 5kbIQSU4fGR+NWn5rzmbAmCnaQ51mwjAMO4sTubQvaV7TRE4ftIkncsrepUTosQH7Z4LP6/1wg6DV rxrFqyPA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sljG3-00000002zlD-3g78; Wed, 04 Sep 2024 06:12:47 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sljF9-00000002zfK-30lJ for linux-arm-kernel@bombadil.infradead.org; Wed, 04 Sep 2024 06:11:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=MIME-Version:Date:Content-Type:Subject :From:References:In-Reply-To:To:Message-ID:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description; bh=cBdK7XNGwAFifeMrF8StvwRs0AlEsC+Eo4kDsXyG4t4=; b=BMgZ4W13Rud2A3Z4jr7ysRS1rb Kpy+wK10HyZXjwpAT79C7FM1Ub8NcxuqHgfTBABbmDSV+P7zrkyRD2lH2VF5aB8mytNNaqxzYBv4s T60HcLp/fFaVVhFWHJujWwuLBWxecK1z9AeowriE2Mmv5vIq30CNblRxt3CmJxGfG/VVqnfOKPfqv dsTjbNfrhWsxRDM8qzorOqW7kayoc7GPyURSzq6YZwnAxvj5Udkhce/M1KBy6qCBne5n89BZrduEp eXI6FZ3twO3gApLO3Lc15goHuHhc25I4a+umlfKo4KhIpMvzHyiG+mH8iIznd/v00zSo7Ug2zPSLR p01cEFLg==; Received: from mail-japaneastazlp170110002.outbound.protection.outlook.com ([2a01:111:f403:c405::2] helo=TYVP286CU001.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sljF0-0000000081I-0Kfb for linux-arm-kernel@lists.infradead.org; Wed, 04 Sep 2024 06:11:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bDWIN9O+DAgP+Q/RuhOx28dOD0WJGqJNg5/XJ+xL0eg8ENypXjNwb6zPG7pVPslFf0gFxRPrRuKfxWdr3J6iLxYtzhnqGvzNgzD9f41/JPCB0Htve8+IuVKevlgUuQUGiMphYIyBjgmWH/Z2As9aXcNHbuC1nhjRuimU8++s4Xb/9KtPXKwuCO38RnYPPFxYL0P9VwPGoS7EC44d1YNhUZMsXQH6sD72FOMYZSmpJrtl3QNfo6PPqw4deqkMmWQGX8YP+0SdQPGy3mpJS/9YCh3zFz2ajvY7MggBe+bFl/3lAtFh2d1fnHRuqiNFrLA80UUepFbEjlqwHjZqlaZXPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cBdK7XNGwAFifeMrF8StvwRs0AlEsC+Eo4kDsXyG4t4=; b=o6RNm24njkiOQXU/sgZLPW1ZC/f4UMUrZhTzxTO3e/mg8HOofEOcSSOv16IA8QiQfCDiz81mSJuKJ/RwF/97ZXdmYa22WTFDOoKksbhrwU16kjhFi+psbbwQJob+KeRL9JMsBIGX62VbQLhRzpBLOG8SYLpA/DucqQyyYBXE5eDiPR+6EezypUkaxAuh1YOwJ0v2Z2Pn+mVbpvnu+uzdY8XbdALeHwMGuuPRUZcKZppqKiTz4CyPgNBtLWZHI50BoK88G/sjm7LayZYIGdE7uSVwgPFEzda4fuW2+b7VaXlkRlH/GWhHFRgbPzA10RBGC4P6wK9zoxRM+MINUS9/tA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=renesas.com; dmarc=pass action=none header.from=renesas.com; dkim=pass header.d=renesas.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cBdK7XNGwAFifeMrF8StvwRs0AlEsC+Eo4kDsXyG4t4=; b=FB1nYO4tNxZD6u1K0sSDT5tp6KdrW1NsK457e240C02yDioUAcm9NjUMRhSYaGN7aEVYwKL1Xhc/djNTZulmXRBhYQdePkGzqBKmotormQW8htFuZClX418CcFKUPVuhvAv9yGNAADB+jF7Dm2tUoO/ZPYvlPLlOTh1AKcYcUWQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) by OS3PR01MB7309.jpnprd01.prod.outlook.com (2603:1096:604:11e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.27; Wed, 4 Sep 2024 06:11:07 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%5]) with mapi id 15.20.7918.024; Wed, 4 Sep 2024 06:11:07 +0000 Message-ID: <87plpk6j9h.wl-kuninori.morimoto.gx@renesas.com> To: Daniel Vetter , David Airlie , Helge Deller , Jaroslav Kysela , Laurent Pinchart , Liam Girdwood , Maarten Lankhorst , Mark Brown , Mauro Carvalho Chehab , Maxime Ripard , Michal Simek , Rob Herring , Saravana Kannan , Takashi Iwai , Thomas Zimmermann , Tomi Valkeinen , devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-fbdev@vger.kernel.org, linux-media@vger.kernel.org, linux-omap@vger.kernel.org, linux-sound@vger.kernel.org, Sakari Ailus In-Reply-To: <87r0a06ja1.wl-kuninori.morimoto.gx@renesas.com> References: <87r0a06ja1.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v5 1/9] of: property: add of_graph_get_next_port() User-Agent: Wanderlust/2.15.9 Emacs/29.3 Mule/6.0 Date: Wed, 4 Sep 2024 06:11:07 +0000 X-ClientProxiedBy: TYWP286CA0024.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:262::9) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OS3PR01MB7309:EE_ X-MS-Office365-Filtering-Correlation-Id: 4fce479d-05c0-47e6-afd0-08dccca85d5f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|52116014|7416014|921020|38350700014; X-Microsoft-Antispam-Message-Info: K63N/xyLjWgLL2cdkVeOy605j/b4p9wDF3VjKWkq0ruGYJNXwf1qFrLH7GxylV3MtOlOlQvRSGThHa+mbFbvU9fSdsK2QJ0+zU9Caf5wWjnGw8UT9I4WAsPtLV0pqVGcNWctcGj7J/sb+5EMh7l6MtdmoVMOW6/boVlP7gST2cUmy6IaG+630Q+UBC4rHO01ZOOFKDHFvxoo3Q+10zYBROLsVs4wPVSYM3fgNf4ayjh9DXW7vDbNnFMiehLo6uJavJeJ8SKQdlIxMK+Z2Lc+zM6MeKWCPP6Ll+3e7m/ReSIHdnIct0jSyiIz5N0r0wzz3LKu5YL4dw6alMvtj/8IMXCtOoy7CAw54IF3BM8KyTLMiUTaZuM7bd3kR4QQIFxRulxyy5rgUIYDk7xS93dJHWGB0qwKQa+VD482ogoZg7WViBmxGjqpijG5With9k85IhpgdeD2hgu5y9rVhiuycbfdsjidT4aS8r7IdDP6zSO075sK+L5KwQcqqjWcGd/lBrTQwXtB+XNhTzQHrkoMU2WdZMydOpgQRDmViab53v+tnBLlB6QS88Hyz5/NTIEJuFIj9NsZC7gbQshHx2fsKqNAbpyvjovguD1gmnTQRc7cHr0KNHYPv5Dk5qTHsFMsj6H454NVqtaqJyn3osa2Ii5ExI57NuAtTZZ57flD1ZAqfgopWZ2w0u/L39csaoydzpL/LQPT3uc+OkKV1cUUXmAIc2wBCtsa4h4jnP3WtB5P2RsGKyrMAm8Fx5LCSE8695RcSfyzs7VVSNG2Kq7kusD9ZPYiXHHrhDTyIN6bGTmEDGJSkWsnVMZtG1QiUHgN7JIXYtu4P5nu751vYy0BrbDUtATidvLkqoy1D87/Qxc8Rr42hSnaS6iqX1Gtr8CD/wITzEJbzQD8xaWfRZCCAR28BVko/gEHEDY98dHSA+xztlwECdiNTd3Gtbj6mO9MRpDOD82+OoIMK6q3YTZ6ZA4hs2WZV2MVwE/J5kWkGYNiPX17QpJA++T94eBNtHaUFvTC7pNHgeX70fIT/+V6l5pJ/yZNkdrGTkuqVp8IYL1enl3EMKkkakZZkkE+Z1U3+uvpOEXSrsZSrBe2/zDjNWIcEcST0Sc5J9fBr9jOfe8eUIc3iI3eN6fKzixxLGdpfM611YQ6KohLkyvC0fySDMGKK0qZKwapcvRIFSytE6Je6Jpize0GMHPgL9LALonbU5RJHI5NaIlK9jJXRjc8H5QAc/eldTZ44oyuEkA8jnazFJbmyBRsVwmpmrzNINB8nTl8XUcG8SbmHs5NlDHHcCXhsBBtQ6iZNWGB06rIPQUYc8gvzY4yPHwq6tZ7KYTIUQNhlMyEKLZ5dpBWp2AouAHlJba/KbbCH1g+UrvhE0FGHHESAE24LrKCXPL3PlwUJj+qr1gsS7EcEELR55oDStHgCAiLoiKMvdxSQNpd7GI= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYCPR01MB10914.jpnprd01.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014)(52116014)(7416014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5O/yp6rfZygm+rqXrEKr85qmtbO3wpv9Z/MfFq9e0tOz3BRZGI+UPy9VTb4HCO8Y2GGHJnf2p5hA9zAm3z9XBXXAByaemsRnWhQZDKH3hftGjniy6bSrzORC/aJXc272+qgkRH/1wC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lmOLzor1I0UYeADU9DcjUEOYkVjw8cyb8N2FwJoDrWzF1hrhuThfwSThQTrOLal0SIv1xISVWuZLuh7CmxElOGCzAVq9Lf/LqcefZ95+/5CqSkkGUse1kZVPpRTRjcY9mcGLr0v8UvgP/lDowR7nWkSRy14L4mPQxqw2tlS1h87WaJCJ24MVQ1Br9B5VZU+OaVN9HunMeAzDjVt8GtVtGL6lI+QChECvR9jtYLKVQaZM22+mTCNBHSKRxfUWax24g1UnjNrI542wPgmUjJbdzOv46189/R9AWF3E+4vKADdB/4XInWGapWQ5nIrX5JXvE+cIKWkiFDZQbGpNTdv6rkFb89oCJ8Iayt9DRD8tYF1hb06ijaIo59A0TbO4aBpulE8g2np5nx0ksh079v+xaf98giaQFwMh8= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4fce479d-05c0-47e6-afd0-08dccca85d5f X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2024 06:11:07.3934 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: j13Wl27GJDz2eWnvuAalg8el6HKoQXDRJTnRVFldJNm1ezlB+YvR6UqZVPUXDTQgg9RalqDuov3Oez6YD0Izz3yf2gKsdbTMAzn1/nClNP5hJ3gLNQP5o5+NKnwrQSyY X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS3PR01MB7309 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240904_071143_488847_F401B19F X-CRM114-Status: GOOD ( 21.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org We have endpoint base functions - of_graph_get_next_device_endpoint() - of_graph_get_device_endpoint_count() - for_each_of_graph_device_endpoint() Here, for_each_of_graph_device_endpoint() loop finds each endpoints ports { port@0 { (1) endpoint {...}; }; port@1 { (2) endpoint {...}; }; ... }; In above case, it finds endpoint as (1) -> (2) -> ... Basically, user/driver knows which port is used for what, but not in all cases. For example on flexible/generic driver case, how many ports are used is not fixed. For example Sound Generic Card driver which is used from many venders can't know how many ports are used. Because the driver is very flexible/generic, it is impossible to know how many ports are used, it depends on each vender SoC and/or its used board. And more, the port can have multi endpoints. For example Generic Sound Card case, it supports many type of connection between CPU / Codec, and some of them uses multi endpoint in one port. Then, Generic Sound Card want to handle each connection via "port" instead of "endpoint". But, it is very difficult to handle each "port" via existing for_each_of_graph_device_endpoint(). Getting "port" via of_get_parent() from "endpoint" doesn't work. see below. ports { port@0 { (1) endpoint@0 {...}; (2) endpoint@1 {...}; }; port@1 { (3) endpoint {...}; }; ... }; In other case, we want to handle "ports" same as "port" for some reasons. node { => ports@0 { port@0 { ... }; port@1 { ... }; ... }; => ports@1 { ... }; }; Add "ports" / "port" base functions. Signed-off-by: Kuninori Morimoto --- drivers/of/property.c | 127 +++++++++++++++++++++++++++++++++++++++ include/linux/of_graph.h | 50 +++++++++++++++ 2 files changed, 177 insertions(+) diff --git a/drivers/of/property.c b/drivers/of/property.c index 164d77cb94458..ad834d8b8c1fe 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -625,6 +625,97 @@ struct device_node *of_graph_get_port_by_id(struct device_node *parent, u32 id) } EXPORT_SYMBOL(of_graph_get_port_by_id); +/** + * of_graph_get_next_ports() - get next ports node. + * @parent: pointer to the parent device node + * @prev: previous ports node, or NULL to get first + * + * If "parent" node doesn't have "ports" node, it returns "parent" node itself as "ports" node. + * + * Return: A 'ports' node pointer with refcount incremented. Refcount + * of the passed @prev node is decremented. + */ +struct device_node *of_graph_get_next_ports(struct device_node *parent, + struct device_node *prev) +{ + if (!parent) + return NULL; + + if (!prev) { + /* + * Find "ports" node from parent + * + * parent { + * => ports { + * port {...}; + * }; + * }; + */ + prev = of_get_child_by_name(parent, "ports"); + + /* + * Use parent as its ports if it not exist + * + * => parent { + * port {...}; + * }; + */ + if (!prev) { + /* check whether "parent" has "port" node */ + struct device_node *port __free(device_node) = of_get_child_by_name(parent, "port"); + + if (port) + prev = of_node_get(parent); + } + + return prev; + } + + /* Find next ports */ + do { + prev = of_get_next_child(parent, prev); + if (!prev) + break; + } while (!of_node_name_eq(prev, "ports")); + + return prev; +} +EXPORT_SYMBOL(of_graph_get_next_ports); + +/** + * of_graph_get_next_port() - get next port node. + * @parent: pointer to the parent device node, or parent ports node + * @prev: previous port node, or NULL to get first + * + * Parent device node can be used as @parent whether device node has ports node or not. + * It will work same as ports@0 node. + * + * Return: A 'port' node pointer with refcount incremented. Refcount + * of the passed @prev node is decremented. + */ +struct device_node *of_graph_get_next_port(struct device_node *parent, + struct device_node *prev) +{ + if (!parent) + return NULL; + + if (!prev) { + struct device_node *ports __free(device_node) = + of_graph_get_next_ports(parent, NULL); + + return of_get_child_by_name(ports, "port"); + } + + do { + prev = of_get_next_child(parent, prev); + if (!prev) + break; + } while (!of_node_name_eq(prev, "port")); + + return prev; +} +EXPORT_SYMBOL(of_graph_get_next_port); + /** * of_graph_get_next_endpoint() - get next endpoint node * @parent: pointer to the parent device node @@ -823,6 +914,42 @@ unsigned int of_graph_get_endpoint_count(const struct device_node *np) } EXPORT_SYMBOL(of_graph_get_endpoint_count); +/** + * of_graph_get_port_count() - get the number of port in a device or ports node + * @np: pointer to the device or ports node + * + * Return: count of port of this device or ports node + */ +unsigned int of_graph_get_port_count(struct device_node *np) +{ + unsigned int num = 0; + + for_each_of_graph_port(np, port) + num++; + + return num; +} +EXPORT_SYMBOL(of_graph_get_port_count); + +/** + * of_graph_get_ports_count() - get the number of ports in a device node + * @np: pointer to the device node + * + * If device node doesn't have ports node, it assumes device node itself as ports node. + * + * Return: count of ports of this device node + */ +unsigned int of_graph_get_ports_count(struct device_node *np) +{ + unsigned int num = 0; + + for_each_of_graph_ports(np, ports) + num++; + + return num; +} +EXPORT_SYMBOL(of_graph_get_ports_count); + /** * of_graph_get_remote_node() - get remote parent device_node for given port/endpoint * @node: pointer to parent device_node containing graph port/endpoint diff --git a/include/linux/of_graph.h b/include/linux/of_graph.h index a4bea62bfa290..6fbd2c8696fd9 100644 --- a/include/linux/of_graph.h +++ b/include/linux/of_graph.h @@ -11,6 +11,7 @@ #ifndef __LINUX_OF_GRAPH_H #define __LINUX_OF_GRAPH_H +#include #include #include @@ -37,14 +38,44 @@ struct of_endpoint { for (child = of_graph_get_next_endpoint(parent, NULL); child != NULL; \ child = of_graph_get_next_endpoint(parent, child)) +/** + * for_each_of_graph_ports - iterate over every ports in a device node + * @parent: parent device node containing ports + * @child: loop variable pointing to the current ports node + * + * When breaking out of the loop, and continue to use the @child, you need to + * use return_ptr(@child) or no_free_ptr(@child) not to call __free() for it. + */ +#define for_each_of_graph_ports(parent, child) \ + for (struct device_node *child __free(device_node) = of_graph_get_next_ports(parent, NULL);\ + child != NULL; child = of_graph_get_next_ports(parent, child)) + +/** + * for_each_of_graph_port - iterate over every port in a device or ports node + * @parent: parent device or ports node containing port + * @child: loop variable pointing to the current port node + * + * When breaking out of the loop, and continue to use the @child, you need to + * use return_ptr(@child) or no_free_ptr(@child) not to call __free() for it. + */ +#define for_each_of_graph_port(parent, child) \ + for (struct device_node *child __free(device_node) = of_graph_get_next_port(parent, NULL);\ + child != NULL; child = of_graph_get_next_port(parent, child)) + #ifdef CONFIG_OF bool of_graph_is_present(const struct device_node *node); int of_graph_parse_endpoint(const struct device_node *node, struct of_endpoint *endpoint); unsigned int of_graph_get_endpoint_count(const struct device_node *np); +unsigned int of_graph_get_port_count(struct device_node *np); +unsigned int of_graph_get_ports_count(struct device_node *np); struct device_node *of_graph_get_port_by_id(struct device_node *node, u32 id); struct device_node *of_graph_get_next_endpoint(const struct device_node *parent, struct device_node *previous); +struct device_node *of_graph_get_next_ports(struct device_node *parent, + struct device_node *ports); +struct device_node *of_graph_get_next_port(struct device_node *parent, + struct device_node *port); struct device_node *of_graph_get_endpoint_by_regs( const struct device_node *parent, int port_reg, int reg); struct device_node *of_graph_get_remote_endpoint( @@ -73,6 +104,11 @@ static inline unsigned int of_graph_get_endpoint_count(const struct device_node return 0; } +static inline unsigned int of_graph_get_port_count(struct device_node *np) +{ + return 0; +} + static inline struct device_node *of_graph_get_port_by_id( struct device_node *node, u32 id) { @@ -86,6 +122,20 @@ static inline struct device_node *of_graph_get_next_endpoint( return NULL; } +static inline struct device_node *of_graph_get_next_ports( + struct device_node *parent, + struct device_node *previous) +{ + return NULL; +} + +static inline struct device_node *of_graph_get_next_port( + struct device_node *parent, + struct device_node *previous) +{ + return NULL; +} + static inline struct device_node *of_graph_get_endpoint_by_regs( const struct device_node *parent, int port_reg, int reg) { From patchwork Wed Sep 4 06:11:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13789895 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 A3685CA0ED3 for ; Wed, 4 Sep 2024 07:30:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Date: Content-Type:Subject:From:References:In-Reply-To:To:Message-ID:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ZKmyRCnlh6pRp4xGuOPDxacwiqr8lRXCkyf1F2DnBB8=; b=imR2voF/q/cU9FTQR15rLnsv6I hea9984wIDDIKPXjVZb+1T17Nlm01eH5EHuxsoKIa+rwmv+aAtNRSiXuMfN1OoczccGhBwls0mrwo kXToFjCbLzwAdF136okfn/hJA4dp7s+5dDZjaq3F/AVHv4fssEcbLL8M/LnHGCB+qhJUVgiYSn3Tr EUXLY/ODJbqCqr1U6t3tCwRsg9Ml5I/6nyUS4R+XlGHWtH6E2y3xN+7JQ7R3M4Mv8BizLINKUcPD+ 4fHRleHNSSm+b0vbRMGu+eORG4BDG6KepllIx8JAuWjUtn9lSiGkbtTEGcnkstFKbLx4xATifo78k jaDRXNMQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1slkTW-00000003CAO-1myO; Wed, 04 Sep 2024 07:30:47 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sljFY-00000002zia-19TN for linux-arm-kernel@bombadil.infradead.org; Wed, 04 Sep 2024 06:12:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=MIME-Version:Date:Content-Type:Subject: From:References:In-Reply-To:To:Message-ID:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description; bh=ZKmyRCnlh6pRp4xGuOPDxacwiqr8lRXCkyf1F2DnBB8=; b=uvnJIRNzmqUrjz4eIVGrIC1U75 cYrMBIbsQEOW0Mx1zo6AwvzR9JBwLE5TE1/Zv8C7TdEagCJagYEInKEUHc9iyig+c8liAgMbzGJxH 8REXoHibAnIMaJJuobwAOagD0T/hDR+S6P9ofpfWlF8oKy/QmvhQm8ZL3FwLDrxFqSA2/TmHxawe3 dnPCEo/ZPH9VIQigowMIvYoaDKIArmiHe9WtfVL4meQjUB5Kts2wafs9i22m5oGmISFkgEE7iO0Ac F+Wn/LAyzmzRTBFrMGeCxfjPRb1vUaN92PqL+gJKfjKlWQeEKBta/n4llgABeNVdfyl47NSSNaW3p XGgDNv0w==; Received: from mail-japaneastazlp170100001.outbound.protection.outlook.com ([2a01:111:f403:c405::1] helo=TY3P286CU002.outbound.protection.outlook.com) by casper.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sljFR-00000000PnQ-02eI for linux-arm-kernel@lists.infradead.org; Wed, 04 Sep 2024 06:12:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=aCnnEVl39dXZ5uydjQo+EmdP12bBXHrV5IiRRvn2e5I07cIyllzSql1xpl5RC9WMNlBmATpEPMuU31eGEOuDICsvS7ipbB5ynymMLm1kIL5YnxSk1oFLYWee974JDBn1D5clnkQD2+L1HZV5HaqQUhGbjqdjzNqjK/C1+n3IZBvJ0Cl9ueIcsOuoLLpnqX0smxyevxT8EfBkBQqD9utxBBxWaxNWn5OF8DZFEYp0ypvDPJrFxIRrkqQ/5WuyEKRtf2Np7St6OzsqU+Jg1J3epJGZVn2xP+v1VBx8YPQeLbVNnwxjdD9W3kIiCL75olpGbFLZxl5Q2dIcHh3BVdnpfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZKmyRCnlh6pRp4xGuOPDxacwiqr8lRXCkyf1F2DnBB8=; b=tefnW731fFTcS2Q1KfNXArA4rvGKMq5j623oZc4k2kMrNDn1ci9kJdh6Fm0Xrkb6pYxTZEkwAPDR7UT1y5IY5weabCZxIWyMrdGYNFJWV+zx5/jfArZWvtpbp+54fAK47ADBnURaIU3OmsKTnk9zHcv1tKAle3mTg6OxToApUu3hxt0pyIbuLKtjobIJFRFtKO0zRuXBKftTf38tZJ8uho8kRZtWLRaT0TaFerVbbxZdOArEuNxGhzaVe6UbMh/9jWspUBo5yZDkZcck0RtluLd2BeH2ZhzsVu2sNBj9Hxn/W3btdImPEkqOn/1i26CWbtQswQgelN9746KkMnhuzQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=renesas.com; dmarc=pass action=none header.from=renesas.com; dkim=pass header.d=renesas.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZKmyRCnlh6pRp4xGuOPDxacwiqr8lRXCkyf1F2DnBB8=; b=aQOw8kwE8WBh0eE7THvfWrOW05DoRLUENf/I96L/47/Vitenmm1uVWqaGSJAlginNMO0boq0aF0NUP2kEu7IEpD/ERcvzflA0iwYiW+MsDtjm34Hfy8XL1mo3LxdE/AOJRuFxWJY+nCFPLjO2qHxNlLyJuYdig08gGjYPMGLpAw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) by OS3PR01MB7309.jpnprd01.prod.outlook.com (2603:1096:604:11e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.27; Wed, 4 Sep 2024 06:11:12 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%5]) with mapi id 15.20.7918.024; Wed, 4 Sep 2024 06:11:12 +0000 Message-ID: <87o7546j9c.wl-kuninori.morimoto.gx@renesas.com> To: Daniel Vetter , David Airlie , Helge Deller , Jaroslav Kysela , Laurent Pinchart , Liam Girdwood , Maarten Lankhorst , Mark Brown , Mauro Carvalho Chehab , Maxime Ripard , Michal Simek , Rob Herring , Saravana Kannan , Takashi Iwai , Thomas Zimmermann , Tomi Valkeinen , devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-fbdev@vger.kernel.org, linux-media@vger.kernel.org, linux-omap@vger.kernel.org, linux-sound@vger.kernel.org, Sakari Ailus In-Reply-To: <87r0a06ja1.wl-kuninori.morimoto.gx@renesas.com> References: <87r0a06ja1.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v5 2/9] of: property: add of_graph_get_next_port_endpoint() User-Agent: Wanderlust/2.15.9 Emacs/29.3 Mule/6.0 Date: Wed, 4 Sep 2024 06:11:12 +0000 X-ClientProxiedBy: TYCP286CA0138.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:31b::13) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OS3PR01MB7309:EE_ X-MS-Office365-Filtering-Correlation-Id: cb8e1da1-8b78-4522-702a-08dccca8606e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|52116014|7416014|921020|38350700014; X-Microsoft-Antispam-Message-Info: GEezVLHyz+4c+vUO3X5mdCy9XljdIy5lHkFXTE14sv6tZdvWIWUxAtcIsU2xApGkzX51qJ683f0UsTvAyA7FkcsMUgix7PNpPtgoovR7yJ+iCOIdJq4r4BJb1JKY2AK+tWVxxxHVJWBSpzjAxRjLsAY/t60lOSkh2ytF8WUtNkmYayJ6KgT2RPdADt7/m+b1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yZyqG5Qz/CpHmz2QBr9SwYZbaqP9u5AXIFQIui8a55Q+MSh4YY9ADGm+o/v8jqsRa7rmwPG7QNGUFQFelrvLrWVW0TSyNLM7eg0VN9RceqjXc0mnnRs99iPfCXQ5KuKJPmWdnrMQZ/XZogbLNFryrUmKF4vt76vzZo= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYCPR01MB10914.jpnprd01.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014)(52116014)(7416014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pThXNqTDew6UlygPzvfHUKA0seqyGbOP9eQ+OD1tzcLw+XxvNK45wxzrLLaFITNRqXpMPP0d/bXcGLFkrX8PMtAeOcpR7mm8jTlPub2Ek7hkClhd+AKES7fxUcyBsAkr8qJOwayDXPD82On4uaHOD0klTZIbeRP5N+ai/4i8TAbYmjh3Mc77CPE4HCg9mN7xDmgrMPo7LM85rZI/Idz6qQJfAu3Q+/t3UzkX4VqMSkcwP2QCFOQuy+BNbz8rQyJVHLcYhA5ZG4gxzb3TNUhV/QnvXFfrlhUMHC2ALGDTuEdNARJYw5XVr1+QNUk4+gBekyag6qFma+8qGbzkB7iJPaBj828V2J+61fbtd3uy0qviF4yKdHR/L/o67b8GU6e7TPW2zWgJ2XkqJnEy3Bpwi77Hr4T64IYbKBXy/49AgwmJZ087VXdvl1IHRbBjxS7hQZLoOHFsZyTB4QhTHH7XHm+UfGpCjobBeuuM06JwZIEr2ohJ974p/5QfPa2L2EHOIR69pgsZtpHEyQq5z1H1HOVf3Mh//zh24Wd0pi0aZ1szNomXKjvSMdw0gGvSMv/v2XfcIZI2qxB392vL0ypmNoMrTrmQV+BJMnsgS+tK/uhlgVmNbW2HZvc/WjlrUODVORdh+Cx2mNQ4RdPOz3BTcc1EALkyrW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thSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2024 06:11:12.4996 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: T+te+qicAnHF3/pbfOIwrg2+vITSIFb/BwVeeUutVnEvRwYNFoMJR1842Tk21tdQb4NeemISklgRS1mTOHbee4TcMdvfw24GKu1QjKAUCrVAwPfQhWGJoN7E+FM3G3GT X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS3PR01MB7309 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240904_071210_557166_BFE04D39 X-CRM114-Status: GOOD ( 20.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org We already have of_graph_get_next_endpoint(), but it is not intuitive to use in some case. (X) node { (Y) ports { (P0) port@0 { endpoint { remote-endpoint = ...; };}; (P10) port@1 { endpoint { remote-endpoint = ...; }; (P11) endpoint { remote-endpoint = ...; };}; (P2) port@2 { endpoint { remote-endpoint = ...; };}; }; }; For example, if I want to handle port@1's 2 endpoints (= P10, P11), I want to use like below P10 = of_graph_get_next_endpoint(port1, NULL); P11 = of_graph_get_next_endpoint(port1, P10); But 1st one will be error, because of_graph_get_next_endpoint() requested 1st parameter is "node" (X) or "ports" (Y), not but "port". Below works well, but it will get P0 P0 = of_graph_get_next_endpoint(node, NULL); P0 = of_graph_get_next_endpoint(ports, NULL); In other words, we can't handle P10/P11 directly via of_graph_get_next_endpoint(). There is another non intuitive behavior on of_graph_get_next_endpoint(). In case of if I could get P10 pointer for some way, and if I want to handle port@1 things by loop, I would like use it like below /* * "ep" is now P10, and handle port1 things here, * but we don't know how many endpoints port1 have. * * Because "ep" is non NULL now, we can use port1 * as of_graph_get_next_endpoint(port1, xxx) */ do { /* do something for port1 specific things here */ } while (ep = of_graph_get_next_endpoint(port1, ep)) But it also not worked as I expected. I expect it will be P10 -> P11 -> NULL, but it will be P10 -> P11 -> P2, because of_graph_get_next_endpoint() will fetch "endpoint" beyond the "port". It is not useful for generic driver. To handle endpoint more intuitive, create of_graph_get_next_port_endpoint() of_graph_get_next_port_endpoint(port1, NULL); // P10 of_graph_get_next_port_endpoint(port1, P10); // P11 of_graph_get_next_port_endpoint(port1, P11); // NULL Signed-off-by: Kuninori Morimoto --- drivers/of/property.c | 27 +++++++++++++++++++++++++++ include/linux/of_graph.h | 21 +++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/drivers/of/property.c b/drivers/of/property.c index ad834d8b8c1fe..def152c610499 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -716,6 +716,33 @@ struct device_node *of_graph_get_next_port(struct device_node *parent, } EXPORT_SYMBOL(of_graph_get_next_port); +/** + * of_graph_get_next_port_endpoint() - get next endpoint node in port. + * If it reached to end of the port, it will return NULL. + * @port: pointer to the target port node + * @prev: previous endpoint node, or NULL to get first + * + * Return: An 'endpoint' node pointer with refcount incremented. Refcount + * of the passed @prev node is decremented. + */ +struct device_node *of_graph_get_next_port_endpoint(const struct device_node *port, + struct device_node *prev) +{ + while (1) { + prev = of_get_next_child(port, prev); + if (!prev) + break; + if (WARN(!of_node_name_eq(prev, "endpoint"), + "non endpoint node is used (%pOF)", prev)) + continue; + + break; + } + + return prev; +} +EXPORT_SYMBOL(of_graph_get_next_port_endpoint); + /** * of_graph_get_next_endpoint() - get next endpoint node * @parent: pointer to the parent device node diff --git a/include/linux/of_graph.h b/include/linux/of_graph.h index 6fbd2c8696fd9..4a91de147604b 100644 --- a/include/linux/of_graph.h +++ b/include/linux/of_graph.h @@ -62,6 +62,18 @@ struct of_endpoint { for (struct device_node *child __free(device_node) = of_graph_get_next_port(parent, NULL);\ child != NULL; child = of_graph_get_next_port(parent, child)) +/** + * for_each_of_graph_port_endpoint - iterate over every endpoint in a port node + * @parent: parent port node + * @child: loop variable pointing to the current endpoint node + * + * When breaking out of the loop, and continue to use the @child, you need to + * use return_ptr(@child) or no_free_ptr(@child) not to call __free() for it. + */ +#define for_each_of_graph_port_endpoint(parent, child) \ + for (struct device_node *child __free(device_node) = of_graph_get_next_port_endpoint(parent, NULL);\ + child != NULL; child = of_graph_get_next_port_endpoint(parent, child)) + #ifdef CONFIG_OF bool of_graph_is_present(const struct device_node *node); int of_graph_parse_endpoint(const struct device_node *node, @@ -76,6 +88,8 @@ struct device_node *of_graph_get_next_ports(struct device_node *parent, struct device_node *ports); struct device_node *of_graph_get_next_port(struct device_node *parent, struct device_node *port); +struct device_node *of_graph_get_next_port_endpoint(const struct device_node *port, + struct device_node *prev); struct device_node *of_graph_get_endpoint_by_regs( const struct device_node *parent, int port_reg, int reg); struct device_node *of_graph_get_remote_endpoint( @@ -136,6 +150,13 @@ static inline struct device_node *of_graph_get_next_port( return NULL; } +static inline struct device_node *of_graph_get_next_port_endpoint( + const struct device_node *parent, + struct device_node *previous) +{ + return NULL; +} + static inline struct device_node *of_graph_get_endpoint_by_regs( const struct device_node *parent, int port_reg, int reg) { From patchwork Wed Sep 4 06:11:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13789825 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 CB973CA0ED3 for ; Wed, 4 Sep 2024 06:53:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Date: Content-Type:Subject:From:References:In-Reply-To:To:Message-ID:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=BvJInUuNEUe4jRcgs+FO2MhQ+2U/Xyt2piTiOMROnOo=; b=3UDsQJLIziImo9U6XDrDP9UAfU FRVXnItoJacigLPSFXZOsKIWNCJgVKW5B3eBDPr03FDzZTvl1f60Amz7dm2lV9BKjX30ozUInA2Ab y2XH2Q5uCdXfWCVNx1r77uHZ1oln3kjfPcJFx06TgaSeunz9LErcLRjZjTL0qjFQBA0GPq8vs1SpB mdcCK7RPVUoJ3HDMMOnUzIjT7LkRLc0+vzGjErEhB9SNaw8hsCaohg2iNiOeU3Dl63RTPnje6HM/q Rp2t6CZXwQEUjSqPTOxjx34RkaQImtlEqe6M1Rktg60dx5kN06n4tX37dx45NkgwgkSs8j8Eace4E QKVZYCAQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sljGw-00000002zrI-0lu9; Wed, 04 Sep 2024 06:13:42 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sljFE-00000002zg1-2uZI for linux-arm-kernel@bombadil.infradead.org; Wed, 04 Sep 2024 06:11:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=MIME-Version:Date:Content-Type:Subject :From:References:In-Reply-To:To:Message-ID:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description; bh=BvJInUuNEUe4jRcgs+FO2MhQ+2U/Xyt2piTiOMROnOo=; b=mVftJwNer/uXUqKDmtrHtV0QHJ vePg/5BnR3s/NK/KuymIxFD791N7MzPPjoQv1hBZUN+WLiqhGZ94ZS75BNmPsuMDNsrNAxLQoa7+U tMNPhrWeF3FEuJlqmrpyi5BIWz2XHejsElm85YdWEMZRLcOV9QE7F+7uNEYdnjE6AI0rHV60K8/zg ncRZ4hvhuaoooRNyHig2FoNyMyS2y20sBQPAn10QPyrKH5CxP/zsbXfnhtWnSDB/MKxvVguzWGOfy gn5EpW3fI4I8fDUGITWCaCArI1bdjkJA2MRm2U2wYRb/jmRuf0qFJMGUxcMSGxkdIqQ1scrO0zClB Ky1fi26w==; Received: from mail-japaneastazlp170110002.outbound.protection.outlook.com ([2a01:111:f403:c405::2] helo=TYVP286CU001.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sljF9-0000000081I-0Wgf for linux-arm-kernel@lists.infradead.org; Wed, 04 Sep 2024 06:11:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=jlWh0CEGRYXU6umbPkHmNvCYPQ6Irzx4jKeloVT3sAA0Ssrtm2KgHOCHaKFMU6JMw7I5hDZ+p1yBMejS+U+7BNu+j/25LGCvO/UWRef6QhKuUxQV6Rz9R3xf02ELDaeyc3BCB2NdORcOcezIczbGmjQERv4+kjMWZGK4TUudXVYvoutr2XGx8E2WwxJu82AHgCHByK8ohH35vc4K265okZF+IWHlS/XJpVPSIr3WuPimGcLlKs4WYiGLtNpRYk8gLOXEDUI7rFbfuhwIwh/bX+SyR9o5UGqKhweDVtZxePLeuAOwYvQNpX28yeB7BbKV/97uzbOgockWCXjAivCrDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BvJInUuNEUe4jRcgs+FO2MhQ+2U/Xyt2piTiOMROnOo=; b=R6eHhueTUJTdqEVPLMKKSr5N6rwB60LN/frqju+6XMwnGzWckve3XUvQNECVgF7us3vBNVPZJHUa7ElkQ8zRLwd4dZIiRoESkSDhGrul8WT7VsoMr8iZEeOoeBIyMLKp8TCtCkARKWBiVMDhcNJba6m9KIuq/HL2A6n1VUHEV3Kxmt8Ft/Zku/yJThr9kzDIom0nMYMsQHz2UyowwLVjNjyeeZhC6suTZGMx12ikfjPa7ga8uI0lp+yHla0m1c4mh/sJq37Mw7o/AOw9DTzMWeaOuyzYShd+U6XoPklVG71ivVmd7vSCRcUEyANTfhi42v5DuraM5MHmcsuINMoHQA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=renesas.com; dmarc=pass action=none header.from=renesas.com; dkim=pass header.d=renesas.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BvJInUuNEUe4jRcgs+FO2MhQ+2U/Xyt2piTiOMROnOo=; b=gLUhRErHmj9FvP58Ye4nQ1tjVguj8E2V6Nvzt2m6p3JZ/eDMIc1Pr+rmwvokHJzt/eyAdL9ZTCqZQwLyRMh/Cxvf1U7mFFZ62ggUJ8avbvVl5yIQXDFWxmj2fcF/vWGoIWKqnd7EgAryEoUG5uCN156r33cRamqwlJ94LKs1rcI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) by OS3PR01MB7309.jpnprd01.prod.outlook.com (2603:1096:604:11e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.27; Wed, 4 Sep 2024 06:11:17 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%5]) with mapi id 15.20.7918.024; Wed, 4 Sep 2024 06:11:17 +0000 Message-ID: <87msko6j96.wl-kuninori.morimoto.gx@renesas.com> To: Daniel Vetter , David Airlie , Helge Deller , Jaroslav Kysela , Laurent Pinchart , Liam Girdwood , Maarten Lankhorst , Mark Brown , Mauro Carvalho Chehab , Maxime Ripard , Michal Simek , Rob Herring , Saravana Kannan , Takashi Iwai , Thomas Zimmermann , Tomi Valkeinen , devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-fbdev@vger.kernel.org, linux-media@vger.kernel.org, linux-omap@vger.kernel.org, linux-sound@vger.kernel.org, Sakari Ailus In-Reply-To: <87r0a06ja1.wl-kuninori.morimoto.gx@renesas.com> References: <87r0a06ja1.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v5 3/9] ASoC: test-component: use new of_graph functions User-Agent: Wanderlust/2.15.9 Emacs/29.3 Mule/6.0 Date: Wed, 4 Sep 2024 06:11:17 +0000 X-ClientProxiedBy: TYCP286CA0257.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:455::8) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OS3PR01MB7309:EE_ X-MS-Office365-Filtering-Correlation-Id: 6e7479dd-352f-4b88-9244-08dccca86370 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|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qTletoVMIB0DHGIztlLyL+KtUwu68Um9D53AWCQVGx2vSEGW8tfaFtzrduwaj7U/nurFjbMtU98KqRqfdgo7kSPGhskyRW+LbIki4my6iu2q2WVZJ/3s7RqVCYgSnN/yOsDIAeHUQo7MA+5W8uGpAzD4H20lmCZ5VxbyeZy4Sr6KYQnXPXYVH2EIyZTnLNX/Jjqvw5rgR26oaJMXhvC4VP6Kbqte8XXHjPdjovbAYEUevhHMLDynXPdkvd5+dgIaRO6mw03lA7uVJpU2LFiZ6VRiH0egDBsewNr5u6L7ntfoacH2mEMoE8wfxnNBU0Ms7nZVXv5bBOWtfcBJJEAN0HhEwxDaJVXFYiab1QdVXzDOKcnUhJ4dUN7+xXokubLPRYXisCbQKZeo8= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYCPR01MB10914.jpnprd01.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014)(52116014)(7416014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: IUXzSEeITk2bX7iRCuRwGRbSQ9u5KNKgdluqbPFKBS1JOP+RErIQU27Arq/lRwuavDEjX72+cSMdpCGiGK4evWsYSowqnWM0CTGyTI+eIHGDd2nO4N0PfftgJtHpRA9u/Rd7OHPECcQOv2XQR3OrZicxhgIpB6p/g2jsVKZrTehmMjv1SHwNczqQ4dGobU0L+E+T0b6d+IN6v2V5vNz0MXvTXUhFTx1KDURkjsFbKbUEyjdQ0YPJ3ffyuRCWqGk9YIfw8vj20KgUySZlF8rlUz0NooUdnWsNKQdVhXDzYA0Ov1zHaAPIni4ObDrUjKvxWcF3r13YcThf05LUPq144PqnmwkbVa/3LXyf+N8u7nLLn1vQ40SBcrk2GLzXfmQSXmslqkV5tmK0mCbuhNTHqWwkdylCCl/oND28srfCAoSb1gsYhbyozu/cqHuV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kynNAbfOlRyk8AO6zubbuIl74PRvaU4lkPHa+DxzsQmc3kBL80OPz1tP5Go8YVr/u9p8NK2bwVYwIPdiGUmbTNNZDhAEITWHzsOFOg6/9rfQuDPTl/9LH0= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6e7479dd-352f-4b88-9244-08dccca86370 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2024 06:11:17.5680 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: eXUP/JRY5ZopT7SxclY6uC0BVjvNZspN1jOgMTpOzn4gMd1CdZohiqzkBbQrIrCigElYE7FGY7RS0jOR/JGWmMpSh5HopdMJtTBI/NJfEJOQKZAdEAjcqGTjSFlfeKs7 X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS3PR01MB7309 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240904_071151_461026_E88735CB X-CRM114-Status: GOOD ( 13.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Current test-component.c is using for_each_endpoint_of_node() for parsing "port", because there was no "port" base loop before. It has been assuming 1 port has 1 endpoint here. But now we can use "port" base loop (= for_each_of_graph_port()). Let's replace for_each function from "endpoint" base to "port" base. Signed-off-by: Kuninori Morimoto Acked-by: Mark Brown --- sound/soc/generic/test-component.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/soc/generic/test-component.c b/sound/soc/generic/test-component.c index df2487b700cca..521015d870854 100644 --- a/sound/soc/generic/test-component.c +++ b/sound/soc/generic/test-component.c @@ -521,7 +521,6 @@ static int test_driver_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct device_node *node = dev->of_node; - struct device_node *ep; const struct test_adata *adata = of_device_get_match_data(&pdev->dev); struct snd_soc_component_driver *cdriv; struct snd_soc_dai_driver *ddriv; @@ -591,7 +590,7 @@ static int test_driver_probe(struct platform_device *pdev) } i = 0; - for_each_endpoint_of_node(node, ep) { + for_each_of_graph_port(node, port) { snprintf(dname[i].name, TEST_NAME_LEN, "%s.%d", node->name, i); ddriv[i].name = dname[i].name; From patchwork Wed Sep 4 06:11:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13789824 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 960C9CA0ED3 for ; Wed, 4 Sep 2024 06:53:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Date: Content-Type:Subject:From:References:In-Reply-To:To:Message-ID:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=zSTy3OP81bOUWiIaiLJlHM2sjNqpFXTV3MWJ/ljI3OM=; b=pOPgGk51qOhET9kQ2t87ZN5jkx Hm9e+OSC6rlYIHZe+Cww+MYBC8FOMiCoIPtwODPvVzSWc8LJvXuWCnBUBc/unp94nDks06R9FBOtS dILRYQfyT49Tkznc35ORWpKkiPKBUf6nSuCdKRLyMNvGcAVoq1d+hqZXBJuCp1jinHuSRgUSL5SE8 fd7NmSf3Yqfmnb1UL2N0vonb8EC6T0/3bAznz2hOGvz42dha/RT/O4gyifkhP5JjzjMXu8VoqbgTS Dw+CdyiCZXRhDOIl+X1QwMHbKWQukfJ3eb+BpT8q2WPy1kzAStHnr6xX6FKkLT9xwjugoBIkrLwT9 RM/CrhWQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sljIh-0000000301s-0ExR; Wed, 04 Sep 2024 06:15:31 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sljFS-00000002zhv-3o1o for linux-arm-kernel@bombadil.infradead.org; Wed, 04 Sep 2024 06:12:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=MIME-Version:Date:Content-Type:Subject :From:References:In-Reply-To:To:Message-ID:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description; bh=zSTy3OP81bOUWiIaiLJlHM2sjNqpFXTV3MWJ/ljI3OM=; b=bqC44fJidNqfi7MIh46t+UtZB5 vDd9sybGiDwaPCeX7JpUCPy4zYGjlR0djjSzrVwg94qyl4mluX9J6u2BIpfjaW645oIXOmOQI5AkA 5+2XFyvq+20/P0kryUeUWtlcicPkfIntzgVb5Zgr7tGlnIw6PGp1PffHxNWsdIclKLNfW1HgAD2yI 8SWwbfrNvZj9M34fqIaK6JbRlDiwJz8EPOQsVhCzcYZCE8BZK9rREzBgEyXIXYrFwuuhDPwQ9Sxy2 Wo6eqX2YPitIPq7SNods7fysCBovPtGvzrQZ8Fq4DfJjaBVir7hFnRbxRxG7cjde3y2PbCoxQHbss oHJ+Q8Kg==; Received: from mail-japaneastazlp170110002.outbound.protection.outlook.com ([2a01:111:f403:c405::2] helo=TYVP286CU001.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sljFF-0000000081I-2F1O for linux-arm-kernel@lists.infradead.org; Wed, 04 Sep 2024 06:12:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fLVkT9KSaaE63nTlVLqEAoA7FMvf5DSZOR+uTRBjX+QV6CyeTFtXPUu0WY4Ju9eUWZsyrIgFzjR1kIwDjHyw+bihzFj/zCkWeaRPfE1EupZz8g51UZUKGZ/qKB8WgK6l47afvOr1uSeH1WwleYCglD0qYZjpy108tXSq+BH02lwZHnNo7z2cbosvJfUSo7RW3lnHfr1/eOaOa1/gAc9uXtG1O/1wJFNj6W0gpdC9l/4AQEjfuXTzlfTvBL7pjVS2plfy9jtXzkVbfP0x7iE19FhC5CGg/D1gDBRvwXEkgQR85a0K4xLVgwC2PBGKhQIhcGL2y+Qt15+rk8WUCqifhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zSTy3OP81bOUWiIaiLJlHM2sjNqpFXTV3MWJ/ljI3OM=; b=L4+bWvArbX1XSx1oBp+OEijQbEfk2yT06Iy+bfbMUq9nr9VlLV2VwYuOuN80UzY4iSjp/VGx3ZOM8a5ZkJ4HTI/THZ4DJ1ZdsZxdsv6yujSKdFoGRQ85PCdxsqJkoUd+GrcixTx5PTSPUpwbZ7aIRM3MK4bz14imWVd6VaV5QmX8iy05S7qnKV1uWUbyNygy1Emmr7KHC6BVOmJgqWEUWfwSHWFq/zmWPJH/iRrIjObxAeJUTGRijL0ODE1F90j10/vuRnLneBjPDF/FlILuJiEGuGizQJSr6o3acXy7oT84NYXUqVFZRtaXHuprRfFnzY4QLVjTOMZ0MADb0GRZcQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=renesas.com; dmarc=pass action=none header.from=renesas.com; dkim=pass header.d=renesas.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zSTy3OP81bOUWiIaiLJlHM2sjNqpFXTV3MWJ/ljI3OM=; b=ikdMW80PXzqZKHNSunUbDoTI+l597U34//NP1f4fNqdUn1aJshRSwIPuJuETwON2DlF4l8oz4QoCFDH/G7P/5zVqoJzZUpEmqOH3yHq0+TkblifP4jcsfzHZUW2uDbe8fJGwSJDbZp7hntU1iJmA4SOHWO2be977/S340JlN+Vo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) by OS3PR01MB7309.jpnprd01.prod.outlook.com (2603:1096:604:11e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.27; Wed, 4 Sep 2024 06:11:22 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%5]) with mapi id 15.20.7918.024; Wed, 4 Sep 2024 06:11:22 +0000 Message-ID: <87le086j91.wl-kuninori.morimoto.gx@renesas.com> To: Daniel Vetter , David Airlie , Helge Deller , Jaroslav Kysela , Laurent Pinchart , Liam Girdwood , Maarten Lankhorst , Mark Brown , Mauro Carvalho Chehab , Maxime Ripard , Michal Simek , Rob Herring , Saravana Kannan , Takashi Iwai , Thomas Zimmermann , Tomi Valkeinen , devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-fbdev@vger.kernel.org, linux-media@vger.kernel.org, linux-omap@vger.kernel.org, linux-sound@vger.kernel.org, Sakari Ailus In-Reply-To: <87r0a06ja1.wl-kuninori.morimoto.gx@renesas.com> References: <87r0a06ja1.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v5 4/9] ASoC: rcar_snd: use new of_graph functions User-Agent: Wanderlust/2.15.9 Emacs/29.3 Mule/6.0 Date: Wed, 4 Sep 2024 06:11:22 +0000 X-ClientProxiedBy: TY2PR06CA0008.apcprd06.prod.outlook.com (2603:1096:404:42::20) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OS3PR01MB7309:EE_ X-MS-Office365-Filtering-Correlation-Id: 530330e4-4eb4-4219-052f-08dccca86677 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|52116014|7416014|921020|38350700014; X-Microsoft-Antispam-Message-Info: pi41HNq0ioHBEUdMYKUQfHHe+nChDg/xdHOFroxDB46Xm6Ar5D0Ff657SL1E82AYumMUjNyeK60ZWvcMH6JT7p5xeGtl/UY2voOg9LzlZJV6w4vfXp4SpPlLI3XJCvh+5g9H0eR9WiDNp2XcYWqrBXe+UzqOw9JByb1xCXZ7l1WJCa96lI0MiiOcJiZhfKI9E1l8CAYxDL1RPl/Di/E4x8eipZkoUUNEFuheuTDkqzs2z9A39P9eWDL3Z3r1zeyRaEAFymlTC/9huSlXg9w62yraw3CwjFaar7N3XWq3TKSoszpjeq92fJkewaucajNQEZULfecZNgC0U/IGGNhFuAml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q4vRJeEfWfe/wS76WaqHmbG58= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYCPR01MB10914.jpnprd01.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014)(52116014)(7416014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UJsnxcIx8eBGeNOtLMfAwo/q6RxMjl37Z/pWWkGfZiwQN725W8h65UwQ+8+7ItGbpdIH3uYHjT+PswLgLjjLS/arSuyc2ENarRnGPl9sk6vnqST2UC4c17MvNfSiYEyqNdwxEf+lZBusk60JtZjzv141iviEqdg0+lvGKLMnxr+1qkY+sCcfQpQuScsjZQJ4p92f5YGB4lWYt+f5hSqfGN8o4h1ofgZh1AbnxWjlTuTFGECaIPDC/p28lH2zuf4s++GZDp46TXtiqPxS23L1idwfnzLDdwa6Dzrl6SEXceHQD+TlFMVOc6tNwWTTSHQxqi9cH+V/4nkCTqkSVvFd8Yxi4vO9ZGOcqY0xGUtDo1ZT4tQURtuMMyeIEm07AF0I+OwlCyq0jGWBnc6gpf3z6o1c2dfHRVPbMjWqlJd+ZnPXR/+Ij/aaD3oN6lFZ+PT4yHoPq9ybtAhvxus8k8PmIoAvCRhpC+iXMt+Tm5U35wHokQADt0gkW5F8BrWbX9eNKgdKjXa1zANE8T7aqoW+YK1jVEewVSKchCAZoja6o2J95G0eX2erYJt5oiOmjeT2vJh22MEeIGZmRDjM8q9jgHPOpjdzMLBRsD2kTHFL+u78h9ieHBDFWuiu294MKKuS1TYQCOam2F+c/56DYo7M53HpEJK3bAtEAFq+qeyRC/t74iskyhOGOT8exTYH3pyUxGIHrAHin0T+SafM3xEPUUkAxfVgHHA2fMKWFq6JkZRE562qpSe9yXffmkCZCvlmd/K+rObiTzf32o8UJU/U0AxuxOTcrhevSh150XT0bsfLNscBwZtuan9KEKvYKDBMBqroLVyqV+gGuFJTQtOOqqRLqjw0gSTM21ve20ljIYq2hxERg29qgOn6eSB6OVKAdJr5Iw7GAF3p5ww6r4ZWUQUbcvcyxCtczbN2AqJCfSYvIO+FRow2KsT25/Ut9Gp5PIFVvKpJITSrEOJv0NOSQN3Aoe+Otyek+PGEEIiYeOAQPETfifW6PxqWiJUMVcZ44v9H/fNPrLK+REW0z2WzmgMtC6xBCiTTEYWHtCG6ScWHUwYrhsrxzc+FDrNAWPu3ameXrXt3k/0yjMh9T6X8SQ+CWxYDE31WavUKrTHentp4SEQZ+um+pIU3pRvJOLncDeXvjgag1NAvcZRYsh2mjZkKOxN0pe8qSAjtDZTO+hPv21bvRvw2DAiRRX7Uohdt8IQGwTkc/onnOlGTb9sOrnZZ48b7pB+ewMsPtCQ2VkWlOuSHBnxGtquxjwQG2XG2RS3obaXDK856EZ//yEpyHfa/AKKbqhS/yKS1eUSvorXBDLO1xCvNnj6A9E6NJc5E1D5IBKc6GIXh+ukZMyDWk6nZxC/CLy/ALH5v8xAH7nasLGgIF/2pysamb4W+7iiY0sOl3noZEME4f/Vt/aj9sYcCQad3G693UigKxo8GqNtyN2EDFS8mp0vNpWvESRdMPOfPk0/YEm3lne0Jgm95hamwxPXmCsihDKI9Qlqs88P6lVJ/eo9FhrO6waJo/Q6eToFxDnzl84Hl1UEyL1eUSAv1csy9aLvDHFoX8QZGHTyA3LC+ZNMwgPYHkjY1n/NodH9mVNSASXU3PxHxpNJNjAE056h85zirq1PbZi5O70g= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 530330e4-4eb4-4219-052f-08dccca86677 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2024 06:11:22.6637 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: VljoUuItcn9EV0nVVS884AP9ZhYX1MLu2J+BqI0FwVBgSXjDC9Qpe+i9w3D6HHjeFg4FppdT+hKk+LqhAj5+dFJN0y2aAqryFddVTbQJTLlcxAMDF/BlbnX6IeczyrLJ X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS3PR01MB7309 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240904_071200_085972_19CB23E9 X-CRM114-Status: GOOD ( 14.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Now we can use new port related functions for port parsing. Use it. Signed-off-by: Kuninori Morimoto Acked-by: Mark Brown --- sound/soc/sh/rcar/core.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 15cb5e7008f9f..281936ece760b 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -1237,7 +1237,7 @@ static int rsnd_dai_of_node(struct rsnd_priv *priv, int *is_graph) { struct device *dev = rsnd_priv_to_dev(priv); struct device_node *np = dev->of_node; - struct device_node *ports, *node; + struct device_node *node; int nr = 0; int i = 0; @@ -1277,16 +1277,12 @@ static int rsnd_dai_of_node(struct rsnd_priv *priv, int *is_graph) /* * Audio-Graph-Card */ - for_each_child_of_node(np, ports) { - if (!of_node_name_eq(ports, "ports") && - !of_node_name_eq(ports, "port")) - continue; - priv->component_dais[i] = of_graph_get_endpoint_count(ports); + for_each_of_graph_ports(np, ports) { + priv->component_dais[i] = of_graph_get_port_count(ports); nr += priv->component_dais[i]; i++; if (i >= RSND_MAX_COMPONENT) { dev_info(dev, "reach to max component\n"); - of_node_put(ports); break; } } @@ -1486,14 +1482,10 @@ static int rsnd_dai_probe(struct rsnd_priv *priv) */ dai_i = 0; if (is_graph) { - struct device_node *ports; - struct device_node *dai_np; + for_each_of_graph_ports(np, ports) { + for_each_of_graph_port(ports, port) { + struct device_node *dai_np = of_graph_get_next_port_endpoint(port, NULL); - for_each_child_of_node(np, ports) { - if (!of_node_name_eq(ports, "ports") && - !of_node_name_eq(ports, "port")) - continue; - for_each_endpoint_of_node(ports, dai_np) { __rsnd_dai_probe(priv, dai_np, dai_np, 0, dai_i); if (!rsnd_is_gen1(priv) && !rsnd_is_gen2(priv)) { rdai = rsnd_rdai_get(priv, dai_i); @@ -1502,6 +1494,7 @@ static int rsnd_dai_probe(struct rsnd_priv *priv) rsnd_parse_connect_graph(priv, &rdai->capture, dai_np); } dai_i++; + of_node_put(dai_np); } } } else { From patchwork Wed Sep 4 06:11:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13789823 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 C8A60CA0ED3 for ; Wed, 4 Sep 2024 06:52:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Date: Content-Type:Subject:From:References:In-Reply-To:To:Message-ID:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=kkJ0ltVTSz196uhSee9Ig9BdLX9O4PwwW/k2og7b4lU=; b=u2skY68yr0lUsIEyMMqYB02Nat FhYnU6MwgHQ3i2ut7GhOsHXhEWs8qjVn/JR5In0hb/hj4veDtA8b06xNfh+omGc36sgfGL2joDHX4 TzZ1xQi9Rk6R32fyAy2zS2KAWkhSEOFf1F4lYJT0Bqv/xtouOAwAs27YrWn8h/11Qo2TdodLHb3B2 TCxBkIk1BtadOWCx/5a9JgjzvfefZmheptAwBZ2bWaAmxa3Bp5Uy0KhvCJKq4MXtykBx7UXuDnz1b yn6uvSQCGozt15CAB/lT1BX4K8WB50v8ybFq7sI7nObguDSUz9Q8dqXVjmeox1PDJpxl8qfxig7UX CaC7lYSA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sljJa-0000000308N-16b0; Wed, 04 Sep 2024 06:16:26 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sljFW-00000002ziO-2xc6 for linux-arm-kernel@bombadil.infradead.org; Wed, 04 Sep 2024 06:12:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=MIME-Version:Date:Content-Type:Subject :From:References:In-Reply-To:To:Message-ID:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description; bh=kkJ0ltVTSz196uhSee9Ig9BdLX9O4PwwW/k2og7b4lU=; b=jX+sgNHDuY1bYgvpKzf9BF+rr5 JL61KoIePXzzY3qgKwcg6JbZnSk8NhUAq2fZtmsBO/vQ7yB8+H6TxOWZ8nNHB9JJxLm0A6cbSmpe6 eQIGJL48AoaGORyq11xH6cor6c6eevhyO2CkQIGEPNR5ejTmLbSfRF61PtYvi8N426BpGbcLRnkPR JX0fdPRcmt3LmKGseWflJXZaB5uG6FDClrwy6MPCmt+FaQL6wEtlS2rnWfD/gL8nr5BcOl3JDIR8c oDtQy+ad2yQ9ZxUKNC7q+CR3HiLm9cQDrP/Hy39UbTpEtqBwV+Bbw7BulTPMvonoAMyIX15JhBvJI 2BEqVjJw==; Received: from mail-japaneastazlp170110002.outbound.protection.outlook.com ([2a01:111:f403:c405::2] helo=TYVP286CU001.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sljFS-0000000081I-1iub for linux-arm-kernel@lists.infradead.org; Wed, 04 Sep 2024 06:12:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=oqmj5F2F02DH4KB3rYFUgGv4LQiKnB5VNbSSrHLKK6ep8NzEFGhlKX6zcQ36YCDCtBI3ECfNR9vComL4AVrMpILkDQpU9jL03SPRHKNynjjNpv+qVb5v45C5b+qc5ZkDVFKEBWyHeOg0RkxfksPiR7GdmUBeFIXd7kndrimTpGTO46dWnuG26dt6R+uWL0KgwmT+ndFiwd5VHYDef3QOj+ywNx1eIWsNTEtnTJESkqBS2p0lDJMi62NyWWBnoLyD4py1hGyL8/vOGkss3mch3HHeJ5fB3DUneg87G3iQOcGa4h0nFzQ25dZK5Ehaw2RRxdyKhuIOa/tCZ/K667sljQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kkJ0ltVTSz196uhSee9Ig9BdLX9O4PwwW/k2og7b4lU=; b=qLbho+J/8b5DUWla+TzbNzesOYdFQ7Ksnw71DBDDqUGDkHY3HZJrRpa009CAbmzfMzWrCMajG606Bw36AfqkuBQWASE917/R9gwUirYb8pO9nsKtd2RLYlcAmSdXkhzMub/zqPvUzIjlSZ0ZDT6ilOcqN8Y6VoDl2AlEoF6GTkbJjzsfuE8+WdFleWY6One/IDmd6xYgfl+wE7x7/5NOFhOo2aRzg0tdnZ5Ncih06S32hcW1iG5qb46TjQ5b2cLJMbMIKtjRpXVvyXar4959GJ3bVr6l5nqlNfdhRqOBjHC+WI63NBoV5OBddhC8QpNMmoakw6AcPxP3A2pheVPmgA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=renesas.com; dmarc=pass action=none header.from=renesas.com; dkim=pass header.d=renesas.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kkJ0ltVTSz196uhSee9Ig9BdLX9O4PwwW/k2og7b4lU=; b=UfL1yunIWjvGDBYuz8YJSRcyGd8dBYGUuNoG35qC4xVo12v2OCWPRX4BHdZoX1Dlb1w1IFCpZ9SRxXqAoEoYw3MwtnYcPFBRtlY5B1TcccIHPfJw/WrHPCMe+UJmpcCCxoBc1MmQ5GU/hHhqrtMW48mGgpX2z6YjCM0BNzNDfik= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) by OS3PR01MB7309.jpnprd01.prod.outlook.com (2603:1096:604:11e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.27; Wed, 4 Sep 2024 06:11:29 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%5]) with mapi id 15.20.7918.024; Wed, 4 Sep 2024 06:11:29 +0000 Message-ID: <87jzfs6j8v.wl-kuninori.morimoto.gx@renesas.com> To: Daniel Vetter , David Airlie , Helge Deller , Jaroslav Kysela , Laurent Pinchart , Liam Girdwood , Maarten Lankhorst , Mark Brown , Mauro Carvalho Chehab , Maxime Ripard , Michal Simek , Rob Herring , Saravana Kannan , Takashi Iwai , Thomas Zimmermann , Tomi Valkeinen , devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-fbdev@vger.kernel.org, linux-media@vger.kernel.org, linux-omap@vger.kernel.org, linux-sound@vger.kernel.org, Sakari Ailus In-Reply-To: <87r0a06ja1.wl-kuninori.morimoto.gx@renesas.com> References: <87r0a06ja1.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v5 5/9] ASoC: audio-graph-card: use new of_graph functions User-Agent: Wanderlust/2.15.9 Emacs/29.3 Mule/6.0 Date: Wed, 4 Sep 2024 06:11:28 +0000 X-ClientProxiedBy: TYCP286CA0277.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:3c9::7) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OS3PR01MB7309:EE_ X-MS-Office365-Filtering-Correlation-Id: 625349f4-7eb5-40e2-c536-08dccca86a5f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|52116014|7416014|921020|38350700014; X-Microsoft-Antispam-Message-Info: i1+rq76tDMQT2IbP7XKNuxWAufYjWNQ56RLcz7b+YA9/Two2H05wBEXb0KIS6PXWS0iSJwdcYvA8GG5eVgyAbkki8coZ5HGM1bmwPLcQdYeIgC7PPUrDPqhqmQSXLlgUqs/Ni5wo7CxMOgFBYKNDypnXRfY8MXa2Y+r2tyQwHkFS2gwd00BbDTtHY3u86SFmMCBJe5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L0KcfEbsMa8btQ/GRfTz6kJHkvnySH4bEFj7s7jAFgFpowQ70EocmjNnyO6cA3zcL4qV0wvPeVA9Zhv5+4um0OHn3oIeSxfJue+uiO16ZLtOXe7Po0LD7kCPuZLYVLtmY2AI8QVsezQ6GyDokXcE8qEd9pyems7SpnY4c= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYCPR01MB10914.jpnprd01.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014)(52116014)(7416014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RumwmWphBVA3nd04yJabYWeQTq5ehcVlEfZBB2+iuPYAiX9iuLdNA5TlfMM11t1X1B5iPVv03j5fGLtlhd2DonU05BhztOcQaT/joR40AYFlZNDyhiORkM33uYlVV5ZN2x/+vqY4tmaK7Fz7wN64bXY/U3mnxO2VMM6UaOBZxkiEhSplzgrUm0FLIQJdQVzpePUh1yQ6ouJZlsM9hLGlR6rz3z3wEuk43Ckl32ciRymEOy15GeICjeKarNjz0jTSJ0CICxyO0HgLvcA5xWPi2V90S0RHTgSEhrhqzWs1u0ualMkpJFgljMKViljqGer+nWFWz9cE8JXE5G4KqY+OH3V3DrCkGRQ81ociqg39kj9GmOFMgQQpIW9piXaNgW/V3EXsdVtz7oc4UhKDLnD3YgZS0xwHech/bL1/zQo4lm4fhjvW6mLhA+BTp4uOO/Lbh1viHYEffLF4xQy3+q7V1t+CA57Iv1zii8eNZoOQT1aFvcrdYNohyPsc+G0KqIxkVXuZfU+A3Y4kZhJhn+orY+H+h80Ngy+TNHHnKPIGlYrE2UPPQMVZyANoa4oca5KlzgAqXXM8waB6LAmOvBFrxHfiq+pxIV+chNLLPDrqYCbFJKdlTfjDL5BwNTy08wFtmj14SvRk3WmwQSdhwYbIYEhjagqVYC+zpkv4BKgqB9PksisbVo+zTECd0WopTXoZdqdoibq8QTSdSRWrbIDs1sEL24UTzgtJUMI0r8fgK1FPOha3JSqvBr65ADYAWdNnqPvbBJq/MG3k0HBveAdo9Qixx/W9tmr9LHtYMx3Wbnzrw8E+UDDMGi4Y84qD+3gCe+WTpS4fJrwco2+o4sGayvuW+DEHk1EexY462/UP4XaIRWPQkvYtBPuf/Wz2IU3iCIGDT5gsEwmV9WC88NmnWZyoPZ5RExjkFV8PioGvi+neRSRRqEnGtuOqovXEqguqTUubAKr1LkpSj4JTD0WQ65RMcI/9lDREVViBedDnnfh3MCvi2mNvFlwmivgnL5GbLjfU+bhjptN4JaUNHGFnT88MeAkGH6i1z9qkG/pgJ5Pt0icAAbRvcOZ1vcNWikAGeTIPf0/mg1C/WkuKjzyobC07TqJjrJlADeuQ/z4qO/9uyq42wr6BtfDH7c7wx318iU23WOe1H0+WTxSm0p7NWJa6ptgGPTudMqrL01PRu1wLw/S1JQ86rEuevOg+WJovGEUod6wrkgRReL5S0B4r6401COE4/PKN/X/uHKV38zy0VWScAhMZexg6TZAJFw56uRSXu7fc5y+iihId1yTTeRGHV+KUb6EK+lSHNQ6Lmo8Sm8GwnhUGFc5vacO3ZtT5O/OIU0t5bbOlWFikgi7jm6zhM6Rsf5t+KOhOjpXzXknlUfGXcMejmau2Rs2UcVi9Ov7juB+W3wZYp4QouiF03jvwggreoRQpBKt0bccuNOSnDXjJNkXOH16yvuSAjBQrDEzSQND6bCDxbUQI0JVfyKcG5ixGJsBnh13djbZjyvDNRFgiYG3n/MVx0U2qqHIDM27aEYkIFJZvhFRjUQl+kFfmKUkq67xypIRVjz6FVLqEKfLo9/iE5uM1GFCCEoYfSSyYgwJ1gvuWIUYECbT6yljCF+mT9nbVWLhkNa4QKvA= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 625349f4-7eb5-40e2-c536-08dccca86a5f X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2024 06:11:29.2297 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: LlqHHXx3lXzIUJ9N6reTFt9tjeTV2aae23StDOX4cQ6WU77N3McY59yTRA2eisp+gP4t6QmhizsgbZT2qUxyc2Mi0sspkL7/wY5imkGPn3ljr4EAFoYv8jxYB5iob3MK X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS3PR01MB7309 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240904_071211_015239_30B4FA0B X-CRM114-Status: GOOD ( 14.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Now we can use new port related functions for port parsing. Use it. Signed-off-by: Kuninori Morimoto Acked-by: Mark Brown --- sound/soc/generic/audio-graph-card.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c index 1bdcfc4d4222e..e7fd3d70ce091 100644 --- a/sound/soc/generic/audio-graph-card.c +++ b/sound/soc/generic/audio-graph-card.c @@ -361,7 +361,6 @@ static int __graph_for_each_link(struct simple_util_priv *priv, struct device *dev = simple_priv_to_dev(priv); struct device_node *node = dev->of_node; struct device_node *cpu_port; - struct device_node *cpu_ep; struct device_node *codec_ep; struct device_node *codec_port; struct device_node *codec_port_old = NULL; @@ -371,13 +370,9 @@ static int __graph_for_each_link(struct simple_util_priv *priv, /* loop for all listed CPU port */ of_for_each_phandle(&it, rc, node, "dais", NULL, 0) { cpu_port = it.node; - cpu_ep = NULL; /* loop for all CPU endpoint */ - while (1) { - cpu_ep = of_get_next_child(cpu_port, cpu_ep); - if (!cpu_ep) - break; + for_each_of_graph_port_endpoint(cpu_port, cpu_ep) { /* get codec */ codec_ep = of_graph_get_remote_endpoint(cpu_ep); @@ -408,10 +403,8 @@ static int __graph_for_each_link(struct simple_util_priv *priv, of_node_put(codec_ep); of_node_put(codec_port); - if (ret < 0) { - of_node_put(cpu_ep); + if (ret < 0) return ret; - } codec_port_old = codec_port; } From patchwork Wed Sep 4 06:11:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13789897 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 34E36CD37B6 for ; Wed, 4 Sep 2024 07:30:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Date: Content-Type:Subject:From:References:In-Reply-To:To:Message-ID:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Hp4n9zD26Pjr3suPV3xZ/lwMpWsgUaeqizfk9RGR8Ns=; b=ir31ArVsOty7bK6vBPlHC7cv6P pieBdGYq2g37xVb7PAw0fzHR4LK4fJ2AtliLDN8ZkYs+RAgi0ci8bnVintfohAkhve5t1YPUYlPGR cWezoXNLb7FeDTPJst4E7fIIF8/rMwan3OzRBnVUy+Wk/b5j69K2I76i++jhj67tpJSMgqdcv5Pje 6NGSVMmlGwKErzJgIFNVrddJE/WhcAxa6XIFH75rakN6S+/zm3I11QkUAIvBWd6TXuehWYgNMB9tS /W3tXNXjFs9qTJ/iB8b8P65Qbe0Bs+cdEHEDc1bxilfJCIhMUQ/jP2VNgQIx/xlA5cOMbqu60wiM1 mCgXTbgg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1slkTX-00000003CAs-3Rrg; Wed, 04 Sep 2024 07:30:47 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sljFZ-00000002zic-0a8U for linux-arm-kernel@bombadil.infradead.org; Wed, 04 Sep 2024 06:12:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=MIME-Version:Date:Content-Type:Subject :From:References:In-Reply-To:To:Message-ID:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Hp4n9zD26Pjr3suPV3xZ/lwMpWsgUaeqizfk9RGR8Ns=; b=a83FJzPl4YuORw3MhA/F8Lh27s OV8Axx89EEV3LJ6txafS8KKWv94l/m/GHWJNq65srSv76FWe0xEpDHWw+7StFmq1UKDEwHFzz2f5F yvgakIxPKg+0O+8k8stwIRarpvsMD91SiVN24KRbqxtQ52WjVq5apg5i+cArNJnZ70zZWjdHxQQzS 3EO4mR0zvmr79MKWxsCTqkyFTqJpSWRHJoXGy2ac/weW9U2dI/VV8PH3QX46OfpWBNZ/vvtIdg7Pc JPp7felqyMdyN4KlvcBBCRDWyN6UX4U21HyqBLszdVhjZW6Q+XD8/f2K2TP4TJDR4sOGgkeWS7gna iSIk3cOQ==; Received: from mail-japaneastazlp170110002.outbound.protection.outlook.com ([2a01:111:f403:c405::2] helo=TYVP286CU001.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sljFV-0000000081I-3LZ1 for linux-arm-kernel@lists.infradead.org; Wed, 04 Sep 2024 06:12:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=y7H61GiuOP+Wd68XOH/XYbeWgz5Bm/QtKNalKJyNkVKzNrJtVgZR8kNrPoZCsZavoHrFpKCiAbz+bCNE2aic2n50Qbk/7AGR1itcFT/vT2WkaUISP67mhGS6rPN65ZV8VnjQJT/eL44SHaL/iak0VEm7e/yUEBP+KVlm1yyDrGW7pHl2kHzh9rT0UKz6LxxpGWVNkeEhzq67UUC0v4pAtFjK1J9XpTtfyBeTnsTbz+qg4CMmhFft1W5hjfAtgpEP71t1NdWgcgmIvaRslBCtE4w18fOyWa/AcVpA6a/1d70a6aygBTTYgU2zLL0BY7V15p4KFuCTpPDqErpQHBnCNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Hp4n9zD26Pjr3suPV3xZ/lwMpWsgUaeqizfk9RGR8Ns=; b=Y4OSKSWh0j6sApmdgoza3gtAkUY/NDHag5zvjCtrUl3PAAHfZ80H7kcEnvKvHB8CEkuOWDWQWcYXH3SQy13aC/n5QVasyJ83MVY7BCcIOe9jVGHXD7kUm+ZY2GS8Q4U0k12xmTOXbxOPyFcoThBCm6N0Afbl4HA0JuXh7paj5D9uJJCCG+DCA3EQB0hoGHK8vcI1N13jYHIbwytOFdIL3TuvWpd9KaeHE6pc+U2izALx8ewEfxPls6dUYbxPL3Z7wmKSdpbltqyk8p1IyCrjvpsdsBCiI2KvGbiG4sT3tuF7sb39pAwB66rxMg4J3jKkr+mdLF1IORxt3fZeXLBJLQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=renesas.com; dmarc=pass action=none header.from=renesas.com; dkim=pass header.d=renesas.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Hp4n9zD26Pjr3suPV3xZ/lwMpWsgUaeqizfk9RGR8Ns=; b=CHRcpr6sKZcptMUQX84B04W2sIw0C7n0+bbzI30qCWE4Pcy6/YdM0Nq3CNHVMrVWgFMKlbApFthlLYT8FtRFiTyqHTwrjWDyd0zJfRKflVKWPJEeg5aYROVH+afRAzavBKeqR6xC5zuJ0h5dnCS+efcttOAbGgBXBZRpOkIxfDU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) by OS3PR01MB7309.jpnprd01.prod.outlook.com (2603:1096:604:11e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.27; Wed, 4 Sep 2024 06:11:35 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%5]) with mapi id 15.20.7918.024; Wed, 4 Sep 2024 06:11:35 +0000 Message-ID: <87ikvc6j8p.wl-kuninori.morimoto.gx@renesas.com> To: Daniel Vetter , David Airlie , Helge Deller , Jaroslav Kysela , Laurent Pinchart , Liam Girdwood , Maarten Lankhorst , Mark Brown , Mauro Carvalho Chehab , Maxime Ripard , Michal Simek , Rob Herring , Saravana Kannan , Takashi Iwai , Thomas Zimmermann , Tomi Valkeinen , devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-fbdev@vger.kernel.org, linux-media@vger.kernel.org, linux-omap@vger.kernel.org, linux-sound@vger.kernel.org, Sakari Ailus In-Reply-To: <87r0a06ja1.wl-kuninori.morimoto.gx@renesas.com> References: <87r0a06ja1.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v5 6/9] ASoC: audio-graph-card2: use new of_graph functions User-Agent: Wanderlust/2.15.9 Emacs/29.3 Mule/6.0 Date: Wed, 4 Sep 2024 06:11:34 +0000 X-ClientProxiedBy: TYCP301CA0067.JPNP301.PROD.OUTLOOK.COM (2603:1096:405:7d::20) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OS3PR01MB7309:EE_ X-MS-Office365-Filtering-Correlation-Id: 3e4d3e85-ba83-4a01-f7e8-08dccca86e04 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|52116014|7416014|921020|38350700014; X-Microsoft-Antispam-Message-Info: o0q7Gv5Uz4CGyhRIkSwHx57Ix7/IEPLoDEf1h7oW9OuUpxttCHdwUYbWrrAqsLy0dtNvjTYW5+YCxiVts7Aqka+xCeoEAprqTR4e4DJ30ATcuAlahHeoZuvSThBTd3J1Zw+VNVYGS9ymIq6oVkXifoSOs4du5k7L/viG3HZrPsR8BJ7CjG27VqZ6Wc0NE4NRRsS6y5qcuK6Z0D6BdWJj1SzbLXqqNDx67APJ6rF4B/mzSw/f2e6667lEcEMlalHR4iWipLYjIdCYh7OP/nvnCIfTRiL/1WIIrfDTXKek5zykKuj7+Ai/L3mNcIASotLpJqfvovVD38xRDTfYapO73pmW7uDCn/0cP6Ee77zuRDIOoERqyL8cOniBNPmmusJhjtHfB+ODE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255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYCPR01MB10914.jpnprd01.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014)(52116014)(7416014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: W95IqluxMr9g0MgguYHUctcAmu6dJLoC+sQn7Y/HSthspwN/qPBZG3ptYjaLEPaDJ+Qg8rHX4ugh0vFAu3HuiNEvKX1rYM/zMInmbU6oe3u8icNK7dyRarSWQ1XZ2SVLf7kuVXMjI0Qy3PV21THexUJyd+5V+aazYDrfHrbahjgTgCb2zoFz7b4EKbXNBVKxru3pjbbVPYM/mdl1CT/YBuG+K+fIl90zzV41ZFpCEee7MIBZ5t2pshrx9bCZaBg9adE/2VIyLKtfU30CMH51qYYFQNKSWU03XXqdPq7TsJaFP3D/kJAB7fCtPjd9X2/VtwBhlWV01EZkKYWVsZut39LOZ8J7nVN+vLklPlNRKwU6IyoT/4xNLyqOa5rqMWc6vRRle/HX5euB9MapMA269sw3cv+iNWjvxbFnTye1jacY7SemjXb2pw5LdnP5b0XkcVVu4yz6YJrKP3CZb+18v3FUK17nQ3O/a7pn4yYgDOHJ2aiXYVtI5vbuMebdvVr8azmTcUHKBVcYbkO/114XYzvnEETn1S3eZczxyI+SrHNb8E3zNMvliC1CD6bIMyL89ew4cn+I7AiKhPDT2nO/gVGGsX61kd9BrVkzVKmD8Ogfx8S7yx33AE5+lLutbVHR2LhduGMM5ZKF8jyvRorPveZTDrmhbLliUuPphivl4x5dIwvb3QyckpO8UemxebC0ojXyXtyl2jwVgVdVQ9PeDFzkpoIaFfcvMA0aBicfkqahI89g7h2qxLa7yVO7RvCGVHZB9yDyXI2594WRbx2hWNCg5z1dlI4HSm9aSmQZpTmh2GNvIVPOg8BNfXk86hdRV48+wZWRZnBDSiGJuiVQ/q03juV52UVITXkiU4jbWjWkvbyBALjeyxuL+Z6+l2reyTYRjQq6eFCORCopYdSVPUNFCOO7QMbenXtPnL+BdnZP4/aOhTkSO4LCPH5bdIzBizBgXQwr/6+hNUVsBe9lmMy/jYOgvIiRpUb01p6BIPNwTnshETsN+JNELYtF+m2YmWkrPyqDqyP25Aj74/9HpRXjim0mXakyH+yqw54X80bbAXcF8skQ4FymUko5spkSJWfhWFmyy9szLQQifsB0hPV5CL0aN7O3u+ublWpVF2EupYBLNefuR8FbzS8qVSQQzS/NI+pQ62BCDa8GF7bvnyP6npP7cEUsAvULNwnio0IU3r+61YYJZX4cI5HsIWH43ZF2oJozbXe4OCQJpZhD4GFi/L0/Wzs8yuwdn0Ufy2qf85whpsD9K0ROal8K0XlEwXnJygID6L28pCNC1Y5ZEOmclSn87quxLHAqAPclZUk3ypJ36BuVENeWkVJGuxZDuAgfHCNQ034GuPZwAsXo7kqNFmZ/+GSx4m1KMtDukww9L8Ftn5oXSqgGaON2ypqnDGxuQqukj+u8U+c5gW2sMn0QKepCMYkaOL59uon+kbJu1ITRQ7spwyefnGnc6DXZ6s5wCUB/R/ClLZ7ZsT81h5ZyYMjgxRGjGDwhJhD6WucDU+7wFHTapX1I1Zm+65C7ebs7oa3/y88tAEB6IjOpFDaGL+iS3yDiG1v60211auROMl9ROrNn6WF6jBs/hVtc69HYKiyRIRRquPq+BxOrOtkhzLNWdRC/db5/2EWm6Gk= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3e4d3e85-ba83-4a01-f7e8-08dccca86e04 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2024 06:11:35.3097 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ZW/QMZl3fABB3uFx/AXmUBJJ3fmw2ViVbBeOcrueBIjrDBlfKqubt5JqyU9Glq1hL+9papZ1SOxoj7OCTid8dMU0tHaVb/ctAIC2Sp8VSMNDUWli/CI+hYWSRIhKSuSx X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS3PR01MB7309 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240904_071214_106203_0BED01B9 X-CRM114-Status: GOOD ( 18.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Now we can use new port related functions for port parsing. Use it. Signed-off-by: Kuninori Morimoto Acked-by: Mark Brown --- sound/soc/generic/audio-graph-card2.c | 113 +++++++++++--------------- 1 file changed, 48 insertions(+), 65 deletions(-) diff --git a/sound/soc/generic/audio-graph-card2.c b/sound/soc/generic/audio-graph-card2.c index 051adb5673972..90babed0f02e4 100644 --- a/sound/soc/generic/audio-graph-card2.c +++ b/sound/soc/generic/audio-graph-card2.c @@ -234,8 +234,6 @@ enum graph_type { #define GRAPH_NODENAME_DPCM "dpcm" #define GRAPH_NODENAME_C2C "codec2codec" -#define port_to_endpoint(port) of_get_child_by_name(port, "endpoint") - #define ep_to_port(ep) of_get_parent(ep) static struct device_node *port_to_ports(struct device_node *port) { @@ -351,14 +349,9 @@ static struct device_node *graph_get_next_multi_ep(struct device_node **port) * port@1 { rep1 }; * }; */ - do { - *port = of_get_next_child(ports, *port); - if (!*port) - break; - } while (!of_node_name_eq(*port, "port")); - + *port = of_graph_get_next_port(ports, *port); if (*port) { - ep = port_to_endpoint(*port); + ep = of_graph_get_next_port_endpoint(*port, NULL); rep = of_graph_get_remote_endpoint(ep); } @@ -530,67 +523,66 @@ static int graph_parse_node_multi_nm(struct snd_soc_dai_link *dai_link, * }; * }; */ - struct device_node *mcpu_ep = port_to_endpoint(mcpu_port); - struct device_node *mcpu_ep_n = mcpu_ep; - struct device_node *mcpu_port_top = of_get_next_child(port_to_ports(mcpu_port), NULL); - struct device_node *mcpu_ep_top = port_to_endpoint(mcpu_port_top); + struct device_node *mcpu_ep = of_graph_get_next_port_endpoint(mcpu_port, NULL); + struct device_node *mcpu_ports = port_to_ports(mcpu_port); + struct device_node *mcpu_port_top = of_graph_get_next_port(mcpu_ports, NULL); + struct device_node *mcpu_ep_top = of_graph_get_next_port_endpoint(mcpu_port_top, NULL); struct device_node *mcodec_ep_top = of_graph_get_remote_endpoint(mcpu_ep_top); struct device_node *mcodec_port_top = ep_to_port(mcodec_ep_top); struct device_node *mcodec_ports = port_to_ports(mcodec_port_top); int nm_max = max(dai_link->num_cpus, dai_link->num_codecs); - int ret = -EINVAL; + int ret = 0; - if (cpu_idx > dai_link->num_cpus) + if (cpu_idx > dai_link->num_cpus) { + ret = -EINVAL; goto mcpu_err; + } - while (1) { + for_each_of_graph_port_endpoint(mcpu_port, mcpu_ep_n) { struct device_node *mcodec_ep_n; - struct device_node *mcodec_port_i; struct device_node *mcodec_port; int codec_idx; - if (*nm_idx > nm_max) - break; + /* ignore 1st ep which is for element */ + if (mcpu_ep_n == mcpu_ep) + continue; - mcpu_ep_n = of_get_next_child(mcpu_port, mcpu_ep_n); - if (!mcpu_ep_n) { - ret = 0; + if (*nm_idx > nm_max) break; - } mcodec_ep_n = of_graph_get_remote_endpoint(mcpu_ep_n); mcodec_port = ep_to_port(mcodec_ep_n); - if (mcodec_ports != port_to_ports(mcodec_port)) + if (mcodec_ports != port_to_ports(mcodec_port)) { + ret = -EINVAL; goto mcpu_err; + } codec_idx = 0; - mcodec_port_i = of_get_next_child(mcodec_ports, NULL); - while (1) { - if (codec_idx > dai_link->num_codecs) - goto mcodec_err; - - mcodec_port_i = of_get_next_child(mcodec_ports, mcodec_port_i); + ret = -EINVAL; + for_each_of_graph_port(mcodec_ports, mcodec_port_i) { - if (!mcodec_port_i) - goto mcodec_err; + /* ignore 1st port which is for pair connection */ + if (mcodec_port_top == mcodec_port_i) + continue; - if (mcodec_port_i == mcodec_port) + if (codec_idx > dai_link->num_codecs) break; + if (mcodec_port_i == mcodec_port) { + dai_link->ch_maps[*nm_idx].cpu = cpu_idx; + dai_link->ch_maps[*nm_idx].codec = codec_idx; + + (*nm_idx)++; + ret = 0; + break; + } codec_idx++; } - - dai_link->ch_maps[*nm_idx].cpu = cpu_idx; - dai_link->ch_maps[*nm_idx].codec = codec_idx; - - (*nm_idx)++; - - of_node_put(mcodec_port_i); -mcodec_err: of_node_put(mcodec_port); - of_node_put(mcpu_ep_n); of_node_put(mcodec_ep_n); + if (ret < 0) + break; } mcpu_err: of_node_put(mcpu_ep); @@ -674,7 +666,7 @@ static int graph_parse_node_single(struct simple_util_priv *priv, struct device_node *port, struct link_info *li, int is_cpu) { - struct device_node *ep = port_to_endpoint(port); + struct device_node *ep = of_graph_get_next_port_endpoint(port, NULL); int ret = __graph_parse_node(priv, gtype, ep, li, is_cpu, 0); of_node_put(ep); @@ -769,7 +761,7 @@ static void graph_link_init(struct simple_util_priv *priv, of_node_put(port_cpu); port_cpu = ep_to_port(ep_cpu); } else { - ep_cpu = port_to_endpoint(port_cpu); + ep_cpu = of_graph_get_next_port_endpoint(port_cpu, NULL); } ports_cpu = port_to_ports(port_cpu); @@ -779,7 +771,7 @@ static void graph_link_init(struct simple_util_priv *priv, of_node_put(port_cpu); port_codec = ep_to_port(ep_codec); } else { - ep_codec = port_to_endpoint(port_codec); + ep_codec = of_graph_get_next_port_endpoint(port_codec, NULL); } ports_codec = port_to_ports(port_codec); @@ -850,7 +842,7 @@ int audio_graph2_link_normal(struct simple_util_priv *priv, struct link_info *li) { struct device_node *cpu_port = lnk; - struct device_node *cpu_ep = port_to_endpoint(cpu_port); + struct device_node *cpu_ep = of_graph_get_next_port_endpoint(cpu_port, NULL); struct device_node *codec_port = of_graph_get_remote_port(cpu_ep); int ret; @@ -883,7 +875,7 @@ int audio_graph2_link_dpcm(struct simple_util_priv *priv, struct device_node *lnk, struct link_info *li) { - struct device_node *ep = port_to_endpoint(lnk); + struct device_node *ep = of_graph_get_next_port_endpoint(lnk, NULL); struct device_node *rep = of_graph_get_remote_endpoint(ep); struct device_node *cpu_port = NULL; struct device_node *codec_port = NULL; @@ -1007,7 +999,7 @@ int audio_graph2_link_c2c(struct simple_util_priv *priv, of_node_get(lnk); port0 = lnk; ports = port_to_ports(port0); - port1 = of_get_next_child(ports, lnk); + port1 = of_graph_get_next_port(ports, port0); /* * Card2 can use original Codec2Codec settings if DT has. @@ -1037,8 +1029,8 @@ int audio_graph2_link_c2c(struct simple_util_priv *priv, dai_link->num_c2c_params = 1; } - ep0 = port_to_endpoint(port0); - ep1 = port_to_endpoint(port1); + ep0 = of_graph_get_next_port_endpoint(port0, NULL); + ep1 = of_graph_get_next_port_endpoint(port1, NULL); codec0_port = of_graph_get_remote_port(ep0); codec1_port = of_graph_get_remote_port(ep1); @@ -1139,21 +1131,12 @@ static int graph_counter(struct device_node *lnk) */ if (graph_lnk_is_multi(lnk)) { struct device_node *ports = port_to_ports(lnk); - struct device_node *port = NULL; - int cnt = 0; /* * CPU/Codec = N:M case has many endpoints. * We can't use of_graph_get_endpoint_count() here */ - while(1) { - port = of_get_next_child(ports, port); - if (!port) - break; - cnt++; - } - - return cnt - 1; + return of_graph_get_port_count(ports) - 1; } /* * Single CPU / Codec @@ -1167,7 +1150,7 @@ static int graph_count_normal(struct simple_util_priv *priv, struct link_info *li) { struct device_node *cpu_port = lnk; - struct device_node *cpu_ep = port_to_endpoint(cpu_port); + struct device_node *cpu_ep = of_graph_get_next_port_endpoint(cpu_port, NULL); struct device_node *codec_port = of_graph_get_remote_port(cpu_ep); /* @@ -1195,7 +1178,7 @@ static int graph_count_dpcm(struct simple_util_priv *priv, struct device_node *lnk, struct link_info *li) { - struct device_node *ep = port_to_endpoint(lnk); + struct device_node *ep = of_graph_get_next_port_endpoint(lnk, NULL); struct device_node *rport = of_graph_get_remote_port(ep); /* @@ -1237,9 +1220,9 @@ static int graph_count_c2c(struct simple_util_priv *priv, { struct device_node *ports = port_to_ports(lnk); struct device_node *port0 = lnk; - struct device_node *port1 = of_get_next_child(ports, of_node_get(lnk)); - struct device_node *ep0 = port_to_endpoint(port0); - struct device_node *ep1 = port_to_endpoint(port1); + struct device_node *port1 = of_graph_get_next_port(ports, of_node_get(port0)); + struct device_node *ep0 = of_graph_get_next_port_endpoint(port0, NULL); + struct device_node *ep1 = of_graph_get_next_port_endpoint(port1, NULL); struct device_node *codec0 = of_graph_get_remote_port(ep0); struct device_node *codec1 = of_graph_get_remote_port(ep1); From patchwork Wed Sep 4 06:11:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13789896 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 F1E6FCD3431 for ; Wed, 4 Sep 2024 07:30:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Date: Content-Type:Subject:From:References:In-Reply-To:To:Message-ID:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=1UeslM4FQH6N1O2L6SqbvVyNONUE0o4X2TQYeq8tCfA=; b=HmP4pbGBCK+EVn2F5XOBEhygqg hWgtTBXfqqg2i7P12hndEfHjlL6t96hsU2cSaSzU6vRNLx8Dmkx+yBq0bSG1xKTpBa8mDFCSSFkNa Z56abeE45dbch4XFJiPt4z3QB7SAZgVT+ZCW6vuZWEBgZm+r34JyLwFXk2fWVbvDY6gRcLPgjN/vG 5qAM+GDC7B6DL7J9FFsU1jXDLX5Q8URRrR4Cc32mRjTZMinyWWf6mlPO6wPZLE6O7k3M8/1AkBT0h iOJrvR1oZS0a400ukGRG2UgkxDVQ4qpne0v6LLxatsYPHEmYBTjKMxnilStnvP144tXM1kEQB3VJY VeftMSPg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1slkTY-00000003CBl-2Zzf; Wed, 04 Sep 2024 07:30:48 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sljFa-00000002zix-20Xe for linux-arm-kernel@bombadil.infradead.org; Wed, 04 Sep 2024 06:12:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=MIME-Version:Date:Content-Type:Subject: From:References:In-Reply-To:To:Message-ID:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description; bh=1UeslM4FQH6N1O2L6SqbvVyNONUE0o4X2TQYeq8tCfA=; b=TarzdFBMli0AJb4EWDNBRVPiPh pay0uDMOFaQ2HuMX0lUtdqQaJ7H+wc8+Dj09r+lIB5jkFxLKubZY14NMJTSa/+WWgSA12W54mw+Z3 g17S6SP8Yj/DG5Uf2iPpbWbN8T+dFqyNJZ0akERWCi6T2+gbHl0zcCR9kCa9+/u/iTM0eetlqYdtb 5pc7zKcuYc1RPQvUQDnBCzUhXAGn1rToIaX+3FSyo6TRDffsq127991yOI+6ukv+AH+EoFHicIUb7 EqyAkralthsb7bqAitonmHWv3zgR/hRE1HORJVdcxujqcEdSI+Ti525cnuwHAHlvme5MmnngKl04K AOdXeD+g==; Received: from mail-japaneastazlp170100001.outbound.protection.outlook.com ([2a01:111:f403:c405::1] helo=TY3P286CU002.outbound.protection.outlook.com) by casper.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sljFW-00000000PnQ-1PKo for linux-arm-kernel@lists.infradead.org; Wed, 04 Sep 2024 06:12:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=COOvPaZj63/L+oFB9IIm+L0l0uIb2sm9Wwoi96f5d9OTjapnTtZ8Z7zaryPhGUfYgtRuDJ9JIRrLLNwkuM/pXle8wpDBfS8TB3Mfk7gour9c25pPeXttAq8xZ0J+jgbQjdQWVy0rz84rDqi22CpTQzVBKhcRnZ9w0WFsZo5nnZX+OkknBNCM7La79xX1VzkCEACCkj+9SMVbRHyNyKCJR7FKeVQX6Ki0rIRU/Adfvhi5dw1QzgP5b/8vYA82wC03SY2rznkvV/q/z8EzKnI0Quv8X15uew8O5ItwzPHQLV8IhlZNMnk4OPHk3UOEWWabGlZkaVK46MxifqttggrzQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1UeslM4FQH6N1O2L6SqbvVyNONUE0o4X2TQYeq8tCfA=; b=QEy3pLrC5MwzdAgjOG7UKjmDrD4haZtJYEgNl1zvOFDQqQeRjdQWQHyfVNoCDsUDq+ko6X7ZzzR9ToLY30xrcTh0dMLfgx5xTfoH4/Rqagbp9CZsobh/np4NP12iK05YXG1gVXq05GdF4g73mUbcaL5LQrFRUtqSvLWTfoKzfREzFtO27mVjuCQlq3I8cQr/ENb4Jh3AiuWv3J8qFT2nF4hRjkiW+c/H3RlRZii9vjCD3731o+uwnXoojEJ1a3BWyCdEEBd+ckd5gngKNwaEiIAerxM2OFrCU3oKzki4oLFNm18irK/lCgr/eNUCiwXV4+6BbhAvHKXn+IS46rln0A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=renesas.com; dmarc=pass action=none header.from=renesas.com; dkim=pass header.d=renesas.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1UeslM4FQH6N1O2L6SqbvVyNONUE0o4X2TQYeq8tCfA=; b=NQmOPv8s9IRfqgwG99WcgnnEFgsCFBx857iIMUNytImWGxafUaNr9aaWsqS+14gJqfVTPPZjyFxenaAzXFhRskPckKJ+6hiS4RXryiai44Lb9L2RphZP5WAoGUlfbP91xXAwDCqwxqBKJ7KFMrzigTqtrkwKQw4emiKo2/D7raY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) by OS3PR01MB7309.jpnprd01.prod.outlook.com (2603:1096:604:11e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.27; Wed, 4 Sep 2024 06:11:40 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%5]) with mapi id 15.20.7918.024; Wed, 4 Sep 2024 06:11:40 +0000 Message-ID: <87h6aw6j8j.wl-kuninori.morimoto.gx@renesas.com> To: Daniel Vetter , David Airlie , Helge Deller , Jaroslav Kysela , Laurent Pinchart , Liam Girdwood , Maarten Lankhorst , Mark Brown , Mauro Carvalho Chehab , Maxime Ripard , Michal Simek , Rob Herring , Saravana Kannan , Takashi Iwai , Thomas Zimmermann , Tomi Valkeinen , devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-fbdev@vger.kernel.org, linux-media@vger.kernel.org, linux-omap@vger.kernel.org, linux-sound@vger.kernel.org, Sakari Ailus In-Reply-To: <87r0a06ja1.wl-kuninori.morimoto.gx@renesas.com> References: <87r0a06ja1.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v5 7/9] gpu: drm: omapdrm: use new of_graph functions User-Agent: Wanderlust/2.15.9 Emacs/29.3 Mule/6.0 Date: Wed, 4 Sep 2024 06:11:40 +0000 X-ClientProxiedBy: TYCP286CA0361.JPNP286.PROD.OUTLOOK.COM (2603:1096:405:79::17) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OS3PR01MB7309:EE_ X-MS-Office365-Filtering-Correlation-Id: d253dfe5-7d3d-4296-36bf-08dccca87147 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|52116014|7416014|921020|38350700014; X-Microsoft-Antispam-Message-Info: 6G7SYOzV1HjALQ3d0vfdcJLhvV8IZyZVAi9kuZaArpDb/RSIAMHG7/A2g5jQtlzkTmI2Yl5+KjsIN3ltZdy7e/NaNwPt9SSnllcVh4jbTfpqMix6/YPu+S2L3OknzYv1s52K6SWe/aOzDYCJu2QscE8oMMMwYmdAoFv+5/E9OAWtbefzkhDLWo0W7QOMbSW6CgDveVO5JVAorT4PBIBd/mFohqW9zIqLsG0VFiwaRDUvpNSJIoGdpFjelGh9bkXZS/8rkxN1WqTfc0krRtTJTcaxqV0bz2kCpkkpkfYk+TYeaI3zQI9tNmq6/9LVR/XGlHTq6c4NkT0Tfs2KdZaNbTwjY2v7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J79K/wiC9rHchzTO2W9DW8Oil7Dg= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYCPR01MB10914.jpnprd01.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014)(52116014)(7416014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: S9tdBJEcJvsPXb+NvZwVYH+GCulIUXDKXMJaVDvisEYo6Ow5+jCWfIIq3vrIY0IMNLa7+zCYw6Gl3PZ3HulUuXxPvW6HjfWjbAuvADoitnLr6tC8hcp1fAvANNgkM686wAETkMOlEvm4HgZpf4isKi3Sp7Oi2WsGQ4OB9ecZK0mKWlydmvXabOfDv6B/H1gVoGVuoLA4m331zf2LSIHCgr6InZLwBpxNe0hWfxPwJyNU2M6lLE8YbHyeiozFlsmoJUhCHwP7oKAsSMjTPZWenN5HzEj+b0pwatAxyIEVGUhCaIqUdXD1HEgp68olAoYTsxdNCNoVekWawUhKf1DmmIFvozDoUepjUPMQoQvTnUlVr5S2DfsYHfSp9uftvPGVCdp/nWgxlksFWXoj4/hWrU9DmViY2fDTHZSZSa5iab4m8MkXj/jfO4pNVgHD1yudyqog0Ceb2eNIMGQJSNenTysm6obmPRhNufHpDrUhmshVK53jhVi8Wv3CRdFrWOLTgYzV9XqdDDXH6IENYTnkpmSw2vLMZPSM3wTKpFHIzQYMot+QVttmpkL9EFMPDHE/Av7xy09qz8zxT6KWvdEBRwXXi9SqBzp3gjKgsxFB8irqi/DL0wOT6l7wzjyFTgsDF+7YTGbWsJHyrqI90w9F1k4S5htlNPAhdc05z/cXv4A+DBWypHy1kufkq5xmZiIZI9Hr06ieeptG1vMEo+z9tl9pQrbTD5HMGODOJAyMwckbBovLBcZ27p5Xjp6eiFJv/Hv7K5Wa8aMbZJGdLatD3XqhcgR2PRHQN9OWY78zGuh1o9f24g4xwSo5kWzcM6erCVxMMu4k0lX9FcGZF81PCjvX9EZ2g3uyGL8ecpbFJzbHnJhAS428Y3ff/isY2UQIMmIiDDaVId/bzSemKc1TIvWtPzZKWD1KpLqHSeqjp5s6AIh5jCoviQeoTjvhsR0j1u49IdSAX0+lsbMZjquoSK+xd6sAidju/tHWwwf8PZ4BxqrrIfdk8jHiRZQzSNqcw0eWTHzsyRuizkpBynIShDJVu2p2C1h7gQ4U7m7x+lvwnSwmIZtx2aqNoHkK0zNu39slH4XApmGWbo0zKKJCg/Gx6DemZ2gbzNvtvVBs/W7vjtVmPChdg+30zzbB4BbzuHMTUYK7ZzkjT0TKdc4ci2LgA/7PXO2gSBOUGVXSHDqfU6taJ06T8IrRNWnkTOI+hVW7N+9QrGm7bcJ2z1AbDmWcNOxFgfEXDM+z9NsA9dA/pBhCBmUmglqAaVCafgt3TlHtH7nN+vXoxe5aTaKKswh39P//RdrH+TBG5xKd/t17DulSKYHzYrZ5Oun5A2F7gPk6lM0pWKLfuoGCr4Vuy+WRUzGlbImZVncyi+BMlcLDCU4EpfOIi8kNsINdyVktZuNEQUu63ufG3szR+JOwvatOCSWmNdtYcbYWvVl+/Yay7r6kBZH0pTfIVkw3vJZ6OpUskfURuycTj49xE6VoMdgJiVK5au1weRsN+zr3lVYebM4ab5Ka9h7NPJD2sL017FwOCsEQVxYube5f2EJ/D820qXkbSZhUGQbzCmANFKA/4cmQ2AMEhMAY+4ecO0Ro2LTyBRhW8F/sWoKYNl3GRLLYyRXS9eLRZH3lgoysEM8= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: d253dfe5-7d3d-4296-36bf-08dccca87147 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2024 06:11:40.7814 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: C+DqU+/UL3IwtHwREdW0URNBD+/7W8PPXi4lMO/17AddVsUxDXAHrhU8c5rVezmOu4nLaA8cQMh/pJQoGk9i0Ou+0JRRgCvWuv5a6Y7qA7PdgFh9mnVef04UxXTTGO7T X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS3PR01MB7309 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240904_071215_644525_593DE174 X-CRM114-Status: GOOD ( 13.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Now we can use new port related functions for port parsing. Use it. Signed-off-by: Kuninori Morimoto Reviewed-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/dss/dpi.c | 3 ++- drivers/gpu/drm/omapdrm/dss/sdi.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/dpi.c b/drivers/gpu/drm/omapdrm/dss/dpi.c index 030f997eccd00..b17e77f700ddd 100644 --- a/drivers/gpu/drm/omapdrm/dss/dpi.c +++ b/drivers/gpu/drm/omapdrm/dss/dpi.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -709,7 +710,7 @@ int dpi_init_port(struct dss_device *dss, struct platform_device *pdev, if (!dpi) return -ENOMEM; - ep = of_get_next_child(port, NULL); + ep = of_graph_get_next_port_endpoint(port, NULL); if (!ep) return 0; diff --git a/drivers/gpu/drm/omapdrm/dss/sdi.c b/drivers/gpu/drm/omapdrm/dss/sdi.c index 91eaae3b94812..f9ae358e8e521 100644 --- a/drivers/gpu/drm/omapdrm/dss/sdi.c +++ b/drivers/gpu/drm/omapdrm/dss/sdi.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -346,7 +347,7 @@ int sdi_init_port(struct dss_device *dss, struct platform_device *pdev, if (!sdi) return -ENOMEM; - ep = of_get_next_child(port, NULL); + ep = of_graph_get_next_port_endpoint(port, NULL); if (!ep) { r = 0; goto err_free; From patchwork Wed Sep 4 06:11:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13789827 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 91873CA0ED3 for ; Wed, 4 Sep 2024 06:53:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Date: Content-Type:Subject:From:References:In-Reply-To:To:Message-ID:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=X+8dq8hvf2u19+2peNsA8CdWmlRAVdaYHFoKOHHojqc=; b=BL3/wEdtsqKstVpx4VnFNylAgO Vs9Bt31MZO3G1Xgcrq6/jPvUKwWc9GmDTEXCeME+iKopYOrUhraMW4LL75mdFu6R/VHFfRxQUooq2 loFNDYaT7k7we1yXQcV/KjAg7qZXBcE8SErKIlnKAHmbMguUTkZn/t1zN8l9AlQhoQM8gc4Iv95g4 CpODeAph9I3kusxbVrNYVo65o5KeYQ3fLhtMVsZtLaVh9GhBUTMVMmAZDxlfKn88H4eMEGNjMw9IE 49Nr7LjfGTAMW/gD43HvwV4M9h6N+j5UEUV0bzT48i6yyxzlPWakh4HVhFxF4utW2Ttru7EdiX1Sj lOIDXMwQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sljN5-000000030Rq-3I3Q; Wed, 04 Sep 2024 06:20:03 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sljFc-00000002zjC-2G1Z for linux-arm-kernel@bombadil.infradead.org; Wed, 04 Sep 2024 06:12:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=MIME-Version:Date:Content-Type:Subject :From:References:In-Reply-To:To:Message-ID:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description; bh=X+8dq8hvf2u19+2peNsA8CdWmlRAVdaYHFoKOHHojqc=; b=k5DDYAQCMx5h9IAduTn7LJcAms e3EtThZZ39AH6eyHV10eJIvoHLESwMyiG6xA3OC0wuXKUdbFXYfMQQ5A3iKiB4dhXvuuZvhpdL5yP l/39mjYgRp3iBAhfd1+wdK6Ty10OMwkF5vCI3osp+KfD2zAYpfKMKXVEcD5NxCQXx/+8Oaalm5lRf BYwcIhi8+rZS2cW+uQg1iG++5+gdmLDxDGwk5gXIi5UVTpSBfVYREUSQXjFjHB3QAdRtdFwxpXkoS ufUrbE/pT7yaVQ9h0Bx2A/jdXIyqbM3AXaIkO3msHO3Ekri7PePtLMt4R71sy6006a76sOW9soM3u X7NR0HRg==; Received: from mail-japaneastazlp170110002.outbound.protection.outlook.com ([2a01:111:f403:c405::2] helo=TYVP286CU001.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sljFY-0000000081I-2Tj1 for linux-arm-kernel@lists.infradead.org; Wed, 04 Sep 2024 06:12:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Go0e5Uu++1VIuLPIGHFzAfxZcgr43tqrWdTEitSRBEfvLHc2NzM51WzCimxmen/xQRXUoxepCUAigy2urCvHrK//U4n6fe4j2JXvLMDWnA8OYo1M2v0eei+Q4sh/Tz79WrtD1LuUKzXIAevv48o0/lveIZnort1ZYNwVvfN32lJUzGh7V3dnWt90Pym2ga4A7air4VDhLguegEGJYHlviyFDiRJy/W/WX94dR7NJI+7sXP9T2QiSMvtmY11phy8BHhB1P/Y8Y9jW0i4k/jIb596F/jB2K18dm0aUzkeX9LV26iUSoqYnMuoG+qJkUjkgn/YhUnJsz0zSy2kKjiXafg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=X+8dq8hvf2u19+2peNsA8CdWmlRAVdaYHFoKOHHojqc=; b=kI4uPJn7z9MCqiYnDF7bcI56PIVRIBJaNdUz8typCgicsr6Upfl4b68nA0zuN/w3IUG/uSPTqjmLISXhu6T2lV1FTaXUUAsAoVfOGroNfVwo6A/4hZRO6/jiQQFN3IO33nk2et8sNYqoetszoFj31AnB5nKEL7FbBu4fPNExelbTaqgvCP2eFdbYmhtWLsY/Y0lt9ijB+VAizX6buClKNxFiNBBm2Ci5PO6e8uXRX0abJh9dAPQtsGoMm2pT/reAZZGqlAdDoDJfjCzr0bdyuPt+TVH1lgugCsolk8JmUfpTzTmU5bV5TTQj7cfd3BItKsAqLhg5d++lqeeHvP4/Sw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=renesas.com; dmarc=pass action=none header.from=renesas.com; dkim=pass header.d=renesas.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=X+8dq8hvf2u19+2peNsA8CdWmlRAVdaYHFoKOHHojqc=; b=O5Ex6H31yg4Q5yzwOe0IMXIxFjARieRMPifyDTE7aBxQ2sO4QbD8svTipDSl8b1/ecXczazykHsxzG31hpUx4IdJuFek6s+/5A57LIgg7LiRpRLTSs7mRSj/SzkGu3GszMKyWnX2Msp3vwtEWCLgGW1phoTHxijHAYxgzuUr85Y= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) by OS3PR01MB7309.jpnprd01.prod.outlook.com (2603:1096:604:11e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.27; Wed, 4 Sep 2024 06:11:46 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%5]) with mapi id 15.20.7918.024; Wed, 4 Sep 2024 06:11:46 +0000 Message-ID: <87frqg6j8e.wl-kuninori.morimoto.gx@renesas.com> To: Daniel Vetter , David Airlie , Helge Deller , Jaroslav Kysela , Laurent Pinchart , Liam Girdwood , Maarten Lankhorst , Mark Brown , Mauro Carvalho Chehab , Maxime Ripard , Michal Simek , Rob Herring , Saravana Kannan , Takashi Iwai , Thomas Zimmermann , Tomi Valkeinen , devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-fbdev@vger.kernel.org, linux-media@vger.kernel.org, linux-omap@vger.kernel.org, linux-sound@vger.kernel.org, Sakari Ailus In-Reply-To: <87r0a06ja1.wl-kuninori.morimoto.gx@renesas.com> References: <87r0a06ja1.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v5 8/9] fbdev: omapfb: use new of_graph functions User-Agent: Wanderlust/2.15.9 Emacs/29.3 Mule/6.0 Date: Wed, 4 Sep 2024 06:11:45 +0000 X-ClientProxiedBy: TYAPR01CA0119.jpnprd01.prod.outlook.com (2603:1096:404:2a::35) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OS3PR01MB7309:EE_ X-MS-Office365-Filtering-Correlation-Id: 9ffa656d-ae0a-4eea-e868-08dccca87475 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|52116014|7416014|921020|38350700014; X-Microsoft-Antispam-Message-Info: iApVnFvV5uBQoqm3AISGLi+FQlfV6IcAeSfcGRe79uAxxN5sScvqLJ7q2D3qUJc3WHiknqRPstpnBfxvIMDy1HT53xh7pQ6qGr9nC7zE2bY3egCvjRGlM4ejrpMQR8VPgR0/f757NBYwtlfEdypZypj25PdEFVHm4kNHnM2safvbIwSrNkIPpAYIZF4sz+nfR/j7tNu2DdTvPVlMVmSxWxt6HXgdjydnmk/4KRlz0EX4zt0l7PubvRs/4EOapfTL2E8GFmRAN1KHvMXWF/Zjo4YYw/9az9+A2n5sXbI0QDMAPAIIgunkowoDdG/Oce75XQ3w234EI6IzIOkeRpT1FoJ/GtSiZmBhGJpIYUFQbgsVJ4e1V4VY5OKxLMRe+hOvdWe73FC6bk0ihKoPfHEXs/0CiLCRx943s1w8eBGZUZDLrac+dA/T7gnmkulBWXxxlDNgUtcyagKNilXmJji3ipu4foNojksxDSzg65BCe5N8YJnt2dCN25hh6sczlCv1Hunt06rqgZcOMAnEPYtsse6TUlOvgJTyWDBaR3yMI65xewYPnIPvbP04niptUjMU5Fjxm5X1EyqGNp5vh8Ry4uEV+VloEIYa6mE0Wyt3wcBLB9lxvsgb/NZ/YiP/2T5yyTCfpXLGFcENkClkgvISLEb/G7MFR+ickaa9gV1lKh1iyhYCgpl7tYCCJoJXi8TvVF4x4B5lOwa674WpuMXsv3cWTKj7K15jDfh2hj3BY2a72fcbYtzkpaNmTLj71VvQWvHgtNQDz9+lE4cz7DwS/hxQyd9Zi7Mf8U2dQJgH0qqPI1FpcsT5XZ4aqvjUYG92vEx4XihrcaUAeS5ySocAZhgx2HunbROgxpcheEn+kVMbe4LeJf0AxwjIIL+FPNz+c4JYtIL3WM1mcPhjPDLsh/s0qbKhV22dXRcddGBsOT3xDrzzIAwaE6wda+Z24IQEkM08KNzz91my4a0yotcyS15irrJuFF+n4iGNbM0FshuvubxwMSCoRlMcqRgBwwkMVSCF1r5P8lBGtw3TteH2/NOss2ZKEF46vJbdcQ2biyXZebnYtUfm5CFIT6bdCcAEU403/WzS22KpqUafdvTrTUA+7rVLCo85Zqb32nkPI/QRWSDGDVyNdj4Bzq8mvjvTJpbFjBOOgHZ2tnrIXzfn0b1FIu2FdfHtWaZPgE6bwsvxEt6ftKzW4oyTzvg2P51p9iFCbgcP8w1Lnky21BN4+vYxe8ldWiSQZHAY5kaE6a3w2XWA3yxIbH5zflGHuLFaT0GRx2NWdgRJs9d/m7gWsYOg+LTxSFr8rinAH2VLP1YHpaon+Nr/FnFbyiMr4bgN+6IeWLpAeryd6GKkSC1ZWmmVkYrjnv7YfXA3/YIdQ6GW6OblsH+fQdXPw2q6c9sxuFsMP3CpaEXphVI3CEoFrSvrFNWQImL8Oojyyn8JjRM= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYCPR01MB10914.jpnprd01.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014)(52116014)(7416014)(921020)(38350700014);DI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L+xCZLvOk2XLupAz5nZnmSzfh3jBjax1nGnxQpWGdVZfoMOha0uU1bwr2EQvzDy0+NVwW+ZyBBfnU4JnomOrj9GOahgTyfhERIhQMGqnSsIo8m2R+HYZbkogLb1ncRESYL91BeBv4KOWI4syOPaZwiBNrPxhREwaUAKJ09HfH/KcHxLzOrnQjhrQbwVyrMrwc+6wXTpSR14hxz60XI+BLOjApdMnlIm9XfUwsShYfvVYY6BAkuMYulrU3RWqodj84JE+6+Fl9CTodn9gHRrJY1JYdf65qPPD14zJr+teiMXEDWXPkgVFAcC2vNw8adt/eXE4+vygUDPwv2tE7lY6QwtEvA6Fsh+tvYbQJY2CJzjuOb0uxzqjRTsyZ+STgkHToCEferw/b6sUPMnBus7B/kOVp5QtjeBs20eUgb0SZzG1SwdmlJndAluY6JGX5KdiRSRLQJ/W6wljHk9WStxLTzA/ILUeczG0XO7HMoGmplOB310Wm8HBkfR+F6iw97+0zGZ7o/9msDCa4KhV4poQe64fmNtAgVUcjuaeBM9ApBouGh1XqAywapxwQSq7PrMfsmgNdbsb/YqojA+I4yvryG4xVF17bNZAcZl+xjlnMdBtJe20KLWg3s4VT9sjxcyehicQ= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9ffa656d-ae0a-4eea-e868-08dccca87475 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2024 06:11:46.1282 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: AxA24bmvrGnxdzWQYnB5NTCLlO1IFxhXImIxN3bUyZsClHGa2XQkHq23PesTPCncEieKG+/N2myXDg0Xwkpk72f135rn6MmdQlUfnDXpgF+QOTfp4hujUaIzIb32hrjM X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS3PR01MB7309 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240904_071217_197770_8484F0D2 X-CRM114-Status: GOOD ( 17.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Now we can use new port related functions for port parsing. Use it. Signed-off-by: Kuninori Morimoto --- drivers/video/fbdev/omap2/omapfb/dss/dpi.c | 3 +- drivers/video/fbdev/omap2/omapfb/dss/dss-of.c | 66 ------------------- drivers/video/fbdev/omap2/omapfb/dss/dss.c | 15 ++--- drivers/video/fbdev/omap2/omapfb/dss/sdi.c | 3 +- include/video/omapfb_dss.h | 8 --- 5 files changed, 9 insertions(+), 86 deletions(-) diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dpi.c b/drivers/video/fbdev/omap2/omapfb/dss/dpi.c index 7c1b7d89389aa..395b1139a5ae7 100644 --- a/drivers/video/fbdev/omap2/omapfb/dss/dpi.c +++ b/drivers/video/fbdev/omap2/omapfb/dss/dpi.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -845,7 +846,7 @@ int dpi_init_port(struct platform_device *pdev, struct device_node *port) if (!dpi) return -ENOMEM; - ep = omapdss_of_get_next_endpoint(port, NULL); + ep = of_graph_get_next_port_endpoint(port, NULL); if (!ep) return 0; diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c b/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c index 4040e247e026e..efb7d2e4ce85d 100644 --- a/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c +++ b/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c @@ -15,72 +15,6 @@ #include "dss.h" -struct device_node * -omapdss_of_get_next_port(const struct device_node *parent, - struct device_node *prev) -{ - struct device_node *port = NULL; - - if (!parent) - return NULL; - - if (!prev) { - struct device_node *ports; - /* - * It's the first call, we have to find a port subnode - * within this node or within an optional 'ports' node. - */ - ports = of_get_child_by_name(parent, "ports"); - if (ports) - parent = ports; - - port = of_get_child_by_name(parent, "port"); - - /* release the 'ports' node */ - of_node_put(ports); - } else { - struct device_node *ports; - - ports = of_get_parent(prev); - if (!ports) - return NULL; - - do { - port = of_get_next_child(ports, prev); - if (!port) { - of_node_put(ports); - return NULL; - } - prev = port; - } while (!of_node_name_eq(port, "port")); - - of_node_put(ports); - } - - return port; -} -EXPORT_SYMBOL_GPL(omapdss_of_get_next_port); - -struct device_node * -omapdss_of_get_next_endpoint(const struct device_node *parent, - struct device_node *prev) -{ - struct device_node *ep = NULL; - - if (!parent) - return NULL; - - do { - ep = of_get_next_child(parent, prev); - if (!ep) - return NULL; - prev = ep; - } while (!of_node_name_eq(ep, "endpoint")); - - return ep; -} -EXPORT_SYMBOL_GPL(omapdss_of_get_next_endpoint); - struct device_node *dss_of_port_get_parent_device(struct device_node *port) { struct device_node *np; diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dss.c b/drivers/video/fbdev/omap2/omapfb/dss/dss.c index d814e4baa4b33..4b1c1cbb4a04c 100644 --- a/drivers/video/fbdev/omap2/omapfb/dss/dss.c +++ b/drivers/video/fbdev/omap2/omapfb/dss/dss.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -919,10 +920,7 @@ static int dss_init_ports(struct platform_device *pdev) struct device_node *port; int r, ret = 0; - if (parent == NULL) - return 0; - - port = omapdss_of_get_next_port(parent, NULL); + port = of_graph_get_next_port(parent, NULL); if (!port) return 0; @@ -953,7 +951,7 @@ static int dss_init_ports(struct platform_device *pdev) break; } } while (!ret && - (port = omapdss_of_get_next_port(parent, port)) != NULL); + port = of_graph_get_next_port(parent, port)); if (ret) dss_uninit_ports(pdev); @@ -966,10 +964,7 @@ static void dss_uninit_ports(struct platform_device *pdev) struct device_node *parent = pdev->dev.of_node; struct device_node *port; - if (parent == NULL) - return; - - port = omapdss_of_get_next_port(parent, NULL); + port = of_graph_get_next_port(parent, NULL); if (!port) return; @@ -1000,7 +995,7 @@ static void dss_uninit_ports(struct platform_device *pdev) default: break; } - } while ((port = omapdss_of_get_next_port(parent, port)) != NULL); + } while (port = of_graph_get_next_port(parent, port)); } static int dss_video_pll_probe(struct platform_device *pdev) diff --git a/drivers/video/fbdev/omap2/omapfb/dss/sdi.c b/drivers/video/fbdev/omap2/omapfb/dss/sdi.c index d527931b2b165..22a6243d7abfb 100644 --- a/drivers/video/fbdev/omap2/omapfb/dss/sdi.c +++ b/drivers/video/fbdev/omap2/omapfb/dss/sdi.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include