From patchwork Mon Aug 26 02:43:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13776994 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BAAADC5320E for ; Mon, 26 Aug 2024 02:43:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3AA7E10E08D; Mon, 26 Aug 2024 02:43:30 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="PMfB1JzN"; dkim-atps=neutral Received: from OS0P286CU011.outbound.protection.outlook.com (mail-japanwestazon11010058.outbound.protection.outlook.com [52.101.228.58]) by gabe.freedesktop.org (Postfix) with ESMTPS id 157A210E08D for ; Mon, 26 Aug 2024 02:43:29 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CbvyqWNVfIwVVDLV7M4XNaYSv0A9NGW7FricS7y9CJ4uxabth1KF3+Z1EBNabSoB/3+FFcNdUiYSA6+vEDdqHt6D/5ZWXSe83xiY8kSfIORrm4RFQ4Txv9ZEL8fsbTLUmYHkzrjqscZFm7WSZHvdE0S1I15NaFz1a3vxbwKnGY6OOWk9InSmjGDi1V3qXk3nSuMXYVFTLMOG258Yb6iyIcrBOs/Yz7upa3LpGAuvMV34rGsM8k5/X+OBApqRNxsqgy4Vb0yRS+AjyAUfOnqCBqwm9WoF++nWevFX1yfkRUCeMLKo4zINl2PP2o/tTpFu9qvGR1OsURECuTnycmPstA== 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=bbM+qTIc7kxSIVX5wMZ9A9LBJGysBXbu+GTaNKKqHlc=; b=huy6NXH3+R/SFSiJoFjJHIbw+tFZmmXSs1KDUc69Gn0VbynX/hb6gsP1Bd/XYn8NPvh6CYa1NvwLJ2HJX5JSZ9TdbMksXj7qORghnd11PQofFBSCIIijQ164uO4IENKlgFjFMFjVH1/5mY9CW0mIc3YHIzt1MLjbrF6zpiYfUCi+OxTT1MBuR2cYE0awwiOuqUZXQvhG3gre+aeP6an9w56Bpxu+zA351wnqB7kb5OR/OFqH2D8sdgF4Udb1TjMVhswgO7+lzTSMHW/Ol8UbM76wGIVB1jWOt87/nRN5OgtEWYYgncHJJVwqtOCvXEPV4K71HpyH8/r7QfneFqAu+Q== 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=bbM+qTIc7kxSIVX5wMZ9A9LBJGysBXbu+GTaNKKqHlc=; b=PMfB1JzNe/UnddCxt4CGsT2bEXzIjZ9TSN19szwtAna6cM0LVYxLEXTHVGjIVsXyYcisDgzPCD7E00aytxWGEPLFcV65ysqwe6Qh32oGd5qOJQyX/NQaZej4yoCmEkUYsWM2bk1SUQRQGuxxh47grKM6jI1on0/peiTZB0BwAHM= 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 TYCPR01MB10616.jpnprd01.prod.outlook.com (2603:1096:400:290::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.24; Mon, 26 Aug 2024 02:43:24 +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.7875.016; Mon, 26 Aug 2024 02:43:24 +0000 Message-ID: <87bk1gqa0k.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v3 1/9] of: property: add of_graph_get_next_port() User-Agent: Wanderlust/2.15.9 Emacs/29.3 Mule/6.0 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: <87cylwqa12.wl-kuninori.morimoto.gx@renesas.com> References: <87cylwqa12.wl-kuninori.morimoto.gx@renesas.com> Date: Mon, 26 Aug 2024 02:43:23 +0000 X-ClientProxiedBy: TY2PR06CA0038.apcprd06.prod.outlook.com (2603:1096:404:2e::26) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|TYCPR01MB10616:EE_ X-MS-Office365-Filtering-Correlation-Id: 5b1a86e4-cf53-44cf-979b-08dcc578daf3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|52116014|7416014|376014|366016|38350700014|921020; X-Microsoft-Antispam-Message-Info: QdWPFICBG5GhrWf84GR2jdYuTA7AIYiYFc0gOX/Bw/rchmgurKD0n3wWaCviTy3tjyrBIRGGYNA3DK332O7RQ5N4QncgXgc6nF03ceMEI40Ki7MJ2eI+NAihHjlrqWikTnTU4N8RaXrM4pG8tttSaWfTSJ4486QmZktpNTQdYKM59mqrbxhOF4rXZGzc4/V5bSNt1cHj6HzGPGAW6O4WI29YrWJV8W8zL8KCI5/HJpr/C/Q7JY33c7rLZ1NKl2Tg1n8pMy0L0DkvF/+zWEGyXxieJ4Jiece64W/kXPK5gJqrq91sJNoRyXyAXEuj8705QjAiRyai0UW1JqSm/0gE257yrHhweE98v7B0xaBpPZLhGZZs9gmE8+nKk4sE/iwoIkOazLhV3evZZWssyRm3mRUUlb2U33FpLvmpqmtBuy1fY7f2SPnd9DCsTbsflxudqe4M7g+492tc5hfz1i7mu1/cH/OQ3/hRwYUCLG7k6D8x2kOUdKgtBJToqnKT9j1EXy5pJVPZQSMDiX870Huq3zBgpC8fprPkaCsI4WEZn0gKkLPWP8OyuNaYFyu0sonh2zub1dbmz0JRGLZBc0exHvvrr4hOm5QOw3FZ0HF1wm6ntaHlf7mLHpfED2s/rN2jv15ex1Go4NrRdFIG4Ds+SzAgCYwe98wSIkZHJSXi/jZBC02g8NwR8Rrf+qTGyOOtlzfrrDdA5Eej0pqLqu8M32izHxRJoi7QxBkVyN+oyJ3fC3AkusaORRNGlTlt/TL6JPMGMFFjU/wfks3YAH/UEhdAHfzUI4JmMgsEMPUz8AO+6Rm5lNIuUoNtulwy7DlfmXHa5tgQgSTaeBtDUAkAhM0f6+nUUlUus83r2EXTBtZeybPltIrzoA36XrjyI6amDze1WmAE5YkGBwNbKfVPYqJq7uHU8gtJ6bbet/bb9m+c41CBJowukH4gTEz+l3LySxHfYxftXZwL+uBwfmnHvrX4hJFyMvs9SHo4CRbq55jAfQgJrjsvOS4WBt5/wbyQW+tGUKxJFUboXUcsIPVrATWX4jEirkEioOJZCg+wSDD0k5vNcXhs74gbXU8f+qVYvO60bqkSEiCwtN9DUK8fN1LvheZhqlt9QonKAgCaWJ68Ab/6lsKnZDrRodcjo/fSwZ/wnVNm7E+CYAT4e9O/UOjg1HQGy0VsYYjcUbrIJb5n8UW23/0/T9hxymiYK7boeWtzgHkxO+xAI5899tfSBKJaGnwow4Uwf4+OP4UqMCPyZU1b3VmKKXZZdqs7QIM9/dXnf1r62rLnk60YkT4BzLo99eSXon7I0hCAaPgbE7/SLuShQGW8jxcO1OaHS0y0l5l0MZNVIZoBov9nLMCfgq+4w0ZXZ8tyYG0h5ChNpjcM05A1WRp/88K6k1OZ/6u5ruZMvSgumoziQhy3tDZ398RpX/nFnmek8t5IhYbFnSQ= 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)(1800799024)(52116014)(7416014)(376014)(366016)(38350700014)(921020); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8Xf9S58mdpJ7KNGqG3ulcCzQXZC4JZaFe/b50yWPrILHoFM8O3bWU3ZUDA+i9nj/+/l7ANR2VpErbd6ThDTcdW4hOu4pGY/GIPXHyRfqwLws5JetRz39cT86HOhMpqIwNUFoPzQmX9S3ppOC8tFklkzAL5C9HWSxwieUTELeiC8woDA1m1tit5vMSnI7ox3leUq2dfZMZyq1ORumkIs7D+OqEIt+qt3kaEewndvmlERgoUdiIEFU7oQCar4tu4OBZia/XSTV5j6cFULoGW2tZvKiZppXZR49QLnWNv044uOV3UduhpI3E1CCQd9+QmJYPMTf1b0APjblaF4PEoexRizXX5cA325twzFy8+3nDbcMbR+mty0BP9BTw/Ws1X0Umn86dBxiYKnrBLBf6vXSqaN7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/etcikRbKmGpbN+kJf5dKqRmhDdX3Lz1zJl7MXmOBF5y8zl7G2FN2icYAheha2ItW+VzxDExa7rd19MfpD923a7wrSU1M3/I3OSiVCnLP3E4gTwjg7maXWQoq2upd5oV1hgDM8Bf5ckst2+kok3+mn+o2vwVlX3ME0HY= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5b1a86e4-cf53-44cf-979b-08dcc578daf3 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2024 02:43:24.0654 (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: SqreCHxCxqYLa7YFNJS5UlvGcZyMC8HCeePFx5zSz8sA4y6PFGekJgL1eJcM2NpBWUbLH9BehwlRrnv1eDz/r8emi8pqQ4qeC99PnvL1OKUyLjGBnbgyiwJSFbJ68UA/ X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYCPR01MB10616 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 for_each_of_graph_device_endpoint(). Getting "port" by using of_get_parent() from "endpoint" doesn't work. see below. ports { port@0 { (1) endpoint@0 {...}; (2) endpoint@1 {...}; }; port@1 { (3) endpoint {...}; }; ... }; In the same time, same reason, we want to handle "ports" same as "port". node { => ports@0 { port@0 { endpoint@0 {...}; endpoint@1 {...}; ... }; port@1 { endpoint@0 {...}; endpoint@1 {...}; ... }; ... }; => ports@1 { ... }; }; Add "ports" / "port" base functions. For above case, we can use for_each_of_graph_ports(node, ports) { for_each_of_graph_port(ports, port) { ... } } This loop works both "node" have / doesn't have "ports", like below node { port { }; }; node { ports { port { }; }; }; Signed-off-by: Kuninori Morimoto --- drivers/of/property.c | 112 +++++++++++++++++++++++++++++++++++++++ include/linux/of_graph.h | 46 ++++++++++++++++ 2 files changed, 158 insertions(+) diff --git a/drivers/of/property.c b/drivers/of/property.c index 164d77cb94458..aec6ac9f70064 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -625,6 +625,100 @@ 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) { + prev = of_node_get(parent); + + /* check wether it has port node */ + struct device_node *port __free(device_node) = + of_get_child_by_name(prev, "port"); + + if (!port) + prev = NULL; + } + + 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 +917,24 @@ 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 node + * @np: pointer to the parent device node + * + * Return: count of port of this device node + */ +unsigned int of_graph_get_port_count(struct device_node *np) +{ + struct device_node *port = NULL; + unsigned int num = 0; + + for_each_of_graph_port(np, port) + num++; + + return num; +} +EXPORT_SYMBOL(of_graph_get_port_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..a6b91577700a8 100644 --- a/include/linux/of_graph.h +++ b/include/linux/of_graph.h @@ -37,14 +37,41 @@ 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, of_node_put(child) has to be called manually. + */ +#define for_each_of_graph_ports(parent, child) \ + for (child = 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, of_node_put(child) has to be called manually. + */ +#define for_each_of_graph_port(parent, child) \ + for (child = 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); 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 +100,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 +118,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 Mon Aug 26 02:43: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: 13776995 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2D09DC5321E for ; Mon, 26 Aug 2024 02:43:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A03ED10E090; Mon, 26 Aug 2024 02:43:34 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="KEIugbhB"; dkim-atps=neutral Received: from OS0P286CU011.outbound.protection.outlook.com (mail-japanwestazon11010003.outbound.protection.outlook.com [52.101.228.3]) by gabe.freedesktop.org (Postfix) with ESMTPS id D414910E097 for ; Mon, 26 Aug 2024 02:43:30 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JgCDIBii9dWeqgfU3/102jPf34i7vazgXiB3XTWCYwSy5kg2nTCIw9FwcHXRC4VP284FVlct92YNaf3YZHXVS3sdZs1CdDYA8xZAk4F49YCV7Aeirn9QwOSl3pyEC3u8Ht8accum3GLyDPTlzFLLNor+PoIp4LgbGQkrVsGdpCR77zwt+H2n1JsUiGGl6byg+IBU5XZxY1hLX3Ifnu/Qrll211U6IdbIhhW+UwRzHegOj690hp/phB1/rwl1Mt3oHKvGZMDZdrgYvBQ0q9KY/PNlu5VKB6ls3Z/kBIWmIb6uOSQoofLrOLa6h7RataZeRlKNa0ryrD0YfDvGqalrGg== 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=u5wCXam7eyk+9ZHVTp2xwx/12vJhqGXCaR39njBrXpE=; b=OEol569a6ss1hjtJKoTZ16SrsPgYvr549moHzs5DaUMRkKlJQcpNwvi598x6qJoT1j23EKFklISm48Dpur1lak4BHIlwDEsL+FVvYhBcMjIdzkdBHYkpu5laMDEHbeH/sl2U0gshWvV30BizBA3N4nwSioJFtlzxkoIB66+/QJ1R6NJMOcx1CZxQRMTGbhyCjuDnSZ59rMAxr8qt9Tfy/y+I2OhIdPoRf1jhXjdQZk5VUjk31uUmxKwzdekC8ujmVuHEksmPReAkehD5UvriDX7TykjYF32qNFO0iQP2GvWyEJDJB0/5ZarkxpvL3A0RvUtj1NEF2NhZxzxjpdLcBQ== 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=u5wCXam7eyk+9ZHVTp2xwx/12vJhqGXCaR39njBrXpE=; b=KEIugbhB0oEwdReQLeUZ2wg3Ik4pb8oeeoIXEDKPCGarSKM7EQW+/NkFEbcEEPfet0JZgRmC/E0eDqXEfX1CsgoR+RGhVAp6pgXFdBFJ1aEBE3Fpl72e1lWk0Fd/lycgWxXRJB2t/+GPngi9E/7irpk+YhMmzaGorbBXV0IHxYs= 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 TYCPR01MB10616.jpnprd01.prod.outlook.com (2603:1096:400:290::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.24; Mon, 26 Aug 2024 02:43:28 +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.7875.016; Mon, 26 Aug 2024 02:43:28 +0000 Message-ID: <87a5h0qa0g.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v3 2/9] of: property: add of_graph_get_next_port_endpoint() User-Agent: Wanderlust/2.15.9 Emacs/29.3 Mule/6.0 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: <87cylwqa12.wl-kuninori.morimoto.gx@renesas.com> References: <87cylwqa12.wl-kuninori.morimoto.gx@renesas.com> Date: Mon, 26 Aug 2024 02:43:28 +0000 X-ClientProxiedBy: TYBP286CA0031.JPNP286.PROD.OUTLOOK.COM (2603:1096:404:10a::19) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|TYCPR01MB10616:EE_ X-MS-Office365-Filtering-Correlation-Id: 8ae6722a-8a7c-4b68-a1ce-08dcc578dd8c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|52116014|7416014|376014|366016|38350700014|921020; X-Microsoft-Antispam-Message-Info: W+AK3nPDYbC4CL8Nuf2TXkgoAFWvNTtsFte2zieY6zcK1a9/lCRVB2wnT+rG7/cN5MOzM4g2DEOULnj6FICCXmzEj2FMS7QRC+QiQznqkLFulqlvEMySqWGXk4BSrPiLc8iAzYMojYwcToA/xpptG9utuTLbzvtaNnPEpXzUDNbjZuYCd3ppoV02zAiunfso9JH9NKzFeUMWzb91SoRYvnlempfw8q7BLef8+f21XX5N3G0POkfEzpqZN4JpA/v6PC90BoiF3qBLIUi0TJsWVp5M2yacdrXMMPFSHxD/4FJ6jg3m3n76VsI8zI0BMyAfF8tqsoSoq/36ctIEqCzKQp+w3vkLkASLg3LywEkUwfFd/D6wj9zXlT/nSy/ofDd7TGq9ySPsC+4tM5Uu7s/eKs+N8caEKxgUtP9ry1dzBAQHjmHoiqu+7zc6kHxBeePZsUy2ia0rkvFcNwvRkmIDVHb9+OFU1Kf9VssMSL8YseV6au9VKz5bnhhIT+VIcvnqthZRUvA+qjc2s1D3ejyBF6OX5+2PLFGEt4kIGqEtFanB6oEa5oE3q4suuG38DgVGt9wbQTjUCxkOtlCHobMG/hmYocAExXR8G4dEEknJKkfJ28mgp5FxHR0oAVGeJws3VHZucfikEN5+IFjU/oYOtHb5THOJbtyPy3fSkVDfRjpFwfsqkUVkApqyK+BTFLkwgRiX8zObszk9Zdu9IdZLTSldwqenWLXYuXITc82D8f8Ww3GCNhK5ieFLdQ4bzAkQpa72cUQcffwQ+7OI6Xj1ZJpJwSejfeHhC5k1ZWN94/8+GSKTFflF6fsZi3d/AnfzVhcWussa+Dd7QqQdENlkYScYmwIb01rbIbFSdJmojaTjz36LtV5o9xjKLGn0XaZ3YLbydpzJYajDcqYtSwykShjae8z2zgRmkpeHW7/IFoXeyzPwVXI8MnvO0nzuKjBAO27b07vwjphmjml+oy8CB4EdNRSuapnT1dvBN0Dj6WDkEz5Rh3DgPF0+mtTP4C4FdK2nCZVP2YQI1Wq89G/yBILFaaOyh6FN/VAZtIJQXsSM5m3cpKerCy3dOOBKtYBWkhGWVM3m2avYJXsbxkyisOITh3dzin/vOZUhGoLi3BtG5tDr7xyYkkOWdDj32yhFkOBuNoKah2qG89QTavU9OfDzNMEW0kuWmcwSa5MEm4hGzLh5x7rjm4BcQQF17DDnUV3fkAunAm2o5bmHACjF+ydsr7Zdt6lUXvLjGwTYgnZ6jnZe/Wyu7WPvW41uUNN7BGT1eO3oPNBsMFu1U0VeSFUZa8bzkD+yeICdDcmLnnj63m+Y4nmFHK09lNBotI/fNCpru5Lw42gIoWtDjT5E9qBGBNwtcY9XEqNvnFvnndUHwgnbC2Qn9wV4XNajDI5GNgt5MtNM9DoM/JPSymh8C4JlQ4Nq9WuvaT5rY8ZOLAA= 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)(1800799024)(52116014)(7416014)(376014)(366016)(38350700014)(921020); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ySCMOO0dlCHMRkwdjVj7d4mp09/K8QZtLqAVsY1E1a1un1FXetApBPSOGMkD7U8MIAKE45VvQj8pLir4lynfOpS9jcF0KKB9GbZIpIOqaa4SX03k9Uk8DitcAuDwCeGs5VlA/XclqMFBM0jypusAIKzmh+LpK6NaGkNlB66SdAmJF3cV0xWBM6JI6tEJfSfv/5qNWwdTFwsOLyXlo+zNsi0A8LdTtHQpg7hPhJGDTcXkMgvh3VZCPNYypDegeL0tZPme1/QC+tLHE4d/Nsdu9/DTekroGl2p5IHXw8RTVcSvgjkPpqcSoAcIurTXp9VNf+CHWGYivVnPIEYn49Xmft6sS2rc9fUiR3HiWLf9o8W7BX4oNYcpVHtYHBlnIwi+TWzzrm4ShTcSu3ThR2FvewaqqFLF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jYid2bh81GkGvU0Rbwy7lSBO6lKl4oZaFhQ0azDTc9THiA+oxWNpfStkIprdATPnpB/yDs98cpvANkiC7XG3HRKVAANUuVEZmjdz+CiIa3wNjVspL6gtrngpLSdRWFqZG31dMs8Rh7Bqd9RlMHAmaVH5hMr99Xg= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8ae6722a-8a7c-4b68-a1ce-08dcc578dd8c X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2024 02:43:28.4222 (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: mkuIz7EY4ZyIj551LeQoQ4WU82FUQKydsnkLhfnVKIFBF/T1Vb3YPcqAhx4Ra7PqDhZwWslWM7lWH67BGk2KKhjX60nYN2pZZ/IjcB8/5iS35wMaLymmeBEzVVEL7g7n X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYCPR01MB10616 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 "parent" means "node" (X) or "ports" (Y), not "port". Below works, but it will get P0 /* These will be node/ports/port@0/endpoint */ 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() so far. 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, 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 has. * * 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 on generic driver. It uses of_get_next_child() instead for now, but it is not intuitive. And it doesn't check node name (= "endpoint"). 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 | 22 ++++++++++++++++++++++ include/linux/of_graph.h | 20 ++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/drivers/of/property.c b/drivers/of/property.c index aec6ac9f70064..90820e43bc973 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -719,6 +719,28 @@ 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) +{ + do { + prev = of_get_next_child(port, prev); + if (!prev) + break; + } while (!of_node_name_eq(prev, "endpoint")); + + 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 a6b91577700a8..967ee14a1ff37 100644 --- a/include/linux/of_graph.h +++ b/include/linux/of_graph.h @@ -59,6 +59,17 @@ struct of_endpoint { for (child = 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, of_node_put(child) has to be called manually. + */ +#define for_each_of_graph_port_endpoint(parent, child) \ + for (child = 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, @@ -72,6 +83,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( @@ -132,6 +145,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 Mon Aug 26 02:43:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13776996 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B4F9BC5321E for ; Mon, 26 Aug 2024 02:43:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 12B4010E097; Mon, 26 Aug 2024 02:43:38 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="Lw6Kziwb"; dkim-atps=neutral Received: from TY3P286CU002.outbound.protection.outlook.com (mail-japaneastazon11010025.outbound.protection.outlook.com [52.101.229.25]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6776910E097 for ; Mon, 26 Aug 2024 02:43:36 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MpoX/rm0mhWzYtepA42nH+pM5H+npbF49jTy0LicIhk9ul7PjlFgr4Gt7fojsXZQTWQNGGSF/f9PzzIICH3QXucGfySEBn1GftAWwV5QfG1jkxokmVvMxLC7dOPgi7eXIIZKR6zx80P7vcFEvFAKdB+eglfKWUaHsXkMW75a5UXBnl0wedv/MK8szIlj0/h/7cKEz0zCGg1IvUHsKKsrVQg9w7+3xxJJUuW6CaSkcosR8eDosk/ayYDqV1hB5B4foXbVJLi1u+CwdyD5XzWR1ySOJHXclyq+RW1a6J7SuK34g25EiOIN+TS2x24yrhPBPFDN9oQCfr38qG7sjrVEog== 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=xK9PRpr8g92RSfeAYqS0rsU3uHRBqDoo+3h1U7ObAgs=; b=LuozuKqDgkHJIz5luKmlm9lPbT+TZC7yieutD5MIemJVIk8HeKwrBBvcjipP75naDY941mg4XoWLX/X3WkzhG2vPcT3QBqJKQkjbJJMgwB98CNL4RE62Ti5Y/LqgS+ue/Nn9Xbibw7lOs705EqPAJPj6MvcOLLZxoDaNlIvUvUJfHr6evDUcbMg+NfvdsM6yNAlxTGIMjco1DQKfAbFfbHJk3uT1x1ja47l2Jxd+px35QzVATjnsIiY851AQxTFBLLsZg/DtzLjMEJJjm4CJ0k7PkU1TYurm7gKyBDHef7x5Tg2lv+ZerEABVyTJjgNKo4+d4S2HADsd4clB6XjsEQ== 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=xK9PRpr8g92RSfeAYqS0rsU3uHRBqDoo+3h1U7ObAgs=; b=Lw6KziwbVa8vC8hZa/G7afZ4ewBVHTkks3KBsK37Fb7huYi6q1Y+Xucr/Ttg5jRd4Q0k0WQmWAb7+pvYh2nNcCcE3t8Or+dCzMRq0DpOfzLreYwhBYuCXwhGcZyzr74fXuZ7VCWoFrRNPQH2ZKO//UX57H6GAiLVJzbV+yV8rXI= 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 TYCPR01MB10616.jpnprd01.prod.outlook.com (2603:1096:400:290::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.24; Mon, 26 Aug 2024 02:43:34 +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.7875.016; Mon, 26 Aug 2024 02:43:34 +0000 Message-ID: <878qwkqa0a.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v3 3/9] ASoC: test-component: use new of_graph functions User-Agent: Wanderlust/2.15.9 Emacs/29.3 Mule/6.0 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: <87cylwqa12.wl-kuninori.morimoto.gx@renesas.com> References: <87cylwqa12.wl-kuninori.morimoto.gx@renesas.com> Date: Mon, 26 Aug 2024 02:43:33 +0000 X-ClientProxiedBy: TY2PR06CA0028.apcprd06.prod.outlook.com (2603:1096:404:2e::16) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|TYCPR01MB10616:EE_ X-MS-Office365-Filtering-Correlation-Id: 6e7600f1-cb58-47b1-3aa8-08dcc578e0f0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|52116014|7416014|376014|366016|38350700014|921020; X-Microsoft-Antispam-Message-Info: +AsNRX0qBUbqaHRFfdW6Q2ofxjyIkp+mSKd/qX5C1bnYorVBFV1KORS6ZdQlzit7H6lZgCq50BQSRL24t8rEu2f6qK6O2eho8Vg9gUTqk7/e6l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VgoBIbMsoerzHfVmm5IB54Dzwej4CJx6NSWwRSKXm9SRqbpk5WmluGPmH3VHCD72TOFretEwtQZL5vckPDX9RjBLd8ZbmWNNJ/hpBIrF0uvo9mpA6VdME0Jhjk+V3yISynu666In0bA2lbngOdG5wBZoAa1SodQoVCVMcbpLjTOv0omibDKxGz6aZg1KaU48Xcm4oIEIuAQIehQKBWA6MDAINgNRx/cJY+VWRQWgQhgisTDug0JSUydfukqYeZw3BmTHswOuqedNQ= 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)(1800799024)(52116014)(7416014)(376014)(366016)(38350700014)(921020); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 94o42hLFowFzvBBaK1NqVbEBYMQ+BD1705PPD1NWSsgm0ojjKKtzPKTqSMPhgp3LjNydri8x/viZJxxKFSMQngMTPS4++3Yyji1SufYcAsU5Z9fUIJwM1ejO7Zi3PijvlgMM7qTDwNQZa9KsrBo1EcEziilVSMbqb65Bsy5MfhnWkNQo4l7B6aGXPR4B/TKAlL1m5kly2BCIFuLYtelM7z50qa//CjNVLu1p+q8Tvr6Dou3viSRw2CLgHvbzcaosEbDrAHz881ZHQp+G3TYVzVD4bAnzYwS7hyOXgDkfy1LoaPhyBcx9bTojxQLD8LhUCc3aBx7Rbk5+dajzL1xIt3fMjz95nY0ZzCgF4VxAnpqJHplNW8maUWprnFB/8UJh5TQrcwtHuSB1N9mly1RLD7y/pzigJSYYcER8r57ddNeawE2OvNpWieSv9gIXs5FK4l2Wc0yEsvaV+2Vl9AI5IeAhG8oz4bIb2Oms/HNUj0ssOzO0MiVRyK0LmrVz3+v17GGE7NsMEg9SE0y5iVAudLoRoGobmNPkuAvdNdd1OlFa8rCUAAqoaMjDU1J3P9EWHt4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Org: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6e7600f1-cb58-47b1-3aa8-08dcc578e0f0 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2024 02:43:34.1092 (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: 7IqyBmu15slUaCazMWs6xtbqqqnOwGpfCl6Vn41safxeIoxZwlglaXDEOz4QSCbqC5nbtk7sRrAgmgcFuIKFrG5Nm4RSw0CkNOh/m5wID3Noj52QEDBTNCvahO0kXftY X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYCPR01MB10616 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/generic/test-component.c b/sound/soc/generic/test-component.c index df2487b700cca..93288f7fa3861 100644 --- a/sound/soc/generic/test-component.c +++ b/sound/soc/generic/test-component.c @@ -521,7 +521,7 @@ 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; + struct device_node *port; 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 +591,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 Mon Aug 26 02:43:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13776997 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3DC48C5321E for ; Mon, 26 Aug 2024 02:43:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B986F10E0A4; Mon, 26 Aug 2024 02:43:46 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="ebAkgDCs"; dkim-atps=neutral Received: from TY3P286CU002.outbound.protection.outlook.com (mail-japaneastazon11010041.outbound.protection.outlook.com [52.101.229.41]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9DD8B10E09E for ; Mon, 26 Aug 2024 02:43:45 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=COzAb0W66vftGgO67F+W/dV4u2wyzvAtPuLOHcq9+zMyU/9A3aITr+KUeBKvacMrDMVM1sDhKwYagx7eOkg30H4nMREytGMz0SFNrTh/jZSAOiCP8cRw4jHXmpYCnC4aa6mrtt5kAlpu+D6JKChC46O0X6gXNIGZmHB4bf5DHxYojXcVOV2kO7TkRyf9pRL5Ro2TduTDe10u555cCidQCEIvJk6jBUdUIV6w2qgcenxmVsWoL0NpPWiFdQ5H3Ej5/8uOag7AuEl44t1mNLlZI82QHf+Pi46/AL94p20i9z5TEkbaiuoD7bfKF230tLRCb/xEUYJKq3FBSrOTalPlIg== 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=T1GAp4QgqoFns9AbOFF32TGzFGMNvnIU4szsG2JXDso=; b=m84kR+43goxBtHXbeG8niq+/cT+MjyrNv7mp/jD2+l6S8eEHGGAbG2hgT9lrr6JqJIdP53dVRAKmS6MRayTCfvg+uFfEBOMhmLD2GMLD0JuhCi1qzJa1IBRGFg7GNduwpg74Nod87qPMMmcbxVR1qv8wVglIEMeZvgFU3PZtYZX6RdxuDWeQDAUelHrhi8IBiXWdgSvPBNQ21pl1BjhXotIZK6T6dRVfKKujwN6ePfyq34t8c73FK201GXGB4ldEHdeJZTU07C/ZdJaMgbldOax6Cgx3XwrD2t7afsRc031+EO9k3DssCpvdxadOxtul6FZdC0qaBftd11AKCIk+2g== 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=T1GAp4QgqoFns9AbOFF32TGzFGMNvnIU4szsG2JXDso=; b=ebAkgDCs9l1EbtClxvCQXXGWz/Nfe3skYWHmrzHcuLyNlQSoOlK82hVuE86DjpyqyUu/kRkWbBzn8i+4AQtVE0AjWTzAMOR15QB7KbsWMYhh4chFJTMc18wbgc/253h0nLxdMy6Fa2+fWVEDijHWDRaXBJIokBIIV4JcU5iOAmM= 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 TYCPR01MB10616.jpnprd01.prod.outlook.com (2603:1096:400:290::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.24; Mon, 26 Aug 2024 02:43:43 +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.7875.016; Mon, 26 Aug 2024 02:43:41 +0000 Message-ID: <877cc4qa02.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v3 4/9] ASoC: rcar_snd: use new of_graph functions User-Agent: Wanderlust/2.15.9 Emacs/29.3 Mule/6.0 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: <87cylwqa12.wl-kuninori.morimoto.gx@renesas.com> References: <87cylwqa12.wl-kuninori.morimoto.gx@renesas.com> Date: Mon, 26 Aug 2024 02:43:41 +0000 X-ClientProxiedBy: TYCP286CA0341.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:38e::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_|TYCPR01MB10616:EE_ X-MS-Office365-Filtering-Correlation-Id: 84913690-1bf1-4de4-f6b7-08dcc578e593 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|52116014|7416014|376014|366016|38350700014|921020; X-Microsoft-Antispam-Message-Info: OCfzSt0SvrJ7OvTKGFBhNTSu+VDnYH3wMhA7Go2rLvpuJk7Q1BSnOfBj/E1FI6uNqpMZmnKTLEWKiZ99ULyhfSm3a9wj72pBGrp3l74MHLEh/zvi4JOD4iCv9AjnLTBsvF8ar+HYGjYRcFYrM9eUk9FSBjyfnITPqKV3wa7YTIe49rNJUCa0VPEzlrsGobDHimNzKgiF04yETL5FcY5CbDUfNm5TKW87SyRIbtIc7dzG4Zbi3Occ4mez9zNT+YK5Y+BtPs0cpKe93A+D4OKpUWvVi91eE5KqfKf6fuSY8VdSsEg740uWa20KtEKrASfjVOgfFelqRB1CpA4TvySWE/wFwMTN0HrHN6PiFFAABzZxz3KjcQoUy9DfXzwX0q9soa7NuD2x38r8MvwDED1Xs7ya5tzuO7pez79Frw+AmWwZmvPQVCa+bpLApStih1qvROCBhbSh5b6seColtqVjo6icu5P6sHOd0zHJi4QrfXlAYaToumOtkDXH1HAvxfU84jgCF8BlB7zOJgsvtIdYyeCyYZcPxhi9+C8Fm7OicU029mpT2vp9wuly492HcKvIpNjapPQ7/ZvtPOcJIqqoN8+44Qiwyk4zFEPe+hQLYyT7aeG4lkahZ8h3HqUgd3mfR0Ogm9066daP29JtHeKewBwxTQsX+K8o+3io7YMGSSXN3Qw8KW6FBa2KH2QwIwNTRrpwC25oWWzMGsrhEBuIM7cyQZDXs9dab5/0RP3C3zwsfR/skYN3gycG1Gyf9b2xaU06grw2yieXeF5uIy8Rcy6Qj4kNo7MitPTK4Fi+/PgKwc3SrrcPbqgm9xzXlPdPxMn13ZkFtPBOWLhqD1LGtYj/DlHCaQTbqit/oZC4wwaTkW3eaXO/fmFEn57e545SH++XNav/3FhbhrwHRZRBQW9B1kjf63H//QI0pYrmENN5J3j06CiEsxLQozm7O9FrZfVoqTzTP9hLNbQJHnx/4E+tDPPWcIfzt7HSe9vYZd97Qt7klzVRG1DzA8e0vtFxJgac+IkY6bQH4hHVkSe/U4Gcoqk+FLHeAiE5SAPwPCtD9zDQ3JE1tJjqNwGeIHUP3qcmvWtTp62/dsd2kgU8UER6FPDK94McEHL6FT1C7SlOkR+mgFdA02bM7lfv23HIk89P1fO2zSMzwJZi5JE5IgR9fOxINUDICdB2agmIXMORr2wAY/YoQG3oyewe7xHsHKKq5eq7iXw6fHDEjzA9dCjW/31iUCWP9nG+08YONwVzYpS/Ujpj1aoJUF2gIoeXu4mTyCIVWvTTBxlq96Pn+LHBvsd/Ev4hkWdVrJfyVs0fGbY0eq9WvkNHeHlpR44F2AL8DA0LU45MEgbfEk/0R9TG7625tFn/zEDA3H8or2KpAwEODLE0IV0M2yNiTjMWR3U/aonKYwXGSfWVLQYAkA== 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)(1800799024)(52116014)(7416014)(376014)(366016)(38350700014)(921020); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eMPacOAWhqdI1HnJcoje8IxTd+2rdSwJjhAp2dHXPqU8ZUziA+4Sc1xxqWIrDb0UQu3QpmHVaPrRCCdY27BnyVg6N/K8koAtH7zRtScXSybUc0VzNN9m5zMkrOH/3kfDlNOSM5MEoiH9humusmojfumQ3S6X6yXBC6BOoQB659ZJdVv1Ok4PPG5UJetuhCG45BTYhPNJeMp1b8+6MxzWBGwlrlJ48p6gHvi5YqF5HmzKB/7kHkO45i1aLHZbyWMkCJd53CI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ynXM1AZohJdV6ZObbArjvcVWNroaPZ3YR91u4PmAmWPk/i0bAnviNZVZX3tcdDclE4yBOyCB6EdE2+xVD+B+XWfCABso9e+GEmWcwFkYbYVfInJD6+nu7xUabnFdxBWhufwm9ayjfx9TahQJ1Oyxywv0qe+v+d9g0k4eI8lbxVg02m1qRxAkBHiMPuhGB3g8uCc2aVJTU/annf+fkC44av0gRTyaTHkDco8djoorYl/SDUHR7ESwF35v/PkYoHx1zDXGHN3Wqkl4Lj9oGV0I8aN6xL5corxqcRTlKN0PqLtMXuuMk= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 84913690-1bf1-4de4-f6b7-08dcc578e593 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2024 02:43:41.8934 (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: vPnZTnVGB0iTcXG/1iMAobkCFXvAzoBe+JJI502OmWOWhT8E7aTH/oqrVAHOSJ7tJEuAbgNxoUqjfbhu9RFWO5HhXHyjSr5gRAZ/XqRMDuwiD/C9Xtwprhjtj1NLYWk8 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYCPR01MB10616 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 15cb5e7008f9f..dd8e9bfee6c0c 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -1277,11 +1277,8 @@ 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) { @@ -1489,10 +1486,7 @@ static int rsnd_dai_probe(struct rsnd_priv *priv) struct device_node *ports; struct device_node *dai_np; - for_each_child_of_node(np, ports) { - if (!of_node_name_eq(ports, "ports") && - !of_node_name_eq(ports, "port")) - continue; + for_each_of_graph_ports(np, ports) { 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)) { From patchwork Mon Aug 26 02:43:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13776998 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 01753C5321E for ; Mon, 26 Aug 2024 02:43:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7B9C410E0A6; Mon, 26 Aug 2024 02:43:50 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="Ncy3+Bjb"; dkim-atps=neutral Received: from TY3P286CU002.outbound.protection.outlook.com (mail-japaneastazon11010018.outbound.protection.outlook.com [52.101.229.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 265BF10E0B1 for ; Mon, 26 Aug 2024 02:43:49 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kSqiH+Ib9Ord/uhLuNVVPhHAVRql9j+7wHxXbpkVPIfb8+EukH9i9YjsNHySV1JYm54N3yScqjQw0HUHXElEYmBMFJyteuNUyjaNYj1n8lo8/QuhYix9HZyA66K34ex3x0uNdkIRziiRYsdTSychQribdJ5CzWcxCVtdwSiIuK18MZEeeVLoXkdUMg8lI7h+49+OnLalLgwM2JDek6t1lxiRFV7pOM2vSBWadDrQE+mHRc9t51YT8sMrpuveg2M+SlGVvqHkKeg+Xg+VS5763ElIxPeKG/7GgoqJy3qxJZ1/rcYgvyTEqTdmoied5tsTf2TxxjFvm5PBKUlErmth0A== 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=BhVHY4ekwsLyU2IblZvMiGZepwxCoZAB7m3si6qd9xI=; b=To3sahaLf23q4J85bEIxtb+7o/Aq9RplncPYKs+T/BvQ29RZCz80l1LoqZzVgq3pT1bvlXemagzyeyBoxJVTynZC8D0IVY1dVa25H3FUPGdUKW5Bg1L8SW2kaXnTPTptl3MNpi0Jl0cqyzt6Mw3B6Y9c98bbKTszQ/BSuFCUd+YHIiZ3L/dfAWhq6njVnmsPY6SOMawa/CT07AYzU7Z06RmNQn/hHAMSDkBM4Whc/FXowgX2/w0Z7bOFP5Br921kbKsuBMwLGaZBMG8e3zPHvK0NVR1W7ehycasUNFJwHccZ8VWTCDrzHoMSm56BNQ381qEgSdaDsAQa/a60AB+Lvw== 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=BhVHY4ekwsLyU2IblZvMiGZepwxCoZAB7m3si6qd9xI=; b=Ncy3+Bjb8UpTWRzbhIA0InAyHOC+ExN8qnRRMiLPdf0uACraeNlrdRROLIhUo255xlxMuKbgTh9IwgwkOJnXHzt2y/9MacI4t0dZt/HiLdibCxIXy+l+iIPLHrOjW5XfshlKSI8FncpC9zA582qoQ3SIss0PUVqZJcC/NDkmpzQ= 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 TYCPR01MB10616.jpnprd01.prod.outlook.com (2603:1096:400:290::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.24; Mon, 26 Aug 2024 02:43:47 +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.7875.016; Mon, 26 Aug 2024 02:43:47 +0000 Message-ID: <875xroq9zx.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v3 5/9] ASoC: audio-graph-card: use new of_graph functions User-Agent: Wanderlust/2.15.9 Emacs/29.3 Mule/6.0 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: <87cylwqa12.wl-kuninori.morimoto.gx@renesas.com> References: <87cylwqa12.wl-kuninori.morimoto.gx@renesas.com> Date: Mon, 26 Aug 2024 02:43:46 +0000 X-ClientProxiedBy: TYCPR01CA0139.jpnprd01.prod.outlook.com (2603:1096:400:2b7::16) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|TYCPR01MB10616:EE_ X-MS-Office365-Filtering-Correlation-Id: 5fb7ce6b-0a08-4e6a-9b5a-08dcc578e896 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|52116014|7416014|376014|366016|38350700014|921020; X-Microsoft-Antispam-Message-Info: BDU7MDeTGDrPtR08JXLMFlYA4SIKMEAV8sD0Fu4UrJa2SkZazbl9Q+3CPfNV+eKAqOyYQX+Ud9TuF72+GZNgAKBk09votu4G8GwaIDe7TQRCj1Rxo0KA53M+IvANH4zz94cJl1UGGeXYSWT6DG8x0laqEg9AmiG9VAa5SoSueb39lWFofQwf3pHIi1YBg9EugUnz2b9ps9Wb0VyndmlCG7J7nxXKi5zudhmUe4UoAgrmneWuqyWj3Hbw4JsT0BxCHRHYeDg9jp8ioJwEZ2bCdxEsNr62iTb78mxfjJ9bH+B9PXQyKrqbKoDADvNMQ6PedXZi8rlCLUBCVUi9KRvNMbvGCryUIk3T99DpQwzr+YzMBK6E6vFcYZUYHyOKrQplTfFfYYd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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)(1800799024)(52116014)(7416014)(376014)(366016)(38350700014)(921020); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: k3EDdWHHRrJTdwDMd9ckzL9KJagonfN6PfE0XIuGaJKKHInpcnmqXYKlE70jbulvU3cvITJFnjI9bT8IbHKjeyjfI7vGlsK45/vZ68QNdega86TC/i0YWEmssHKHSST029pVaFJEinQIRO3hAsNc7atcmWvwfdQzOrW3CBZXvAy4pF+fDeAQ/u5/jLqT82h/xRwl8amMJwIUQVUId1eTzBsW1U2mHX3Bq/9cIy+HT48A+rUoCMjJYsYtvqq6+kqImq6vf2Jk3njA1XprLAQrNHtkQalyHiJ4djT5WFUD4Z1wnw7+2WPfGlwT2VzNvT59rxBPH9me2A1+Jt9lls44/3yDMBG68ygBlU25tKOErRnqHog7pEiyATy0RocX6XTUxbLk6wqJBdyyh237Vxa/VJwkymAselgCQxplVCMCnRqLxse2rKpGwd3L1ki+7xzPaa9uUceN8KAx2xQ72Tg07D5jeMH9SrlRx2HB0jPBxlOk/CUUGcZ0GMlCmGTio08hmZ3F6O147ReYNsOwEOmDfjBmU9VcbeeYMRpuA4WWVsEaELt/58N41eouQXn174+0LFcHigSnXC6y09KMIMfOZH0a11A/23+ZgNU0vOi2Og2S1rikjnJDxYsXRQnKmFZljw9MlUoEBaFYRjODMuLdYZKY7irhqqKzJQsafOkBTaKwFbDi8e3A8jaAnxFfQhedNMnJ8h+5nGLCgxOwBgorqYKtkdwFngqFJ2uW75XovhIP+1a6H1VU8WtDbaiJrteBLa7UdLPYz27l+Vv1OIfYLdmGxlvHdZDwvlPuh5SnIaKpR6lAzWvdLaofzU1tTygSoWBTm/VXjON2wNhDEa37FhDOSmmunpqu4EDtnAsPHL0PlHIJAN5ELLWFVsZNX66EhrRHsR8JOTXnsaaRKaGKnbcw/Zt/wU9oQHwO19/B/iAg0hD4TdCtm0BP1u+6/hIQCHW1BJd3pDsxZ9xF+VEaT5BVArYN9ou9OKx4gbHjbZXAojYDLdaj4s07D4Lvr9Eqdlivexe7OLLCQuKGzR7b/H6RbfLeGGc8rHHWzSKt4EfkNEM9ejdl8XJ/D04Huo661fD4NnfRYzIjWxadSWAcT1h3NORXg9pUl0XAVjNorkOFLr8FlnTeQ3uwWEOqxdT3X7Bv2kNo9UKX7MaD/a+PMDs66Mwfch092FaU4aUFFJtXUt8MJEJGJba3t1rq/ukl+/cyjFyMQMVQhzAm4/AIA+T53++Mkog+KGKvvRiZQMwre/lF4LZEG5sXzQCe9wt3Rsvkluqv7bLByhycgLkRktTn/dgmXfn3e4UbrL5L4n8Zw7EpvSle5hJXWXvgwCe9BEiEuFEGUlv7gCjItOwrfGFpfyPEfPFs+qQjGP6AY8UbNc29i9H0Pwqe7UxPEGqslbvbw55aSq6ynimnHFhVnYtBp9+euPa0xxtAdoqMmcwtMBLkeOO0p4x1M9epbbGxI5dHEFGIAEGNtMTcfX+z6NIyfIZsDtcIIhCiLIOcavUDjxX//C/4gAt+OQQmG9ynAmyPt/kHmMtJwpSMUQTaXLpw0V5e7twTzA3BUyNiZZalexf4HD0k9z5ZeIrOrzI45QrotTu2MktUIx0Dwv0BcZ95XK48JU2F9B/CWFrrWy0= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5fb7ce6b-0a08-4e6a-9b5a-08dcc578e896 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2024 02:43:46.9524 (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: zJekt30sVGgx7IuMpYRQvkIe3gDc+KGrdeRa0CUEbiOa8ixeZ2QL0sPbaC6uaC6oRIl5PA8FW5buv0cdF4IK/BNMk20DdGZB/X7MZ5QILQQfvEGB0ErJOV9CN8JKtKlG X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYCPR01MB10616 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c index 1bdcfc4d4222e..efc5e86a914ca 100644 --- a/sound/soc/generic/audio-graph-card.c +++ b/sound/soc/generic/audio-graph-card.c @@ -374,10 +374,7 @@ static int __graph_for_each_link(struct simple_util_priv *priv, 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); From patchwork Mon Aug 26 02:43:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13776999 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2022FC5321E for ; Mon, 26 Aug 2024 02:43:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 98B1F10E0B1; Mon, 26 Aug 2024 02:43:57 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="W9yrvr4h"; dkim-atps=neutral Received: from OS0P286CU011.outbound.protection.outlook.com (mail-japanwestazon11010002.outbound.protection.outlook.com [52.101.228.2]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8AB8010E0B1 for ; Mon, 26 Aug 2024 02:43:55 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IXgZPYUCL+I9hv6lgz6utNGtySCcgvsoM6FtZjSKTJlLrZk9Eeg9EXEwUh+MwjYBAq+HDOqOXygAnrTeXKaQqGHDi96UFyz36D8esy/SxjhDkBg00kLuvbES2Zmam44GARo2iSLTGeYg5XKg0BRIH6Ajq0EARX++YWx0+O4fHlZxqZ4QDDXP/t42d3pxLqCp+yQo611kVkMF53JFoU+Oglh+qCCRsZS7MqSwCr3kl+NcJ3jsJnaUNGdos1CNZLcvmIlmZYvhntGt9pGPvkOqpGJEFVs/LzZGIGB3qmvZrZ4mkd4t03wQBG6KDoQasxI3pq7Nc7Kp2WazQJBo26JX7w== 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=3kVrCtqsPUn5FLvrXhReSszV+bKldOLlcpr/zHNtazY=; b=GATpbwYYvLFc9JrsxglKWZlOv3c0NpE6CJiifNNtYfHcr+Z0M/+yV5wf/T/qVWZflBQxy+2P0ixYIt2vYKxBC7Gp0/nq2qgXU1JgPSzoQyV9ybRspUUN8M8i7jCqfN4x2JecIbfhnKw7hgbD9r+z0th9hfU6ea/kzr2jkiZ+aK0sRKlJoZIxrqCOE92nctd/rIJlOtdAMRUolE0Puy3PW8FQsRQKATPUyXtBPTjYhF7M3r4x/zTV87pYylm2Onv2vBRqWT0LDZmOajrDbVp7SYu55XwvvTJqoQAAgpiGGR7CoL2Q/4CO6L/XADREN6vD+fQ+oZJFB8OG7xZSJ2fYNw== 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=3kVrCtqsPUn5FLvrXhReSszV+bKldOLlcpr/zHNtazY=; b=W9yrvr4h8Z6F4MciTHEyg9yUSofvJPg7Fk89iHH4b/nNbZAYunWzDSbwh67tQNx6jyJMg4ozAF3kCY/M3eAZLcYtxAlLvJH0q64Ag9Y/C2mDErUpbrRcUkz5XxALx5ekIHbyfaYT7kJNC+geQ5QLAW4rKVEN2VsrbNWd6JABvkE= 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 TYCPR01MB10616.jpnprd01.prod.outlook.com (2603:1096:400:290::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.24; Mon, 26 Aug 2024 02:43:53 +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.7875.016; Mon, 26 Aug 2024 02:43:53 +0000 Message-ID: <874j78q9zr.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v3 6/9] ASoC: audio-graph-card2: use new of_graph functions User-Agent: Wanderlust/2.15.9 Emacs/29.3 Mule/6.0 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: <87cylwqa12.wl-kuninori.morimoto.gx@renesas.com> References: <87cylwqa12.wl-kuninori.morimoto.gx@renesas.com> Date: Mon, 26 Aug 2024 02:43:52 +0000 X-ClientProxiedBy: TYCP301CA0019.JPNP301.PROD.OUTLOOK.COM (2603:1096:400:381::6) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|TYCPR01MB10616:EE_ X-MS-Office365-Filtering-Correlation-Id: ea6024d8-407f-451d-510b-08dcc578ec4a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|52116014|7416014|376014|366016|38350700014|921020; X-Microsoft-Antispam-Message-Info: Eb46CroRymfAY4rw/nscRc/LFi6gRqdRyqb7KDZ1R18sYzB1jyeDy/vn6dVIOI+1aW6y9Pd/X4ei1MwjvQL9YRZQXlvf+zJGYRygu5vPjGlqSPqHtQiuX6U4NofMTQIqhRP0n94N8i7nY5fYSJ2IYRXFRz0hoQ7O8Wz+TyRRSdaDWOQQPbR5WIYvCSc0VP1jdRZit+g9i4915LlP4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FHVz8gQvdTCEszrZIP3Gb8oabJ/xXjEdgpMjecI5qRcpal4Mz+Xz1KhFrlicyTOiVXH45DLrvwx+h2lD2lgJHRlfF4R5BvzXCKRKHI+1yX944l/4R2im5r3Nmk3Eihhk3SaeskHan1YOCMelVYTJzqg= 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)(1800799024)(52116014)(7416014)(376014)(366016)(38350700014)(921020); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dzr/+vGB7Pe+B6Orh15s6Azt0ubT5e4aroy77ViMiyaQtGP4sfXtnFvDk6qxBgh7cKU+/ZKc6ScNh859YRBFDNbL6JFYzU7nkpBy2xnFsF6GbdFTAWB8VgVWSAWVaUNLr6hxZFXQmcCqZmc6LEoKtI+gMknWOxxmvb1mpsuehdBeLy3z3s0JiRPY7U4wg8A/HnytFlCI5INO7mfiJwhQ7MPs2HyZhcuvuWFUqEproNjWrE+ll9bJM/u6QuNRQTh7E2yO2Pq7d2a6bMVstBsbeB5KU4u1SfDusKwpVAKejBoIoCwIkRVSRwt5YRmp4VYDlibO1QnekYz1Ie03vWGyRAvrWtm9Zre5dRwwdp0RMkbe2Vj1mMdGL/64uwRrhzdewEjwXPUdcEZ3s1SI0pTac/q40vSagjgUtde1hwEGW9AUwPfjnvNIXos4XRnnaLarKl86W3VrOupcASZvOLLdbq9dqLjgWU5twMdC/lTGIwyBc4PY6qcz24DymtzpWbJSdj9RMFP+lZYspwn39zyx2mgC+eFXbsc1yw8odn6Xu/4NTEe6jdXKQ2dn/Vmwa5SCTSF7xgkoof4ABBeQWNCq8DPC+tL00fdSe946hBfQ842Utu6qr4hLfJcJOdztqrNe65Tj//Snx434FR3B3tPbJ0HTmJYkdaUVgHB6/8r88Ozg9aZ4wNnO3DyJadkVgEeIbFRkPBRy9sMxpS6N55kVe7rZqK99l+n6x1fBQ59XVOeYt8QQqzpU80bGmff9OlGCrNYbRWeOx6HUHAqBq9gcaNbjgDgzV4StQKqmJE69C5XXF6h0Ot8xC+8XAJCa0kb90jY//mZNL4fXD3Gqk4L9upZrCTJMaF4HdGk6dnQs+X4fahREV0pPlmapEk9zEmLsuOM0v3o6S9eG7pMMcaq4u1b3Fngbz+hN8TEGRcAqj6GxJXlKNNZzpCerYjx3xqvGmFgLcNTalWwmqOUgIsufbCaalLnWGVf33nBspYXsTgItHObinKAaCYuC97urIkeUeQ5jehJyoqGdVZGAAhD9vRimqjJxQ0UzexSgEKXvf73LmN3GA0/zt0YF7HMswR0BjRha1FmoppfjFq2QJv8upR6u+/D79pm9tMAYkSYzklCz2ijagNai1bTZ8zicSyK9RbgljFfbpMDIVM+B6KnauWpidOv9pYZIMMlTMqY0YTOfd96aeRYuW944HbvkU0jzbxjNrzh71Vh6PmVXVDeg8RjwN3ONcjOQrey41oK/HdY0IQ0PPBV0Vb69ZmPuJ22EwPGqrb4lDAxGKVEN3x9zrvDQgJdfJG8Fr8yNV6V7eZZnnFp1K9Pldt1DcC9jXS0p8HxgLoUJC5DZ8k90S95Jl6JmI/5W9bKbfN3+WYe2476kjCvzb+VF0z45ikJBZ9qrW96t4SgfAVg9Sct/qsOlAcyLBTUEYygQQ7+NAb5MHsNRG7zwA72xhQpZkl/IXQ6+0Ny4P0N81q/Nyswt4zEr82sduTNtOWgdLSrswvWhn+d84nP+7E4+P8rbXRgnBsEGPotxG9rNE50CZUF8egxj3OGdK8pUieJ+84aGj4ePeDxAGH/W3+JujBVkMsz/3E44ajU2KBCHbPHN/2sjyfCSInMFIeGSDJnbe5wxJ8F0l4Q= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: ea6024d8-407f-451d-510b-08dcc578ec4a X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2024 02:43:53.1587 (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: Q9u83NRtkKlSIBJ9lWuPjMu7Sp7LNBzjRI0Ft493PPllm7nWwh9AFvYZX11rYGk8EtZMbWQsp61jPfhlddFLn25DPM6E1EQDFrlJCrfusprZddI40Nmfirhibv3Y9zSu X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYCPR01MB10616 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 | 111 ++++++++++++-------------- 1 file changed, 49 insertions(+), 62 deletions(-) diff --git a/sound/soc/generic/audio-graph-card2.c b/sound/soc/generic/audio-graph-card2.c index 051adb5673972..e5bcccfb49242 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,70 @@ 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_n; + 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 +670,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 +765,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 +775,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 +846,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 +879,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 +1003,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 +1033,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 +1135,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 +1154,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 +1182,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 +1224,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 Mon Aug 26 02:43:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13777000 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0728CC5321E for ; Mon, 26 Aug 2024 02:44:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7ABF710E0B5; Mon, 26 Aug 2024 02:44:00 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="aGhecmSo"; dkim-atps=neutral Received: from OS0P286CU011.outbound.protection.outlook.com (mail-japanwestazon11010041.outbound.protection.outlook.com [52.101.228.41]) by gabe.freedesktop.org (Postfix) with ESMTPS id 57B3A10E0B5 for ; Mon, 26 Aug 2024 02:43:59 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sJcgiq72BhUFzgfdGKrBKPnHsjinxKZGJxDEFODmdFnbElCZqnue0ZDVlGaM4nzGbAdDTLKkYocxSFeENWeekeExtONIostLH4OVRuo6gdZQLVakfQj7Heay6AgCHaq5uqnrVL/LXH8RHACYHX3QN6OZrlsGGukESjY2wKwq/GW/P589wRPLDpnG5sBealp3AQZ4frFT/LL1uMVvNgvTNBH4tsf3+Sy9Kjmqaif/2fH+bPQW89bfjoTXSLo+1JTmiys9PBcLiUDqw/cOQYMduTlqbhDlAjzMPdye5C9M0tsTUh6MZeioiz6Q19eWpRd26HEFxUXcdPNdIHFluzJEVw== 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=etNEO2CKjDxuflhg76PqWMtN6xtK0VP7+RbZ8FtxomyE1vNLZredwJqBWF5fcPQbGeqEqYaymCYR6XHR/wkvytFh0xLrvf7n9aSJ7kexS0lqzyS4k86Pd+3q94kBrcnYjTQOfgFkb9p9kahPoIUCNUu/nqTqmm/wlFco7d7NPfTXqjq+oBOaQ8ddxRnkhbc10lGvtFfn0oHdpymM2jFEPZjx6xpMPr+ovXaZcz9Bd2Xk/Tue3DJUlFB5E5ipYj9NtRxhgYxSa4pnS4VW3fCBPie8uH3F4fiu37amjLh5Ey4pB2+MTW5sBPsDiW4XsYOCLx3KBg4ruGFcPP6tL9JDng== 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=aGhecmSoQ2FOiW+YssCOZwtPFmdmHsQ3fUZgZokVlSC2CU0pCcPersOKPYi9CgpMuKEXCxBexV+uLID7d/WhoPbLHhXisQpgwa4baUhTwe3b5brKCSHaJ32N+tEE8s2L6HsNAPE8j2eUtxSQGl8MiQz8KJYazGrQwrUZbbFfeGw= 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 TYCPR01MB10616.jpnprd01.prod.outlook.com (2603:1096:400:290::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.24; Mon, 26 Aug 2024 02:43:57 +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.7875.016; Mon, 26 Aug 2024 02:43:57 +0000 Message-ID: <8734msq9zn.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v3 7/9] gpu: drm: omapdrm: use new of_graph functions User-Agent: Wanderlust/2.15.9 Emacs/29.3 Mule/6.0 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: <87cylwqa12.wl-kuninori.morimoto.gx@renesas.com> References: <87cylwqa12.wl-kuninori.morimoto.gx@renesas.com> Date: Mon, 26 Aug 2024 02:43:56 +0000 X-ClientProxiedBy: TYCP286CA0313.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:38b::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_|TYCPR01MB10616:EE_ X-MS-Office365-Filtering-Correlation-Id: b8158057-2205-4db9-edef-08dcc578eeb6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|52116014|7416014|376014|366016|38350700014|921020; X-Microsoft-Antispam-Message-Info: hawxA+hCtCvpQftLfjwhcI1rq99QqqxYRQg7umDObC1aJivsHkNqiv/ZIeKMq5suhF52np4EB+YyClaHm94vqGke0itQn0DJwHxBOwZtxNZpdRyV/8JX3nucYS9ffeEwERgFLBJUSCCsJcgv6jPK50k9+DoJqz1e780evFuJT4nD8xFn20i3KPb7E22jJmqzy13fjEcGW6z3UXMNNyLVZoB6nDuZvTTvcQsfhIjje65HLuY5Flr9tsr/xE9MEIR7aMVGYPG6zH4ue/VMIWVLAZ+Sklq3wPOx715VLzTW49Q/C57aPUMA8OA/uar7WjXZMT2zwerGLqoLKZ/iRQqmz8Nza1jJVCVjZhEJ24hb/4KfcYM8eR87xgC6U3JttRXzrVB9kHAXsHgyTskyjjMZJM2M8Tm40Uvm2x3Rh1rzaJqNHk0Jn3BnmLHOVV1M7BnitlFNnYqsa+qqYkbHgKBkcCq/EwRCfZBZKBt1TS67RTK8ti4i+l1IKM5h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040)(1800799024)(52116014)(7416014)(376014)(366016)(38350700014)(921020); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: f8IHcNs0s/Ic9rsHJIE+6GrQMJac/zc6xD1+V6f718/9TCgxvJejeo6rpvcooC3uUqjbF4vcn2QMaZ4htbRfs1sbBFbPj4044vuzeeLG+aHTnqSc6S7gDKtHKh/i5w/bDIFvfUSdi+l2kDm3iVkkTWNS/+VetJP6CSGPsfh2gBsrRmK5ZOut0siOrj4+CBiahReBV34bBxijIMWpvRREvFEilsn5zJhIOpYSOP+13beLyxGmROFPoQojchiC5AQL4qObq2UOx5Z/RZ4Eg05KAF0xAjElKWIA0CMQ63FTZ2R/d2i/uQVQ8bvDUnvhb6Qni6/58dgiOZo77GJTvP2aBSgQkAZDxtFVLhi9F4wD6eZo+Go+SSgen+AFK6EUBbX6uM6oFk9Uf3B3Ykgxm1o2VuRJiwGsqF0ofm2RiaRpK3XbTtG7+WfDphAIQ1ZIANUtEWz3j1vcfc+1o475aqJa8u5UFHXt0D2uTLT0MXsMcqTONJUyxvEk82J1znHFr/IwflyQZCH1H+FoZksCQ71sPn4ceHLC9buiaXhhwddRPzFQmW0jKm1uX+Bfy2CQKFbbZwQeqygG7Z/J14MtUYylze9TUIh5SsWsEeQE60Q97c+yVZusmMvHWY1YBcHKU+ET1phutq9gcu+/SFR1R6xLbD9LbL09PpJJCGMyO9ZXgcdHGLkVN+NuZuZF0VU/nGwMUF0pCoXUgJqlPJGv9HhAcaiWwIlZhLonBgywxPM1Gn7/yQQi1naS1IsIE3TG7Bbk5bUZYARXkeiAASgMKvhJaFa5EH63mDbZB7yqtOgscW+uw33YSFGnxN4CuSuw0NI+tMZb2FmextO3KQCI3tb/lWWG1S7F5oCsbX8EAXRIceD8SxxuVAXjX2XGjZyIhboqkCRYO/oSMLJRJxdsReb3K4+hs6S3vp2QtsE82EGWr+75D4o9h/o5e3Os+SrAIKY8rsbuPd2+716g+ZGH+afawSdUOqo6D3o/Y4zpeOPHFirxG4SCeDrfzanNMedhI/1xaEscyqiQ60El5H0Ar03SFbp+vC2flfmgOJC+LaLwqiU8Jh7yZMKg7j6r1d30x1/LZL3TZ/uL6j++N+FtB/U12FYjm0V8l20F2gBiw6NwLEUoaleTfGdkGZT+7k+6tKy1vbilFdIRHOjxHmQrUS+YQytTnkLfCYu3gzqDaovfNgHBl/yPPW/hc++XNPqo3+PEyyWS2efkEt+nHHBIHZbmtp3Gdw3iKvkLD8hFg2cTA78svv3LppU6mz9iMObOaQHY/Xg635PHGjnicV7TZGfYoZTqgGdNcPp1zjCw4NDhOfcbJ745GROauBY6NcQ4/l/Ui4dYXnfVhjbsnv/Q6MwwtULTQUeAqegi32y6miBSHWFwUX3hNeZ6eQkgG2siS0RR/Aah2bV+NSMBA3ttutozQUBXsCYj/IPDvSD0GtfaYsKM225gXLscDte0d4QR7Uv/xEojU3HYHu70pCuAJeQqEdwBSaYNUWN0teS6mZvLFygFjMIcduidEh6gaOerg1k0obhfeDsbofCdoBitW7Ka5m+5+JZ2mCqvwMqCWEnl+Rvy0RVlsIUbYeScEzAb70I3GP1fuZFgK7dzAawNeMC+M1VDQ7W+FuVMOk30/IpyODQ= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: b8158057-2205-4db9-edef-08dcc578eeb6 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2024 02:43:57.2341 (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: Oxh6BDi6WsxfKEmuwV7komwL/inq2rAJ0+8qoKcxFpsqe4UGTrElunzpvMVkiaAKUVgAc3/JvmfJsX9uJnuYcI+I9mn5p6LlIvV0KQ6Qy8dwSbHhwcPeEv5qx0hhY1jG X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYCPR01MB10616 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 Mon Aug 26 02:44:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13777001 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 824A9C5321E for ; Mon, 26 Aug 2024 02:44:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 031BF10E0C8; Mon, 26 Aug 2024 02:44:06 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="GkKsSZ82"; dkim-atps=neutral Received: from TY3P286CU002.outbound.protection.outlook.com (mail-japaneastazon11010060.outbound.protection.outlook.com [52.101.229.60]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0F8A010E0CA for ; Mon, 26 Aug 2024 02:44:04 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SND8JAg7ED/7ukJCIkuaOleAhYgD/G+vIOoURMU5RaGoOb7QSf1rJRbwiHKSzxWElWAQRjWo+lxQw4HiCMIKvcOagYvE9O6U651vs3Aw2TQeyDQmYoVCagozLK8bCcodJdM3qSidCjCLnc0ToMsgdrJtdbwfH3nlQAtK7pqs30vvBHzFZXHFcblx7bpg26+33sf0Cu3Sb+UCLGFERD/kgHAv95q5WZzhIoAdsAiqnhqFF2pd2OBDuXPTdK7DX1tKMpECZAKwtdOFamdOH4F7YOzchjSqJZPAXxaYMKJU+xTz7jLkLKa8AYqK+ceWJ27pd7CUdYGoSupDsq2Pb2XhDg== 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=nqSzD+TIEwJcbIxbpPutR6QFJxPtDwZqrLqSIzc8yHw=; b=SyUcYnQMgv8YSpr93SO3Wy+B/ujWuah+uaTZu27tEitBFbrEovSZ5D9dq2qzNP0VodhVuf+FF6jtCzqS9wcyg6Knev+f99/+j2A8PhL78mvh7iApasC5e51AevT2akQG1E4mPxGppevm7wHhlkAUwf5clcmYW+H5rHsetRAhXskHelQJYuUwwlFsX5uauWLkviaa3OK4905OmIYiCHNvLJKF4CK66rH4SIGsFvr0MufPEQmCOE5EXyRiFeCowKPOh+zci8f4hvcfrE1VSgox472Q2IyZwYlY1DKtvZrG/07ys7VwZcwx7uWr7BpDmCHcQI6W14Kt/sbwnIZ8vZIotQ== 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=nqSzD+TIEwJcbIxbpPutR6QFJxPtDwZqrLqSIzc8yHw=; b=GkKsSZ82VT15gPSob8vDZyZY4IKSTtkLxS0qZtoDJgHX9r8+ZVdswPHj/qTGMGikfijio2sR0wiv1gqgc4s5hBYIVKYMYKiQx48XMAu+NGWN1vgotpPF2wpLKP8SxGRzMU1Y1qcTTWtbwoctPsFuw7lLIROJaYeE1dBZ5gvT2Xc= 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 TYCPR01MB11547.jpnprd01.prod.outlook.com (2603:1096:400:389::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.24; Mon, 26 Aug 2024 02:44:01 +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.7875.016; Mon, 26 Aug 2024 02:44:01 +0000 Message-ID: <871q2cq9zj.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v3 8/9] fbdev: omapfb: use new of_graph functions User-Agent: Wanderlust/2.15.9 Emacs/29.3 Mule/6.0 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: <87cylwqa12.wl-kuninori.morimoto.gx@renesas.com> References: <87cylwqa12.wl-kuninori.morimoto.gx@renesas.com> Date: Mon, 26 Aug 2024 02:44:01 +0000 X-ClientProxiedBy: TYCP286CA0252.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:456::10) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|TYCPR01MB11547:EE_ X-MS-Office365-Filtering-Correlation-Id: b8372222-0182-4479-3209-08dcc578f136 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|366016|1800799024|7416014|376014|921020|38350700014; X-Microsoft-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sAhPRA2mZIObejhx1Pw5+GBOugPXF0obi6NU0a7IeJOrfJckKn5sBxYN5j6SUHc8jQe/lh/EXptoJE50eZS1FD1JqAdKhIkkRIcLw84jQ2T9GvjQ5hcALnThdUdnhNT5fHkH4jTxTQUzFkLncs2BJ654Mm7gsdpks/bYNXAZZ9ZTuBqBf+hFSGHWzoimO2dShhF2h3cC/AqQNH7sejUHpUzkCYlsLnSW0iJ1lIf8ots97OzB+2SFUe7+rJEqGvdFFCLJHkrNyD/IV+3uxHucF4h/eabw/+kndbahWEyioSG0Zrgt+eszXgI6RDic5ZGaRLwQ3SJmJilyIzce+KNiofyrGds4YJJFZsdwlwOJv9ihzKpPqwKwdbXxk= 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)(52116014)(366016)(1800799024)(7416014)(376014)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: apQxerIzDBN+xcNmxBoVaHWIfAuIIGbhD9Jo6aTc3NcGDLDAUtKwpJJLzVo+DC3f7j0GgdWpdbcl+EisQiG7TJElVmT2RbSSmsS32ax4b1R2nhGbKrR6KbgqpupbdmDqLQscs0XLqB716EgJAUaNTpaBK1+TC2UpMO2vfRfaXdrq8BEtRSXe2ecwJRafBX55jse8lud8INvnNSnx97x7ruUjAUhh9Qy6adC2JS2zecuEPo/5bM/s993Pz/4mmVGSAwrjAj8jsG0z4N5eyYezl74HSMkPUXDCQyIKCB9eAHl1sS2cp2+RnI1L9MlJF+e8UwrIsskAUXRSIMj79QRPe11HkNpRC8OnKuSPrfBj4uMhBcwtwogcPDVcNOnNCL7NpQfwbTdEnwlzrBxyt9/XPSiUTbggqGqwSsOJn1BANhwGkvBoAbdKvq/s1nRynnWYvwlHMKrhd3lzU0jNjV8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LlWbKlSJGswcrmcLNM0yR0cVUaLDJFXlBVwi7B4wVuLnaDd6sZkAp0JAc/kYsa2qQj1dTy6uEijQz2u55kMbffkFJG2WZ4= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: b8372222-0182-4479-3209-08dcc578f136 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2024 02:44:01.4266 (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: hqpvqowL5cMtPEkBiCoLsc128ViUTClvKIu3F36XyaRp9E1/bxhuAEGt1A95pos9JRXqfBHrzqLrre+2mtN2Z4UHGTViceAJVKxZJuwKTvlsgOn/xiE1oyBVtP0x5Gae X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYCPR01MB11547 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 | 9 +-- drivers/video/fbdev/omap2/omapfb/dss/sdi.c | 3 +- include/video/omapfb_dss.h | 8 --- 5 files changed, 9 insertions(+), 80 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..5cab317011eeb 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 @@ -922,7 +923,7 @@ static int dss_init_ports(struct platform_device *pdev) 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 +954,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)) != NULL); if (ret) dss_uninit_ports(pdev); @@ -969,7 +970,7 @@ static void dss_uninit_ports(struct platform_device *pdev) 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 +1001,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)) != NULL); } 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