From patchwork Thu Oct 24 02:20:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13848215 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 D5523D0BB4F for ; Thu, 24 Oct 2024 02:20:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4275F10E887; Thu, 24 Oct 2024 02:20:07 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="YyosNEqZ"; dkim-atps=neutral Received: from TY3P286CU002.outbound.protection.outlook.com (mail-japaneastazon11010006.outbound.protection.outlook.com [52.101.229.6]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3688710E887 for ; Thu, 24 Oct 2024 02:20:05 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FNaHXppTwazAIyGJyhMoCGZ6gvBAXdGGUok2J5Xl+7p4sR+puZ3Zf3iIQkGZisXtebtfdtiEb3CbXOdh7zn6JBhTWaWQKrV8F6rN5dyO9LR5cGwgoNMQhi1Hyel6bJmNsnllV48Z9/+okH0Sf0J7tK3V3V9Zf/8GaXNGf1ZGSlNgafSbI/CVRw8ky9KY07mynI1/2HBXsT8aT5VRfrT35iwpYSlqhKyk1Sg9mLDrIy4vAeeUIa4oKNqARju62Y5nBKBaUKkgOGG4NJCyhe9pbdQ3R1TfYuE38/h0hLUIFgitd53HN/0pz9/AFoqQccFY9RR1kGXut6+nmk5B8/9gCQ== 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=aJLhHsD3BHXJ4wIk58zeTG2N0Bpz71CtBXO3IQhjJ90=; b=NM+Qp/krxE+x+c0+BDWNBKhv/tflstJo1a3Mz6ZjK2dzocPsUEZFx+l3HNcoVi+ZclSPGL4qSwlKCm6wR8S2yVcKDTa1wnWhLvIS2Kr9JNEOLpMr+yta+VHluvmTmwihrAzHJu/1JNhs22Cze1HipwXXeWXjzJA/8CjzE2OJdnPBZjI9uMyTlUQQ4FW6+9b8+dlIWX+hLLrP309aCXTskFunVQ1xaGQlEQn3Zw63FAOOx5RoJ2DYATagikWwrKTFofDkCP/qnivWWTfIK2p/yEdaQy0hszzSG5lHDQ2eQvtyKZmVp5/3U+kZ8ynzakeJ6tv3N0Ji+fhdcaFi2fhlEA== 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=aJLhHsD3BHXJ4wIk58zeTG2N0Bpz71CtBXO3IQhjJ90=; b=YyosNEqZtbdeyeDd9U9gxX73NLpuxOxU4vzr8604hXGBP9V8TLCXlXjE/zMt0+uJEUuh+LmHoRMQgfpO5g0kArdj3zSgpp3JypTxhPPiygTJCo/bBCSkohZJsESrULWNx76XohqYaIkpEQDcGeFhwwkiyWcv9okZlsaP+ouY7p8= 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 OSZPR01MB8629.jpnprd01.prod.outlook.com (2603:1096:604:187::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.17; Thu, 24 Oct 2024 02:20:02 +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.8093.014; Thu, 24 Oct 2024 02:20:02 +0000 Message-ID: <87ldyeb5t9.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v8 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: <87msiub5tt.wl-kuninori.morimoto.gx@renesas.com> References: <87msiub5tt.wl-kuninori.morimoto.gx@renesas.com> Date: Thu, 24 Oct 2024 02:20:02 +0000 X-ClientProxiedBy: TYCP286CA0121.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:2b6::14) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OSZPR01MB8629:EE_ X-MS-Office365-Filtering-Correlation-Id: 92fc2c77-3303-4395-3fe9-08dcf3d25df4 X-LD-Processed: 53d82571-da19-47e4-9cb4-625a166a4a2a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|7416014|376014|52116014|1800799024|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: vi+jD0SOho4J5RBGNuDYbZIfeGIzfJ0t37U4jaWUnn0VKBBCiRozUNrpWROcTX6myAnuX4Doaqe6KTlusCoRtD+dqjn6U2UijuUI3DyIHx1BMcAAblSd3E7wTCxLuLoJXLLBhISKO7ieEWsPDmXcKdD4zbRf3zVDCq29lSZsdRtsmF+uwJh9TEH5CwOdj1jnV9MMldhcXmSXZRYjRNqXEuwrX7SMnfeDD1ITzRD1IVv7CNLe6pECITFNxdzV8penpbxRWyzB2KecZmWRXMQEo2mkzZO4jmNmuQN3rt59NEdXxs7FAf9CIkgFJrT4gnKu5Uxb7Pm2PDPJil2NPuvO96D5HPpm9l7m5LUN3Rt/M2S6vd/qS0/BIHSW7WpQRQy46eqSjrBbe02taXl4doEyMDg27Y6Txn8bUt4NvazMne/5Ssqu5EREWp62k8Z4J++ZKkDooRWrhfr5WTB1mtZkeaPc1ws0eFPDGExkJD7bJXEcGAp0ttUSRTidwgCbdAi7BvH+zOUxrGMQdWyLIc5oh76LxbpM8sHiRS/cMFLUq/y+so54xZ6xGdg/zTjOl5ftnZED3P4nqWtU8FiSSr6zsVESj17Pn2NUlA2BnDA/G/CSPKoTLPUwSlcWV9pXMkB/87u6eZa77jfOkrl/o6yId9QCwDRtolwWeB29mL03BmXcm6CUPfrGgLOSNc4hbd9EG6h60UmZbjTTgfSch6VofXGotcKuv+K7Wq+W3pd+F0TXlF6Oh/GnbzUGyd+ZwwNHmaSQVTHmVT4XoLn50HcgJCbLuBNf1LLteJyZtVjsziJBdtXHcK+gNMoF73DCumNaDkOd1u2xANyqvSkibhWCQ0uZY1zH8SMfwFzYrBFczzhZiecpGptlUyIM1S3WQU2JFPRBkwLhqHgYjwoEfKEQ9XrWAc0FhBHS3+vYWrQvZcwptOBS3R/B/BKzED/cdQiFT6pYvNYz+TMq57Lw/YRX8KULYUXvvizg6RNnQgTkZKijQGcAe5PBAnnwefVAl/KmC6LyKftYG32JR6Jxsk4pAYNmetQplOJMCdqRiLMAMASx0nXFeodjfW3mJvK+cfHMpWPqGSWxDmJH0c9I1G7nZ/xTFiClDMcOjq0saKLCfh5zNCM8ARZ0T+HEEVmaqXlZBQuI/DyT3B5XG6aQAJiPjUuXF8AHtk5rn2fLRnm0aCVJNbnaHVbk+lLR/nCiaBctv8e/5cg2PqAn+7RjQRsjMCm1by9qKAA4OXivypKhODCRfazuyg1ntJXp27Z42qunToTVMupez9+J6LK4Hz4Eus0a+oTWRqBMqoNpE5uMOIDWcUIocTn0i2jodeSPj6xZhH6PmKwQmMDr7Z8IBiOPsGRlCt/6hWWY9AMp7Z8UC++PWNjxgZa+XhllNOsFhKt5 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)(7416014)(376014)(52116014)(1800799024)(366016)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: PEhu155sEaicb+6Hu7qLxSbnZ7te+01RhL7JvvE51aphBOYEYE3sv6Ay5penSh86HarOlvFCSyMidFdssoJ9wsdYF0vgwXRYjMkcNONPPj+NYXw8kG4uVqvIQvTq11jCMbFyqNjfHhNgZhxVyC0Md7x75RXEwYsxOU6sSw7ciE43OJx/PK9FfPqX1gy+49qzv4ebYEAOcn++6XUcT7eN0d5pymOxAPpB1lBp0Xnh4Td0cJdLX2ERwKhPZt7EBK6VyGDduuNCcyLWyEeDh0hgNf7/FsthIM0pOu62hrswo+AMDmlP2UQn2ypS32vg2XbfO/aLOykGPy5SSSC33VgjH9vpjR9lm3gb8EYcDMeOFkwSWHhFlRRO7dswPze1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Z5UwOEplxwsp1Ccl6/RjKy69O4veXwh5GBK3us6YNXFMJLYkTSzZexnaYv8bHS/g1JakzduXvkkejA563er9qlF+6MS1srZKCOpHMI+zdDIeEhIhtCMrnhMmyOlljnPIA0PJz6WNpGYhB1J6z8OhAGPlFRdiUPKGOXGjEtccS0zFT1uu4H9ID7TstISUA8= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 92fc2c77-3303-4395-3fe9-08dcf3d25df4 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 02:20:02.5703 (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: +jN78FxnfGxk+UXubneVyf4uBoDtlWAYO5G8ek9ZUKZK4ULL/Z67qDEZDhS/PA0Eo+8n4ZjOILWbfq5jAmkapoBPhhwqui+vlMG/ub8ExLJJEbBti08gh6ai7PgwHVE7 X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSZPR01MB8629 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_endpoint() - of_graph_get_endpoint_count() - for_each_endpoint_of_node() Here, for_each_endpoint_of_node() 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 very flexible/generic and used from many venders can't know how many ports are used, and used for what, because 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. see below. ports { (A) port@0 { (1) endpoint@0 {...}; (2) endpoint@1 {...}; }; (B) port@1 { (3) endpoint {...}; }; ... }; Generic Sound Card want to handle each connection via "port" base instead of "endpoint" base. But, it is very difficult to handle each "port" via existing for_each_endpoint_of_node(). Because getting each "port" via of_get_parent() from each "endpoint" doesn't work. For example in above case, both (1) (2) endpoint has same "port" (= A). Add "port" base functions. Signed-off-by: Kuninori Morimoto --- drivers/of/property.c | 54 ++++++++++++++++++++++++++++++++++++++++ include/linux/of_graph.h | 28 +++++++++++++++++++++ 2 files changed, 82 insertions(+) diff --git a/drivers/of/property.c b/drivers/of/property.c index 11b922fde7af1..375d81fad8bf8 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -630,6 +630,43 @@ 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_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(const struct device_node *parent, + struct device_node *prev) +{ + if (!parent) + return NULL; + + if (!prev) { + struct device_node *node __free(device_node) = + of_get_child_by_name(parent, "ports"); + + if (node) + parent = node; + + return of_get_child_by_name(parent, "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 +860,23 @@ unsigned int of_graph_get_endpoint_count(const struct device_node *np) } EXPORT_SYMBOL(of_graph_get_endpoint_count); +/** + * of_graph_get_port_count() - get the number of port in a device or ports node + * @np: pointer to the device or ports node + * + * Return: count of port of this device or ports node + */ +unsigned int of_graph_get_port_count(struct device_node *np) +{ + unsigned int num = 0; + + for_each_of_graph_port(np, port) + num++; + + return num; +} +EXPORT_SYMBOL(of_graph_get_port_count); + /** * of_graph_get_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..44518f3583a44 100644 --- a/include/linux/of_graph.h +++ b/include/linux/of_graph.h @@ -11,6 +11,7 @@ #ifndef __LINUX_OF_GRAPH_H #define __LINUX_OF_GRAPH_H +#include #include #include @@ -37,14 +38,29 @@ 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_port - iterate over every port in a device or ports node + * @parent: parent device or ports node containing port + * @child: loop variable pointing to the current port node + * + * When breaking out of the loop, and continue to use the @child, you need to + * use return_ptr(@child) or no_free_ptr(@child) not to call __free() for it. + */ +#define for_each_of_graph_port(parent, child) \ + for (struct device_node *child __free(device_node) = of_graph_get_next_port(parent, NULL);\ + child != NULL; child = of_graph_get_next_port(parent, child)) + #ifdef CONFIG_OF bool of_graph_is_present(const struct device_node *node); int of_graph_parse_endpoint(const struct device_node *node, struct of_endpoint *endpoint); unsigned int of_graph_get_endpoint_count(const struct device_node *np); +unsigned int of_graph_get_port_count(struct device_node *np); 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_port(const 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 +89,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 +107,13 @@ static inline struct device_node *of_graph_get_next_endpoint( return NULL; } +static inline struct device_node *of_graph_get_next_port( + 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 Thu Oct 24 02:20:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13848216 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 E837FD0BB4F for ; Thu, 24 Oct 2024 02:20:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5AC4110E88A; Thu, 24 Oct 2024 02:20:14 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="c+0MdpcZ"; dkim-atps=neutral Received: from TYVP286CU001.outbound.protection.outlook.com (mail-japaneastazon11011010.outbound.protection.outlook.com [52.101.125.10]) by gabe.freedesktop.org (Postfix) with ESMTPS id 660D010E88A for ; Thu, 24 Oct 2024 02:20:12 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FLH+gPsuyi3gmYsB8tbqHZmZtEp9uSJhNe0HZw9yWL6VbTNCbWWeAZVkSwfeQrVdoUDIR0FKMU1EdlpDsy3Y9pjd3B+RXuEiHLfJUNvMpYfyzCNMNRiCxrrXuiDiutjB7ZJkauZ91GPCbe5puO/33NOdam9LhnDEBkZvZ6RBHtXgyKbJo5rbCJInxygnPATpEGmNuKkBk7qeTlrX8XvN9yNGmUXgZUdI9nF2zAllMRqvMg7BXXF9A88KXFoDdizrdwusJV2eAyxfQb6W9byAAQfVYc5U51oj3EryI+av/O2cjw5dMmnXIP8F5U1kRX6LIf0kponle6z78eKONjcLCA== 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=sk6yExsf4kK2Hor4/e63guIBxIqoMy+/fnFJJjd0m0I=; b=YVi2uNt2kOBStOPJdKDSPZguY/ZvIexoN7Wz8vIoz5Fn3u4XepwkFpCq0DwQVgYn6awjFU4WL8sEoOqhnanZRItnvR94oP0CifHiGL/X1gMJzWQRlLwY5rYSmi6KjRcT6MzjzLk8mK+q5fiDsNW8/zazmvzDhYYvN5h9Fn+0akFIn5U8rjVf7zUoq0QFGMxAUxa4LED7lTb9H/cZY12fMfLJvhw0f05lFlyASJXRpXvV8yGNg4Qk/5tB9x/D3ZByTCK+OPgUZ+Um8HUygPt3DNi1cS1jrNiC9jNTwDGrc91fOesZHvoPwvEWqiiqGU+ddzPI512udbLV/qE/v3Jo9w== 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=sk6yExsf4kK2Hor4/e63guIBxIqoMy+/fnFJJjd0m0I=; b=c+0MdpcZKMycC29hLPXu+s/Vew3lKrTYZU3ADpbkDiAe/bsKdawTepsZz+YO397zo2p3rlHTE9hlRo1Vu5KykdOW5sUWK54jTQbtpm6szqrwMF7+lMsV+lHcFxFGzN8bzcKjUtcsZ6WQ+eujGCjvUBNEHYae6WbRwxT6y3S/VdE= 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 OSZPR01MB8629.jpnprd01.prod.outlook.com (2603:1096:604:187::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.17; Thu, 24 Oct 2024 02:20:07 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%5]) with mapi id 15.20.8093.014; Thu, 24 Oct 2024 02:20:07 +0000 Message-ID: <87jzdyb5t5.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v8 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: <87msiub5tt.wl-kuninori.morimoto.gx@renesas.com> References: <87msiub5tt.wl-kuninori.morimoto.gx@renesas.com> Date: Thu, 24 Oct 2024 02:20:06 +0000 X-ClientProxiedBy: TYAPR01CA0176.jpnprd01.prod.outlook.com (2603:1096:404:ba::20) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OSZPR01MB8629:EE_ X-MS-Office365-Filtering-Correlation-Id: 822ff413-ebe8-4f74-016c-08dcf3d2609e X-LD-Processed: 53d82571-da19-47e4-9cb4-625a166a4a2a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|7416014|376014|52116014|1800799024|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: uVWHSjMSMFqMMYzgexO/RKY+TUlu4aexs9ea7HAtvReZX7VdN9cCavcier6LreQuOVtS60UcbovJCKbEXw5JUtrunPjNoDhw5vcQJHl7hu1Gns14t1QWqxxcnuguV1t8PqeeEc452iQqME3QTyJ8SNajSJKMkIYgl8cCIEW3THEuUSBPGW2JqucgqGVD4Xf4FhV0Li5AiiFMFfErd5Z4TaOY2j59yTCWXQ/PRyiyWNGymvpNCZ0fChE3aqedl6W6W86Jjephz4xtoKqW5P271kyCswRbeOxogRjwhEZAZ20frfMPC+l6rflZ80kEwnNMfupIsh2O/rjsMxgU4a3551LejLEmSshr45hWuO5AKsKHGDktbIoanoIe7sUjWTRL/N5JcIM8fL2+bwVT9UwPe6FMa/uoptVyTSqbN+yuY6LC/wrFjHtXgeDNp1nRPPLWCq+4l/Iyvvuaz4PfmW4rrbcRI5ZdE0LDgHATwieDIqcdwHSjojvxW9P6qHsQeFpudUn53VoMoaHdgFgrJtMM/fWe+Bdj8d1jDMs7PJ+mVjWU5hKgqJjF+JYtm1NC6xAXRnfg4GBrSTyWDpVW+O1GZ9Vx7UU9B8oi8B59CnM3JG4qvaf7s/iNcKYF75r1AJHCfzKiLPm2aiNH2NI/PQ27nGMDfdRbDkmODvLBCD0JYmgHGUxvKg1PCVvLqxgZJKIzNltTtEoCL3ToLJMGuGrGjD/eD4WIZIwG4HSQJG1AItBVI0dyRIfcTZ79HZi2/HuBgxcDYN1pUEnzWM/qJLLuMmuxV7BzxgmGXtgQ8tBs/KPdJm8c0l1Uq56Nl+vFA5M6EDXedSeUiM1y0A0ZLbu786YHGAyDKWKQ5laUcrrCcFLaVrcF9mCuJuWgi1B+OniBuKdgA0odtRh8r1aZjXJh11tVZA58LC9Q8FgZgYQXlO9cMSvlcTbtaiWREjKxN3UP8SWWd2Tq/mc9PIv2vAfd3d1DJEPebV+1M1U1CFVs/cHtgqCqKqYuzQzh+YpM5qL0yfPCm/+TOV6DYuSmKEE6ZuSOs54CpIcvL3e72UEJ1oEaBHHt5tYvwFOR6aXy633Lj7IkDjqCPWLDZQoqAqC3P8GneZR4EOP+MpY2lZ730eb1AArlwyY1jkqiWWF2PEll0RoBDzpEuEpZeGFSOLDKQ9uTNxKHpMjercFA3GsbnWKAlmmb0619BEvdYhVUA5BV2oSTl0G8wGIOw+6hDhUajUFj4m3Y37+1s+USpnKNFL0OXoADrMohCvDZjj5CoV51yV0yzoCdPyhlMy/hYtV3CORO46Zf4J+pnej49pd7SFnWiPfrjQPjf4izu1Xjcj12F38Uuy2ALiBykfDNEElmYGZgkltM0sbJhtSME3aQ05iXon/4fINY+ZzLOChlcju9 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)(7416014)(376014)(52116014)(1800799024)(366016)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zFQtYrWmiMiCLXdfUafC7lVYf119X0hhifgfMbFJT96L/C5jQIJw7inBFeuc0W1oDZawjCEQG3BcbI+UMwenMYKIHlUYm6xoSrjXA8toINuy+5QAzHqn/eMYAuwWEJJik0IiJOiX0qiax3ayniMQZ57eVqdl/1GEuj5iznWgeHJ6OTmZ+3dz9y4a20L9Q0mAFw29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3Q+UhPQ/oDzxPfIJkLOh4IppLI4tUitbSewgW4/iFU8zFZkh87nrCafpNMxEljrD39iEs7m5PtsOeT34ZwrLvaW1bNb4cntQdlVrjZtWDooXp8nj5qKh/h6lzhGQ0H90Essoe9eL1BwinqioebNxEzoih6Gf3x4gGIMu06NgIz17cVIg1t2u3qrDA9AuzXs10oI6eAu992bCLrfp7GRbAiQsd6ZJdW90BMZvCpEgraL/5NvL6jq/E2F0i2Lhml8M46iVvMKjzYgN2dVPa7pee2ZzRL3zbravS5VusPdNyYm3yNzOdy25ZyE4aBzukUWxQ/iKq+MSfZ1V6f18ZL3khYeCnimu1Yk6zmEMOIpnn9CA= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 822ff413-ebe8-4f74-016c-08dcf3d2609e X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 02:20:07.0474 (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: VD7k0mkT1XQlcclsPrXJTFhpMS+YqQFujxnbmTDEdoubUncJ3T8SHGE1GZXlEW5uVWAdwI4+ojUbhkxkv5v2GacVWwCTPNj3wgvXaxXpRtFNCxo13AsUfI9hvdBykyQ8 X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSZPR01MB8629 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 1st parameter is "node" (X) or "ports" (Y), not but "port". Below works well, but it will get P0 P0 = of_graph_get_next_endpoint(node, NULL); P0 = of_graph_get_next_endpoint(ports, NULL); In other words, we can't handle P10/P11 directly via of_graph_get_next_endpoint(). There is another non intuitive behavior on of_graph_get_next_endpoint(). In case of if I could get P10 pointer for some way, and if I want to handle port@1 things by loop, I would like use it like below /* * "ep" is now P10, and handle port1 things here, * but we don't know how many endpoints port1 have. * * Because "ep" is non NULL now, we can use port1 * as of_graph_get_next_endpoint(port1, xxx) */ do { /* do something for port1 specific things here */ } while (ep = of_graph_get_next_endpoint(port1, ep)) But it also not worked as I expected. I expect it will be P10 -> P11 -> NULL, but it will be P10 -> P11 -> P2, because of_graph_get_next_endpoint() will fetch "endpoint" beyond the "port". It is not useful for generic driver. To handle endpoint more intuitive, create of_graph_get_next_port_endpoint() of_graph_get_next_port_endpoint(port1, NULL); // P10 of_graph_get_next_port_endpoint(port1, P10); // P11 of_graph_get_next_port_endpoint(port1, P11); // NULL Signed-off-by: Kuninori Morimoto --- drivers/of/property.c | 27 +++++++++++++++++++++++++++ include/linux/of_graph.h | 21 +++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/drivers/of/property.c b/drivers/of/property.c index 375d81fad8bf8..fcc609a17fe35 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -667,6 +667,33 @@ struct device_node *of_graph_get_next_port(const struct device_node *parent, } EXPORT_SYMBOL(of_graph_get_next_port); +/** + * of_graph_get_next_port_endpoint() - get next endpoint node in port. + * If it reached to end of the port, it will return NULL. + * @port: pointer to the target port node + * @prev: previous endpoint node, or NULL to get first + * + * Return: An 'endpoint' node pointer with refcount incremented. Refcount + * of the passed @prev node is decremented. + */ +struct device_node *of_graph_get_next_port_endpoint(const struct device_node *port, + struct device_node *prev) +{ + while (1) { + prev = of_get_next_child(port, prev); + if (!prev) + break; + if (WARN(!of_node_name_eq(prev, "endpoint"), + "non endpoint node is used (%pOF)", prev)) + continue; + + break; + } + + return prev; +} +EXPORT_SYMBOL(of_graph_get_next_port_endpoint); + /** * of_graph_get_next_endpoint() - get next endpoint node * @parent: pointer to the parent device node diff --git a/include/linux/of_graph.h b/include/linux/of_graph.h index 44518f3583a44..a692d9d979a64 100644 --- a/include/linux/of_graph.h +++ b/include/linux/of_graph.h @@ -50,6 +50,18 @@ struct of_endpoint { for (struct device_node *child __free(device_node) = of_graph_get_next_port(parent, NULL);\ child != NULL; child = of_graph_get_next_port(parent, child)) +/** + * for_each_of_graph_port_endpoint - iterate over every endpoint in a port node + * @parent: parent port node + * @child: loop variable pointing to the current endpoint node + * + * When breaking out of the loop, and continue to use the @child, you need to + * use return_ptr(@child) or no_free_ptr(@child) not to call __free() for it. + */ +#define for_each_of_graph_port_endpoint(parent, child) \ + for (struct device_node *child __free(device_node) = of_graph_get_next_port_endpoint(parent, NULL);\ + child != NULL; child = of_graph_get_next_port_endpoint(parent, child)) + #ifdef CONFIG_OF bool of_graph_is_present(const struct device_node *node); int of_graph_parse_endpoint(const struct device_node *node, @@ -61,6 +73,8 @@ struct device_node *of_graph_get_next_endpoint(const struct device_node *parent, struct device_node *previous); struct device_node *of_graph_get_next_port(const 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( @@ -114,6 +128,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 Thu Oct 24 02:20:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13848217 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 0BA0FD0BB4E for ; Thu, 24 Oct 2024 02:20:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 54C8C10E88C; Thu, 24 Oct 2024 02:20:15 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="fO9252pH"; dkim-atps=neutral Received: from TY3P286CU002.outbound.protection.outlook.com (mail-japaneastazon11010026.outbound.protection.outlook.com [52.101.229.26]) by gabe.freedesktop.org (Postfix) with ESMTPS id F3B8F10E88A for ; Thu, 24 Oct 2024 02:20:13 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=elfEu45SRwPIBqcaVXwVUvp8w2O7C7akQWMXLutRe4IFyhY8lgUqZ6UEOKQ/8dpiJb54S4Svf0iVOCGVsoLqtUS65Wb/REqu8lTarWkD5yrnCXOaf31RGjFKvN2U46UupURt5kb9f4TWjS/KOgMO9pa1m7EQyiLMY1Dbku+v2IEPHb4k34KwPTDlgiWt9CYlRB6MfN4acljYOfcft408tdJhQFEaKf4hAw803mFy9ZjnH36vZu6h7/kCK5IrcCAsV8V3UCJSO7ILWy6d6VOgQRzjg5oUgZs88U3BuCBDeOAykj70Gzq2+3LMmIgEmxsoqzhXw9qdBfdAoJRFaESLqA== 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=G5cb4M7eUBjK5KW9qCtDhESRSmafWUFz/dmuWH0OZuA=; b=juV88VCvzD81kVIV1LtRyoH954yYBxJyi6bRJs4f1+ubrsWWgvImHy06D9CAKCK2olwa+Em06E/ehWcxvHjWRIxqdRylqnpyqpsgb7OuqSlZTU8BcEuhwIuqsn5fq+XzbKcl9LGL/h434LS4Sc94mh69PyN/FajsM0nOpO/AJUn6Q/kteFuM12Ciy6imyZXkUHfKg0uHyk308SAogqZyFngmf64qtPWm4MKMKO+TezVhbN0XiJOXrNikzF/Y7ZHGBcd4uNKdIMWvk4UGG2HQDttCVHTQyqxdxJwjQu3p77ngZ0e9hEgokUK1tjNB5BNZHyd8u4O8tdcy2z4VhucQzA== 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=G5cb4M7eUBjK5KW9qCtDhESRSmafWUFz/dmuWH0OZuA=; b=fO9252pHfwqmYYOoF47cmhkWLMPFBrNpVuLqVOSf1zlWrzQKqhe+ISIIdz/M1oWAkrE6Tl5+sKBWpTWEi748gtwby2ip9DpGwz1v2Ooq18is6ilx1eaLii6coiI4x+PnS+KojUdo+6T37fi45gX4PsoApEOGQZK4njXz0LIpdXE= 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 OSZPR01MB8629.jpnprd01.prod.outlook.com (2603:1096:604:187::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.17; Thu, 24 Oct 2024 02:20:12 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%5]) with mapi id 15.20.8093.014; Thu, 24 Oct 2024 02:20:11 +0000 Message-ID: <87iktib5t0.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v8 3/9] of: property: 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: <87msiub5tt.wl-kuninori.morimoto.gx@renesas.com> References: <87msiub5tt.wl-kuninori.morimoto.gx@renesas.com> Date: Thu, 24 Oct 2024 02:20:11 +0000 X-ClientProxiedBy: TYCP301CA0075.JPNP301.PROD.OUTLOOK.COM (2603:1096:405:7d::13) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OSZPR01MB8629:EE_ X-MS-Office365-Filtering-Correlation-Id: ca17f91f-7b42-42c0-fada-08dcf3d2637d X-LD-Processed: 53d82571-da19-47e4-9cb4-625a166a4a2a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|7416014|376014|52116014|1800799024|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: lP0H5HYhbnux8gnOOr9HGa2+ze7ZBEZan5vfTcB61WtY8JMIGhEXYcFdUnPxAc1wAJPK4KJPIfViTTt23WK+4kxltu6bVBcT93C5XL+QguheV2esRZGXPaT1aOebUU54cc8jHYWbcjZs9Qb7uZ0rZvFoiwUorRT7A886KbZjGViUkjLw72CORjSYNLjUQYHplAl1cg3SoNB4Ci7ZTxRok7oxzpzCZHC+XIUyvTz7T2r1S8T5cQfReKT6ZK2tlEAff8OA7qWnJWPExJAgL2BBPW7pQzpfLJ98EpZgHfyzTLBuTn+T5pHN+ORE9VY5nccM7AusBo8WdAoIye0P0WH2fq91hJT0eh4H7tE9uWvRhvejT9fH5keXU76uMOPnQv91TMxogcAaD2UL+f4KRAfViClQ5QF5rDYbPRnIC3Bn75yne2G6CIBoIjnNwN7WZEmnC+M68h6NTzRYA7EiEkKkqN44g8b4pOBQE51A/5nfGj6HsUjvyxCmffIpD7azP/R0jLieNHh5EIjnT3L1eo3AP+AvDljduTVMB8ss6XOGe/ABVz4MEyTSgs9EO8wqmlcGCN2FVfQkZlsNBEM4cV7q5LVpYj3A4W9z0r7HjOkL4IUi5MeB0MM8D+YMz4uoVUX1nUYR0U6/eze10KYEy+Auq1ZpAt59fDBz8IUUcbM/ZXBq/9kZxsaXT53gnKtgLdx4BekZ55F8nSB3YrAAb15hTiVE1mDe5CrmShTDwDxnsY4aIWSCe80O1kwW/SfPlaUniL0K68uhZuF3t2VU1PcJ8e2DO7p3qsqZZivk7N8PfmTQBfj98K1bQ4iRycRaKSfPE0OaEVJyn8VG1emYAg0xE62P6//pHtfIeiJLL6IO2B7NwDYIJLWjm9EpsqyF3O7Tjiuc/0CzOJH2DM8kTs+JRX0iI8vVHKpzDYH8wXJBRMbd5qPrudmf2X5NXr2OTghTlYVYn/n7bBaYUKpBJVgN9cPj2oTKndExw49UCy7D+tOkUjcP95xLYnYSYpiMtQF2jXEowuV7yYDwoensWT8mAgprIrNGub7fSdC9QBazmTJuyOChmnBYDmiFiGSc4V9csZv8oOYh6DzYfoHB0H1DnHQWUJ+nbdrE/2HKQPB1wDZp3YYaR5yrVFsTvYqHFrFSN9EUSagmAKV/XL1EM7FEreDLRMjgFBvdQ3k7zd/YkoG02oC3vHMnnQYhfWdasd50PJo8xd0ugOBqGpP/kLpZ8Xs+yRYQsu5RupEOfbe/4jdkByhJoZeGYSKhypSfgkvN+meE2V7AJa6n/fAWD+NcLtNxmlkN923nS/d+/6vsi35tXTIrQsZOBC1Ja/kD+ARNd/+9h5961QgDL7TqswyLylJhpjjr9T6PkdVpisYECS+67SCA1wIwzGyZrHGCgfEh 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)(7416014)(376014)(52116014)(1800799024)(366016)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: r/HDKUNCKe/pXZY03z67YcirYuZmCcSM/ZhK3qh14QuevfBVSFSEvppj9iEy3eMsnyomxzzFJPMNMdYmw+zkxf/RrxLLl82CQMrG9KQv2eUjia4VUcunphCixUDFOAYS81xzka4PVNBMPW63b0Ktdl+0/TAcqsRxTZzdpRBAejD4WsnROvc3YVe5Dha+NfEHa33xhZG0SFASyLR6N7wf9QGW4sp/wHXTngstGupinm41R8lFaEU12xQvqr5IpHpy4CqX2kVfKGQLuQH0mn9B0dY84kZwh8xs8DnfPRFBMaC8Olcq2kHrK613wTksemOJTovho1hR6Fo9UdF+9dsmJncwpZ7xlN4YuEEg+JtG4wT49V/2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r+QK1qhcEMJLPSbqckNTUVNcWoXwQM+NJExtzWSVj3dmm1S7LjiBXJkzim8bAK6SxpOs+GBYHXFs/wNC61ku8aUrkn6BEQ8+HiClIekRAmlo3MgzMUYIYF6PBgz2OD+WdqNsc2j9xWe/Nn9+mpLYLr9LetCQZ35COqHqQWAwTV5evtvjdZMVjtxUd2lyfm8ephI= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: ca17f91f-7b42-42c0-fada-08dcf3d2637d X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 02:20:11.8695 (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: ZgRNAaPQuN5aFrQ7klKsgBmkVfhJmhmM8RBiSQNJ01rJJD/+OAz4UT5RP1Rrl47SyrI7ekyneo40vTIa1DihnIQdcRkwglgfRq1gaFyQ1WvsiUkycLiHEHBIXgiGfxC1 X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSZPR01MB8629 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 of_graph_get_next_endpoint() can be replaced by using new of_graph_get_next_port(). Signed-off-by: Kuninori Morimoto --- drivers/of/property.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/drivers/of/property.c b/drivers/of/property.c index fcc609a17fe35..94175289b518a 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -717,13 +717,7 @@ struct device_node *of_graph_get_next_endpoint(const struct device_node *parent, * parent port node. */ if (!prev) { - struct device_node *node __free(device_node) = - of_get_child_by_name(parent, "ports"); - - if (node) - parent = node; - - port = of_get_child_by_name(parent, "port"); + port = of_graph_get_next_port(parent, NULL); if (!port) { pr_debug("graph: no port node found in %pOF\n", parent); return NULL; @@ -741,7 +735,7 @@ struct device_node *of_graph_get_next_endpoint(const struct device_node *parent, * getting the next child. If the previous endpoint is NULL this * will return the first child. */ - endpoint = of_get_next_child(port, prev); + endpoint = of_graph_get_next_port_endpoint(port, prev); if (endpoint) { of_node_put(port); return endpoint; @@ -750,11 +744,9 @@ struct device_node *of_graph_get_next_endpoint(const struct device_node *parent, /* No more endpoints under this port, try the next one. */ prev = NULL; - do { - port = of_get_next_child(parent, port); - if (!port) - return NULL; - } while (!of_node_name_eq(port, "port")); + port = of_graph_get_next_port(parent, port); + if (!port) + return NULL; } } EXPORT_SYMBOL(of_graph_get_next_endpoint); From patchwork Thu Oct 24 02:20:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13848218 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 5ACF3D0BB4F for ; Thu, 24 Oct 2024 02:20:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C323910E88D; Thu, 24 Oct 2024 02:20:22 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="nvRHlvDZ"; 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 3522E10E88B for ; Thu, 24 Oct 2024 02:20:21 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sCjCdHJv2aZ4RGVjPd4G/rSnx4ZAB4UsHbX2cVhFNrUegIILwB9mT2AZgqFwvn32kilZY7k/eKG6Ril1zTUTzOte+5jowgOOu++/OZo1iMvweGPD0gLOU8m/d6nxtw9ijk1Oizchffl3Cmy3QXOOK75CgoItJ8jQz7ljlKaJTuESkGetx0amvEbhrw6hlye8E8k/EWVAu94yL9ZdeQrMcfrkt10lhDXWg+3bbEVkMfP4o9CDkbnVdzjCIhMRS32Hgu+ACmRR1seq8NjQIECFQduEI0c9DGGj/AqJBihvYndeZewFtuQ45oO/GP0Z7A/SoAlu1e7IqWhrMNCeeCUgNA== 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=xpSOSQwE6xBjXGtk1rjvHMS/ZUIDZaLCckkMWn2G0zs=; b=okkY5N5Fb5E5GEssJXo5oZEkUSib2a0XNdfu4fchLwjGVzlwUyLvtPWUrH09xN7+nts9H/qi1NcBuu9ayrIkdl2CNyUCHvSWlkomzfI8UxBFtVlBpOxI0veTb0h7eU2dEWTNtYfWWfvASrgzLxwG3ulQ+UTnFNEtcF2q9oJOR3tiicvpL6UOSTsa8RKxu+eUIa9GNsmWioTya0Ira21eloRCe7egvgI18hYQcD7ZI+nVDAqpdCqKZJY+mt3ndSNbGOY7znh8Ag5E+ZortSb/l+brBCmgTcWAph6EC3u/Mvu8wy7iCcPk8dUH3/w9z15t1kkU4+uyzqOo+ZUGyZCwOw== 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=xpSOSQwE6xBjXGtk1rjvHMS/ZUIDZaLCckkMWn2G0zs=; b=nvRHlvDZapu6KyORcXGAlv4X/z5yJzXVxhWE+Jj3KmzYdkJQxNM06AYaVpCaYEzLEgG0HRHUOzhuYwW8iF82f74dZ49I56IR5+j/YBMzhOoO7Xavb9PjfmCGno2oJmfEXYZgtlmJOGrfIzcNUz2sWN+9XMq7s4JTjf+1BPsTxm0= 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 OSZPR01MB8629.jpnprd01.prod.outlook.com (2603:1096:604:187::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.17; Thu, 24 Oct 2024 02:20:16 +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.8093.014; Thu, 24 Oct 2024 02:20:16 +0000 Message-ID: <87h692b5sw.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v8 4/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: <87msiub5tt.wl-kuninori.morimoto.gx@renesas.com> References: <87msiub5tt.wl-kuninori.morimoto.gx@renesas.com> Date: Thu, 24 Oct 2024 02:20:15 +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_|OSZPR01MB8629:EE_ X-MS-Office365-Filtering-Correlation-Id: da1b45ec-33e2-4bb9-6757-08dcf3d2661e X-LD-Processed: 53d82571-da19-47e4-9cb4-625a166a4a2a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|7416014|376014|52116014|1800799024|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: n5Q7eUZHUPAvlYrnk2ZkPuFNFun8pg5mnm0m0Cx7e5ty9HSM3aiJQyx5lNZmp6ekDohxdDElyoFFYAwnTTxEbssSNSiIcAKUEBj0CxV2jjU3damsm2cXERXiqahMhaZifKr85OPcUQ5FIjo+NIX2zXg/HLOVv5MVukSPbAuzA+6hNRgDTKA2bXfQrBW7KS9fBjMoWAzPdT1lk/c+K5zF+i9zPyREFWCPgHvQESTj1FvPRc+9CAgdIZc5F8GkFx+KjWZr0NV9EHiZIH4H8kC7XaXt61DXxmFpWJaQjM/jPFjwI1bpHEyJDXOEBcp0UeIJlKmlYLJMamvy88gkva2I0oia3cR+q1PEUjfqZ7BeO+ok7fB2tXsOKr3/TQLeZCsCZaUyCVvYaNPjssqlSgj112JX6Lv36YnQ0pBvunqrvIqF+cyenCWgzJHHoiDi6fUs3WqPFjZ6AInZs647Tj1t2jkOzXjUA5Xsn8J/yob+z7KjswjilRGsUCHV+uHNxWzalHVf1E8Jh4+H0Nl+XzyJBZgaUr9b4hazn4/vmTlMxLYK7+pnpcn//SSC3vUlMcvexFlu7EMegsBREKVvYLiJhItrxq+z47YMfzYzJ9HRLgQtTqF1KNNr4/HNV9xcUynjWGdQ/Kp890MrNKqOGtvjm3nuYWag7vAA+U25UNcZaqd7dLGJl3QeE8AJJiFSPTCY5ZKResH0nXwQeDdumN3urlErG/DRGgVIsjxzXlWpq3RxxVpLItv8EvvAgrHvPLUpw8DGzloRNbesMxIstV90A5nelBYORZ+zUUXE28ZgMnvakNlk9uUyTAjn/Ru6LGhOhW0IhiYlznTEyAjM/8lUbz6u+IstwME74FdvqqGshrjEtMkNOLfTHTk68ecSVtlGTbgFuzzHmGdT9bGJs9wn9SyXNReH/704wQ+etDgK3Lx321q/Lxbq4Gnz2R4a1MwCftGDd0Vfh9yJy28VwBaECzDH8WyawLaVUW8JVF4bOa7N4AYTGWqXithjA6A472zxYfBzmQXbRUtHcrdsHfhZrckdfSyrkF5uvAK4FTpcxDElG9G1tW+ecCgY9JgdD+012m+6XtXtSlxlgGGAxYRcvzb/vocc+Pe0wvWdncR/azC5vWW/Z3YteSvuapkSQSM5bWZ8UKisBj2Ixs8aAytCviakUCgm2+xKZFokIdxsuITAPfUlpRBOdrJqwg5O7yYC3ongAXyDbHhCWaZ3nETzYcc7F33w4IHfoInYnpTLm4nIwNmbnP5OBnKOErQOyCRLmFARObSOkZIF/klEiFMgLSR7xF/uQliOIpkIglc0vLc3YZtAdrynLJijrjJHbKPqwzMH0xKAD1HwR+UrGOo0R3lz1HKayx+nFIiw21xdksj0hf3xAG2u22Z8uqiMcBQg 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)(7416014)(376014)(52116014)(1800799024)(366016)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lpMzYvJD4W1O2bTsw7GkJyKfQTa00gu5YgKGEl4IqGjjf3mQogqzKKfH+YkQ9I5ZeIbTXZiFQxwJWIY2sO8emnUeg41h47lNoWMbUf839Y4r/+lCfTPQZOLCi4p2Oq0cmllepDPqPKIONqc/d/uJaGDkkhkd8/2CSA7vvyzRudIRHJH3nw9eewoFE43OVK3Mfw5vdtfpefvNTgaAsqQYA+MBOpasgWhsxXhB8a7R72IkxcGXkZvStx5Cq1sblir3aZR6fuxaAyoOT7Rfvw8tmMloCscyz3bo1eWPN3WGhx0U1NXhQVTEef58GUwZqOJTZRlVwSYnvN1XNk+gptAEgmP+Xj9w9Y2P4grE+v5uZqdnJOMoiG8F4klIFsH0Tg9VEzxZzk76mJ1/R+1M61LF89S9oMAZr5v39Qt0hP+b9/Jm3/H28IktM227ZVde3PhMKyFHWn5FjE1NiZRYsxnGHwacr9nSXQDCqb1ZY2Bf4T9QW1cw+RDH0ZNJeij3b/fIuV0XnKg3WLPvxxIa/36jZDFyb6RNZvcMCkYOd2FyJHPt5lSy9UcFb8OxYqSCX9dGPEVDbome0q4quTX+gsta9X0ykejWDnFEHYT7b+aS+85wzwgw8MPl3HVhxFI/qZ4de6HRgdp42HqAQ/fun9W/oSzRmCoNnz5oQoO8qIjG2T5j6B9VC6YqheSmQjjrpHtqpDVZG+MUsk5XGKNzurw2URjG3B2FZv9HuokcySrHhUUHAXgc53e8kRmekIu+93x3TMRsc55fIB6MEEt1d6qMRDEAFUg9mED9y2rPehXn70p4g2IGAhpVpEVXmM6gdrRewA6XfGBT9TOv/zn1gfFctP9PjafTkkjp1G+J906zAqfBYLa0I+w05iAfgVhUVljHMqJGVuoClsfxVZe1qAYXpvINvCpZIjkSFc40nwefNpbfU/z/FCyJdQAHdXzc/nG5ntQwxCUYfGoslwq4SfPyNIQAparMYa8FiIJFPLhmbhXNsPMu6nAn4uIITi15Oza94JfGoKE0x//xvRAPyOX0O8ykqJIEPIKsBof0082AdpnB0FKJE+FGRJRqOX4B3xGAgYiKuMMliNxCTFmDRm9lBCdjYXzMBoLZ2OKgE8+QNnss5NLi8MOFLoqyKFOxLQTSBjRyFCVtfHKRcf/uHqpATGK6tgq72UMYzK4+ticM3deMT/C59m8lbLQ+y7KA5+3j16uacWTwoj4tG7FHn72b3BOqMSwLsrFAYQ8wdYzoYkRSXwroGsiQZofBPTmxGBqdPHbh9U+D7lY3WGv9x2Z/FxMLVOdKMUl8CcoNNSiy4hetzYQYBdwCYvFy7X9ARAr+cBjfQ67TLiUY6+RgpyOTImoqDy3qVxRthBO6/cftVa9SoX1LkWGnj0CvsKmn4a61y9y5zGP/pUdQ0dsJQ5LNv4u5FMA56UVTGyLpZv7VwsF3BuGrgZJVdLvPANZHM3aTFEiZML/2w7y0Shv7JawvrFsktsLVn0GHrzOJ2omzwZd+aFwQQ36Ra8C5hMmtgc+qKw81CgLwzk9Hc8csTp3/AZnPuk4gfTgr//KQfnY3CWsXPhA4DKUSwYfUYwMDltJbVOTvSo4urBqcm18mO6OOPcaL1zfXjsLC3SMZ5mIo6gE= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: da1b45ec-33e2-4bb9-6757-08dcf3d2661e X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 02:20:16.2721 (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: 0Wj9WOi3Qbtv1GnHttSpJ2Faro7I9CsRJ16iROr11m6nK3q7N+8gp2ifW/lKAqIW2O8Tj8FA9zwligdk9MN1ECVbT/jYTlodOanrAbq5XsQQAQHHTLGLbzdtLgC2QpVV X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSZPR01MB8629 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 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/soc/generic/test-component.c b/sound/soc/generic/test-component.c index 407288055741a..85ce3ebeec056 100644 --- a/sound/soc/generic/test-component.c +++ b/sound/soc/generic/test-component.c @@ -521,7 +521,6 @@ static int test_driver_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct device_node *node = dev->of_node; - struct device_node *ep; const struct test_adata *adata = of_device_get_match_data(&pdev->dev); struct snd_soc_component_driver *cdriv; struct snd_soc_dai_driver *ddriv; @@ -591,7 +590,7 @@ static int test_driver_probe(struct platform_device *pdev) } i = 0; - for_each_endpoint_of_node(node, ep) { + for_each_of_graph_port(node, port) { snprintf(dname[i].name, TEST_NAME_LEN, "%s.%d", node->name, i); ddriv[i].name = dname[i].name; From patchwork Thu Oct 24 02:20:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13848219 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 78D78D0BB4E for ; Thu, 24 Oct 2024 02:20:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D16D610E889; Thu, 24 Oct 2024 02:20:25 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="LPIbXswe"; dkim-atps=neutral Received: from TYVP286CU001.outbound.protection.outlook.com (mail-japaneastazon11011060.outbound.protection.outlook.com [52.101.125.60]) by gabe.freedesktop.org (Postfix) with ESMTPS id 54D6A10E88E for ; Thu, 24 Oct 2024 02:20:24 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Kjq1NsJRS5SoNyvBCoqbv6zSx70dMtSNhsDfoXQ+v+dyXY1N3hvpkSs8aQdu5K0z+c60zDTQlf0K6o1NAa4QJAR8t3WbhM7ZxQU5D1a6U4BqO0hKwjViYTV0atXqQhcMzS/8OyVdgtlIg2BqrwHSWdg48X6zuAPNntRbnmqzqUNa7pn5/bx74Z1fSE558v5AR32Lli4hmF6DCWwXQudQ80eLik0E/kD19j1eVdyyJ8i5/IPjFSgt4EBVWOC3eFMZc+/OZOI1gadVKLreYdqjTsp8wkIOOTEjmm0cHoYQwvexVmIlakFQpcR2z4DgEBGnrixcAi+pUbAJdZpxViM1MA== 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=XSnStjZ8WKcPDrgOADlCc4YL8xML+60DZSrHpdifn6I=; b=mkZIm8hEcTAgAimbCmjM3pBOCe8032FFS2ulX3o+ftvHYxXbZW0qcEXaYhWVLNLFXMA97yvpfbw0AkcHXJPtK4VNnQNWKUngDQlWigbQbWp4z1e55MzAaCLJvirGTeS6eEaqe/fOjidSoCLllZ/mdwDZ6PDh5t1LIXn19EGVzBqYnbpj8gykL5rudIlEi4fq2Khd2GgTF7MboxaFPkfzNCh39VY89PyVJaR4whEqxeBr7vTLJcKoujN4P5mRlD2Se8C5AtRrsF+CYSeDqnORiSwYchJFyJbdYfixL25NiO5Qi1I8/3pBKVBWFUQCDbNflboeM6EymfTrKt5q6YKLMA== 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=XSnStjZ8WKcPDrgOADlCc4YL8xML+60DZSrHpdifn6I=; b=LPIbXsweiEuF1BKE1lthqFuX0Nz6+UQFtiesHNBSidtUjKX5/q39LCXAZ5Bu3lEzzx6SGxNlWZhq9RQeY6tmHf4NnWT0UEO501Q6gJAFRtREYFUfmcDTnlWVuOtx30y/p5hMR/zy8NJoCBRTn26uPeNM0d6SWJed5tNHF0HQ5uQ= 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 OSZPR01MB8629.jpnprd01.prod.outlook.com (2603:1096:604:187::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.17; Thu, 24 Oct 2024 02:20:21 +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.8093.014; Thu, 24 Oct 2024 02:20:21 +0000 Message-ID: <87fromb5sr.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v8 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: <87msiub5tt.wl-kuninori.morimoto.gx@renesas.com> References: <87msiub5tt.wl-kuninori.morimoto.gx@renesas.com> Date: Thu, 24 Oct 2024 02:20:20 +0000 X-ClientProxiedBy: TYCP301CA0049.JPNP301.PROD.OUTLOOK.COM (2603:1096:400:384::13) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OSZPR01MB8629:EE_ X-MS-Office365-Filtering-Correlation-Id: defb9b9b-f855-4628-7838-08dcf3d26927 X-LD-Processed: 53d82571-da19-47e4-9cb4-625a166a4a2a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|7416014|376014|52116014|1800799024|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: VKsILg2cYcLAncm9DRPzJd36sIKLiKbzsBGSyVCL6apFPmFQSwu4Wo1cG7C/07aKRrc+ffXKK1OiOBO7+H7b/DGY80fVhaA+ZDeI9ySsEkW6ObrrpE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NHYNlaGOe8qXZGLmnBMkUfvfa+zToDkr2TDWO6K72islyTwKjz6o8L++5wZYj87U0OoCOxtWB/sR4qO8CafKbi8fnoSG29hajZRkMCtcsUY50mnrz/Tbct60U5CI8wt9ze3y3LXfimAApeihua6R91EYqfjVbEMaBeKh7gqsxBj6uColguNJIG/Ks2TgHlCdzsBpPGpt9X5QnMWCoCTwy 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)(7416014)(376014)(52116014)(1800799024)(366016)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hpAg+s7t1YmfqPAMmFc93VjY2gU/M0b+n+gNv16IfT4k8cHtS5S8kByv44qzB5lG0YnA2+DU0VjuSXIwLvk1mzAYOrpvtAF3rZXtQ2Ux+mXwRdhrHYHig8d78N4Zey+Zs3xYjCacCgzc5jHS7c0X+W1FRR0Uba8UmmfRqMQ42fUea0YLspELdTG+KUqIJCWYyaYbtuHXYOMvow+Intge45Q6mjvj4Y1hjqM+/KWJcDiLY0t8AVMoH04aNnrxMddoSZ7/7Fe9RMrMmo2p9u8TYauvIeTar/ooJE/vFt1NqTm3R7XSLonCv1Ug8dj0Q8pjJi6pVL5Y9TuC7SLGqaHEhVuQf6+a9WgMJa+msgnLgmY+TYqODaziXE8lGhX0xcU4+YwhpcXgus6SFWBLH5d8Vf+o8LnYaijAc5x2reL70DHtBfHkDRXVHv4RrGI0EzXn8ox1PVmBwHq++qDt5gFfigs4kDeYcYPaUxNOtPy7mYBodsMZWcBJjNbyHXDn4CBglCdmCqj5h8p9i8r8SwpX8aJ9tZSpxsbCRMpTpf5/ntoQf3moVrxRy2L01helEFUF0+MCZPZMYULTBnOj4f4MYDXwVQpy/1wS5Nrs8Eoel6m/4NZwRXLy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4628-7838-08dcf3d26927 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 02:20:21.3888 (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: PrR2Z9UBdVMEPYzEzmouJEY8AKHaKxVQkbKqZEyBs66SX/p2/LvyNvzao/skk2HE54bTTfsaOI1kLCuHxsZ/xlfATX1M0qbLHybinxhxbzz+7a3cXmUG888SBiBYUnHR X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSZPR01MB8629 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c index 4b384475b9726..7655425a3deb1 100644 --- a/sound/soc/generic/audio-graph-card.c +++ b/sound/soc/generic/audio-graph-card.c @@ -372,7 +372,7 @@ static int __graph_for_each_link(struct simple_util_priv *priv, cpu_port = it.node; /* loop for all CPU endpoint */ - for_each_child_of_node_scoped(cpu_port, cpu_ep) { + for_each_of_graph_port_endpoint(cpu_port, cpu_ep) { /* get codec */ codec_ep = of_graph_get_remote_endpoint(cpu_ep); codec_port = ep_to_port(codec_ep); From patchwork Thu Oct 24 02:20:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13848220 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 752BCD0BB4E for ; Thu, 24 Oct 2024 02:20:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E9E2910E88E; Thu, 24 Oct 2024 02:20:31 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="Ph0tH64X"; dkim-atps=neutral Received: from OS0P286CU011.outbound.protection.outlook.com (mail-japanwestazon11010006.outbound.protection.outlook.com [52.101.228.6]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3D3DA10E88E for ; Thu, 24 Oct 2024 02:20:31 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=x9io8eVfK6HIEcBAgyqrmOsOr2gBYWaQThUs4bB9Jl0fzL3yQ627SpD+yhx6H/Ra2Dp3MtgIgpaKddhdyJEUcDPJU3U3EJxcknOere4ILri70/Lns/1VAClsgIE9OWC8kdIid2aBRV2x7CeqYAtfnW4KMoRVyGtF7+oa6WltkeOsx4+04+WFWnoIq41LUM7K1qLiajeiKUvW96gE8813xKimPN0juw6yqnodyPJtXarlcV7OuJaZoFxA1UO801vD1OF7PpVq6s5qVk/iozwtbXrMe+h/8KBm2qfhqQwFj0/M6FpB8eAw8peUgQV+yV/kUcQr9kao8C6pLJlq8HvK8w== 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=QrWMpjt2fcUpvD0bCD5iddrf019/xghmFRiFAtCDjEM=; b=dwCAX3QOdNpUXYTPitUmRNsZhsUFoRV55BN4J/D4BHdwcKimMaVZF0ij1VPUXyZFLnisQTcRzPvusK4IddRA7PCjOKp6exU+A6qcYjMNkyCA68JfCEnUqTfUhKPvrBD20lewLpjquEGFnY6Q51T9h5aQEFE6BAyYnrMoIvZMe7KrshplTGIpzHIsDqIuRpzL7Fbc27pgnNPQyUv9iCt30Ja2QFcytA5XD914b8K9PihFFdxJ/EfBSJUJKifOnVp6qN36EVrDKurcaGuIwDmFdbwxS0tr/+JLv0og8eKSBKPiEe8mT4Kg0K6AeAGqD/iVdfn3hi0pVZFlHQhF+d0isw== 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=QrWMpjt2fcUpvD0bCD5iddrf019/xghmFRiFAtCDjEM=; b=Ph0tH64X+1kuCN3QdqAS5m9kI0/tPFGkxBl8pyb4pDRHSSXdcZldchRkZwgBcAjbivTVOnKS2x4S2MxaUEHLRNwlCWvir17jtlxgRAcIOIFEh0K8IZiatGS8xb7cDO90UEVxw0Esx7YM7SvNvcdyDzT7NtOnaX5v9n61Q9TERb4= 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 OSZPR01MB8629.jpnprd01.prod.outlook.com (2603:1096:604:187::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.17; Thu, 24 Oct 2024 02:20:26 +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.8093.014; Thu, 24 Oct 2024 02:20:26 +0000 Message-ID: <87ed46b5sm.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v8 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: <87msiub5tt.wl-kuninori.morimoto.gx@renesas.com> References: <87msiub5tt.wl-kuninori.morimoto.gx@renesas.com> Date: Thu, 24 Oct 2024 02:20:25 +0000 X-ClientProxiedBy: TYAPR01CA0101.jpnprd01.prod.outlook.com (2603:1096:404:2a::17) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OSZPR01MB8629:EE_ X-MS-Office365-Filtering-Correlation-Id: 627aa038-750a-40a8-2892-08dcf3d26c17 X-LD-Processed: 53d82571-da19-47e4-9cb4-625a166a4a2a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|7416014|376014|52116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5NdKJCfqvNsaO+8AiJbalgz7LTuAHSyvY/e3ZcVh9VO07tfBp8WQqDXvfr5JEBpZ43JDR1BsQDzkLi9I8xBi99uFmPlnpY4OvGqv8oVcdO1FYdSYnnd2dd84tDsVd2PYDnjTlTgAfIlLzZiccvwTjZCLIM49r9gV3N2DjsbdNVOa12mdTCIhFaNjAaJ++5B+mmMiv2Wdg5lzP87Z2+DSzTCdVpjlq7wzKjak+7gk7XDTbJe6y0sfJoDySuy7F3FNbq34sBYn831lYP1zGlXsvTwNT1wsCKSj32wJUpuN93/9K11z17Mm+vbhnruHP6wEv3HmDdX19jchbKhmB91Y+3ABjdo2PY/USdG1zUe 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)(7416014)(376014)(52116014)(1800799024)(366016)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HfWQQ66daHTzZnDDN62ptN/jbixJnT5+Q4X0irw0tuv+D0r3RM5henG7chP2NJDJJ8r1on2iBLXhyE6dsx7VrUIlDgxAWuBZ6e0VPWnaJNVoYtLfm34JZ53S2TWBsJamGPdslNWNemKtt87NcTtBKlVoFSTdGNdRuvwk6jFZfxqqfx0Gw6S7B58dBmXKXyqnhqHMVITPMY4PXqsOoidpxxAdMQyjD1ospQhHnWf7BZf0DnqlPRKuiKGDbwbErrsltWRFQFQTIEcslzY3PYSeb+xti0ARP6u8kNBCfE9cIJDyWh+jqg1DHNDfASNk39w2tUwwxL+xg/k53GNYXt7VGAsswOL/ffDK4jr3m8H70KrrR8LhkL6uKmWpaD+lWeh3Z+uOMGskad4gns4jPjmCzM8SXV6tsTtVsl8jxGfA09LPIX092MG5lCRx+CiGpVZh//Bgssv4E5+lztKh0IIwXxqjcZT37CvTITeh+B87Nxz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vgVSUOqB7aKzGU7A7SReCcg6annE6WRGTVIbeib18E0eB3BIweJPElYPC7LSW4aQPGbbwM= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 627aa038-750a-40a8-2892-08dcf3d26c17 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 02:20:26.3323 (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: 3bPTPqoVjDOeZPZ1elVDcfBFX9+HnSdpFmC8fYbQtUE+pwZi4Ey3gNu0uMu++639itziDF0Ef8ctxfR9L/8bXR3norhZh06uL4k6qDGnXR3zCRLqPRj9pOq9NR+yjhSu X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSZPR01MB8629 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 | 104 ++++++++++++-------------- 1 file changed, 48 insertions(+), 56 deletions(-) diff --git a/sound/soc/generic/audio-graph-card2.c b/sound/soc/generic/audio-graph-card2.c index 4ad3d1b0714f6..3605a6b2c7820 100644 --- a/sound/soc/generic/audio-graph-card2.c +++ b/sound/soc/generic/audio-graph-card2.c @@ -234,8 +234,6 @@ enum graph_type { #define GRAPH_NODENAME_DPCM "dpcm" #define GRAPH_NODENAME_C2C "codec2codec" -#define port_to_endpoint(port) of_get_child_by_name(port, "endpoint") - #define ep_to_port(ep) of_get_parent(ep) static struct device_node *port_to_ports(struct device_node *port) { @@ -351,14 +349,9 @@ static struct device_node *graph_get_next_multi_ep(struct device_node **port) * port@1 { rep1 }; * }; */ - do { - *port = of_get_next_child(ports, *port); - if (!*port) - break; - } while (!of_node_name_eq(*port, "port")); - + *port = of_graph_get_next_port(ports, *port); if (*port) { - ep = port_to_endpoint(*port); + ep = of_graph_get_next_port_endpoint(*port, NULL); rep = of_graph_get_remote_endpoint(ep); } @@ -530,67 +523,66 @@ static int graph_parse_node_multi_nm(struct snd_soc_dai_link *dai_link, * }; * }; */ - struct device_node *mcpu_ep = port_to_endpoint(mcpu_port); - struct device_node *mcpu_ep_n = mcpu_ep; - struct device_node *mcpu_port_top = of_get_next_child(port_to_ports(mcpu_port), NULL); - struct device_node *mcpu_ep_top = port_to_endpoint(mcpu_port_top); + struct device_node *mcpu_ep = of_graph_get_next_port_endpoint(mcpu_port, NULL); + struct device_node *mcpu_ports = port_to_ports(mcpu_port); + struct device_node *mcpu_port_top = of_graph_get_next_port(mcpu_ports, NULL); + struct device_node *mcpu_ep_top = of_graph_get_next_port_endpoint(mcpu_port_top, NULL); struct device_node *mcodec_ep_top = of_graph_get_remote_endpoint(mcpu_ep_top); struct device_node *mcodec_port_top = ep_to_port(mcodec_ep_top); struct device_node *mcodec_ports = port_to_ports(mcodec_port_top); int nm_max = max(dai_link->num_cpus, dai_link->num_codecs); - int ret = -EINVAL; + int ret = 0; - if (cpu_idx > dai_link->num_cpus) + if (cpu_idx > dai_link->num_cpus) { + ret = -EINVAL; goto mcpu_err; + } - while (1) { + for_each_of_graph_port_endpoint(mcpu_port, mcpu_ep_n) { struct device_node *mcodec_ep_n; - struct device_node *mcodec_port_i; struct device_node *mcodec_port; int codec_idx; + /* ignore 1st ep which is for element */ + if (mcpu_ep_n == mcpu_ep) + continue; + if (*nm_idx > nm_max) break; - mcpu_ep_n = of_get_next_child(mcpu_port, mcpu_ep_n); - if (!mcpu_ep_n) { - ret = 0; - break; - } - mcodec_ep_n = of_graph_get_remote_endpoint(mcpu_ep_n); mcodec_port = ep_to_port(mcodec_ep_n); - if (mcodec_ports != port_to_ports(mcodec_port)) + if (mcodec_ports != port_to_ports(mcodec_port)) { + ret = -EINVAL; goto mcpu_err; + } codec_idx = 0; - mcodec_port_i = of_get_next_child(mcodec_ports, NULL); - while (1) { - if (codec_idx > dai_link->num_codecs) - goto mcodec_err; - - mcodec_port_i = of_get_next_child(mcodec_ports, mcodec_port_i); + ret = -EINVAL; + for_each_of_graph_port(mcodec_ports, mcodec_port_i) { - if (!mcodec_port_i) - goto mcodec_err; + /* ignore 1st port which is for pair connection */ + if (mcodec_port_top == mcodec_port_i) + continue; - if (mcodec_port_i == mcodec_port) + if (codec_idx > dai_link->num_codecs) break; + if (mcodec_port_i == mcodec_port) { + dai_link->ch_maps[*nm_idx].cpu = cpu_idx; + dai_link->ch_maps[*nm_idx].codec = codec_idx; + + (*nm_idx)++; + ret = 0; + break; + } codec_idx++; } - - dai_link->ch_maps[*nm_idx].cpu = cpu_idx; - dai_link->ch_maps[*nm_idx].codec = codec_idx; - - (*nm_idx)++; - - of_node_put(mcodec_port_i); -mcodec_err: of_node_put(mcodec_port); - of_node_put(mcpu_ep_n); of_node_put(mcodec_ep_n); + if (ret < 0) + break; } mcpu_err: of_node_put(mcpu_ep); @@ -674,7 +666,7 @@ static int graph_parse_node_single(struct simple_util_priv *priv, struct device_node *port, struct link_info *li, int is_cpu) { - struct device_node *ep = port_to_endpoint(port); + struct device_node *ep = of_graph_get_next_port_endpoint(port, NULL); int ret = __graph_parse_node(priv, gtype, ep, li, is_cpu, 0); of_node_put(ep); @@ -769,7 +761,7 @@ static void graph_link_init(struct simple_util_priv *priv, of_node_put(port_cpu); port_cpu = ep_to_port(ep_cpu); } else { - ep_cpu = port_to_endpoint(port_cpu); + ep_cpu = of_graph_get_next_port_endpoint(port_cpu, NULL); } ports_cpu = port_to_ports(port_cpu); @@ -779,7 +771,7 @@ static void graph_link_init(struct simple_util_priv *priv, of_node_put(port_cpu); port_codec = ep_to_port(ep_codec); } else { - ep_codec = port_to_endpoint(port_codec); + ep_codec = of_graph_get_next_port_endpoint(port_codec, NULL); } ports_codec = port_to_ports(port_codec); @@ -850,7 +842,7 @@ int audio_graph2_link_normal(struct simple_util_priv *priv, struct link_info *li) { struct device_node *cpu_port = lnk; - struct device_node *cpu_ep = port_to_endpoint(cpu_port); + struct device_node *cpu_ep = of_graph_get_next_port_endpoint(cpu_port, NULL); struct device_node *codec_port = of_graph_get_remote_port(cpu_ep); int ret; @@ -883,7 +875,7 @@ int audio_graph2_link_dpcm(struct simple_util_priv *priv, struct device_node *lnk, struct link_info *li) { - struct device_node *ep = port_to_endpoint(lnk); + struct device_node *ep = of_graph_get_next_port_endpoint(lnk, NULL); struct device_node *rep = of_graph_get_remote_endpoint(ep); struct device_node *cpu_port = NULL; struct device_node *codec_port = NULL; @@ -1007,7 +999,7 @@ int audio_graph2_link_c2c(struct simple_util_priv *priv, of_node_get(lnk); port0 = lnk; ports = port_to_ports(port0); - port1 = of_get_next_child(ports, lnk); + port1 = of_graph_get_next_port(ports, port0); /* * Card2 can use original Codec2Codec settings if DT has. @@ -1037,8 +1029,8 @@ int audio_graph2_link_c2c(struct simple_util_priv *priv, dai_link->num_c2c_params = 1; } - ep0 = port_to_endpoint(port0); - ep1 = port_to_endpoint(port1); + ep0 = of_graph_get_next_port_endpoint(port0, NULL); + ep1 = of_graph_get_next_port_endpoint(port1, NULL); codec0_port = of_graph_get_remote_port(ep0); codec1_port = of_graph_get_remote_port(ep1); @@ -1144,7 +1136,7 @@ static int graph_counter(struct device_node *lnk) * CPU/Codec = N:M case has many endpoints. * We can't use of_graph_get_endpoint_count() here */ - return of_get_child_count(ports) - 1; + return of_graph_get_port_count(ports) - 1; } /* * Single CPU / Codec @@ -1158,7 +1150,7 @@ static int graph_count_normal(struct simple_util_priv *priv, struct link_info *li) { struct device_node *cpu_port = lnk; - struct device_node *cpu_ep = port_to_endpoint(cpu_port); + struct device_node *cpu_ep = of_graph_get_next_port_endpoint(cpu_port, NULL); struct device_node *codec_port = of_graph_get_remote_port(cpu_ep); /* @@ -1186,7 +1178,7 @@ static int graph_count_dpcm(struct simple_util_priv *priv, struct device_node *lnk, struct link_info *li) { - struct device_node *ep = port_to_endpoint(lnk); + struct device_node *ep = of_graph_get_next_port_endpoint(lnk, NULL); struct device_node *rport = of_graph_get_remote_port(ep); /* @@ -1228,9 +1220,9 @@ static int graph_count_c2c(struct simple_util_priv *priv, { struct device_node *ports = port_to_ports(lnk); struct device_node *port0 = lnk; - struct device_node *port1 = of_get_next_child(ports, of_node_get(lnk)); - struct device_node *ep0 = port_to_endpoint(port0); - struct device_node *ep1 = port_to_endpoint(port1); + struct device_node *port1 = of_graph_get_next_port(ports, of_node_get(port0)); + struct device_node *ep0 = of_graph_get_next_port_endpoint(port0, NULL); + struct device_node *ep1 = of_graph_get_next_port_endpoint(port1, NULL); struct device_node *codec0 = of_graph_get_remote_port(ep0); struct device_node *codec1 = of_graph_get_remote_port(ep1); From patchwork Thu Oct 24 02:20:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13848221 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 7FD91D0BB4E for ; Thu, 24 Oct 2024 02:20:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 073E210E88B; Thu, 24 Oct 2024 02:20:36 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="CBQrQ2lr"; dkim-atps=neutral Received: from OS0P286CU010.outbound.protection.outlook.com (mail-japanwestazon11011032.outbound.protection.outlook.com [40.107.74.32]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0A1CD10E88F for ; Thu, 24 Oct 2024 02:20:33 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=RA0sgQcIzkpBLE6v+nV1OyriqjDIDaIYaRMxYUOeMyNn0HSzN/ShgKwe2dbVGkiHgbxmLpMUPHAQvyP3ewjZlazwzHwOLOzF6hoZj532rCVW3BpgxcNYIJrBCDIR3GpxnFspZzEw1CzFgXXoNR6R940r9UOkAqskKiAHvyPxz4m/GG6DQCl4Vae7lOP8IVZBbgvlaFzQ6X9spxCRQpZqEiOxYlEIKUlAz9ntS5DYdrRGSm6klD0y8k9ZcnTbV4Y+FVmqWJ6xUsh9Y31EdqBN6nWUMPMu2bB5juypxptAXFZ6W5oZb3M61IWcq+ZkIsvZgZgjKAOubQFRqXg2To6VSg== 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=6t/TBu062eNpxMUIBtKZ/65+OqkqZOYyF97oP1iAYR4=; b=sDh0gTzZGswcSkGUkkH0j8e30+AOfZfsXWDXkdJPzZ0wH2dFwU/taIkGnrjMEK4DFfj9FNy+SDFCiEhu8Sc0MGpbkMnOQVXlla6ThSdT6bXJCLOoLCncT6UBpnyVJdYBhCupK/PFAwAYG7oF3N28NjjcjmRI4JHnmQbm2r0KO6KcfkvnY1oNBnITKg3pHZe2l48AEReOBcKmxnrrSB/bbyDwWWApFjEFT0mLa18on8rjCW6eoCeGogk5ljyaIaLlghf/LoB6SVpAz7bdlmgHjQD5JuIfP9XHzcjsuz5pVEoIWZFqz1gzvnxAINJqL1i4itMLrWCyuaLlNUv3wTNe1g== 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=6t/TBu062eNpxMUIBtKZ/65+OqkqZOYyF97oP1iAYR4=; b=CBQrQ2lr8DsTiWvsP7lInhzq8n8Q3+cOByNxFpvCsVkR1/DrJCDzLUbivQe0d2HzAZB49SPn40ZeJbPszoejBzmr6lkoHtiwgv8jU2H/lrv/gDmoNgvrJNGBydnnqjMCzd6Way42sqWhsbKctPRfI32wnt+2zmNcZwkdiW3cfLg= 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 OSZPR01MB8629.jpnprd01.prod.outlook.com (2603:1096:604:187::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.17; Thu, 24 Oct 2024 02:20:31 +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.8093.014; Thu, 24 Oct 2024 02:20:31 +0000 Message-ID: <87cyjqb5sh.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v8 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: <87msiub5tt.wl-kuninori.morimoto.gx@renesas.com> References: <87msiub5tt.wl-kuninori.morimoto.gx@renesas.com> Date: Thu, 24 Oct 2024 02:20:30 +0000 X-ClientProxiedBy: TYAPR01CA0105.jpnprd01.prod.outlook.com (2603:1096:404:2a::21) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OSZPR01MB8629:EE_ X-MS-Office365-Filtering-Correlation-Id: 246100ef-a08c-44da-c3f7-08dcf3d26eed X-LD-Processed: 53d82571-da19-47e4-9cb4-625a166a4a2a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|7416014|376014|52116014|1800799024|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: qdxvJgmFRloEDc/c32nKpH4vqy2BFa8DrlgDFIHoQqM+oH2hIHUrag7ka6UA6ZjwMZ6gI3wUCAtvldF2NVQLbqMU/tOoHLyAl+22NANrQP/hLyjyukZzFvB9GTgSFIlFt+NW0PsfvqnhasxR7b1t9xIydrXkWTKxMuvP0qPLmFNb56v7+tfZYMWiE+zk2pLuOgmgR8gm6kAgyf0qkxaheFoXOTBkvnXUaPbHoycNUsHuFIVdrk55T2mD/zCpu66x1Y1ucQh2KM/kdelS2ZJ017r8CzAYTtAjpB1wcVqGCxzwY6X+SS6krSX+tQingC4SyWQnu6Z8QKY1FM2YVFTFFC9ZLId7zBXH21KkTTFxur7YH80Dy6VkUnbA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:NLI; SFV:NSPM; H:TYCPR01MB10914.jpnprd01.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(7416014)(376014)(52116014)(1800799024)(366016)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: H8G1UwQ+e4MOxTut6SaWIKQFE32thUOHF7fLZCo12tbuNLxQRZWzaOMB5R+M3Y9qtUq0MUY9tHWIRGNWSsffo06WJfKVGuaUyIFFw2cXU4aVuii5BVELRoR47za/GTNeY6mKx07NJEW6lQhYEpKf1MM/jCPfRUYPQP6kMRgg1DqXwe/H5LW8wTrWhNe24yU2b757ExE0ZXiCElsYB39ibBi+H+q4QN8OQEDD2KBT7k8syAkAFhcupuD7nJ9YHxAk4Y01uGwAj8fRiSKBNleXPZLiQE0y1RcKqx9S8ot9lpdMwgdAp7jiw20N3+UWH8urSoidqWq4NGprcJwvrY3m/kGadd7qRQBBvDMnHgygyViWqZcbaOrF4FE58sjeaJeWGVxdWpJlhAq8QGeNiUkBNkl3Prh+9hDd3F1axa8hURJx7l5y7auRD2OyInprgMhdlgzPtMAqTz1W59Q/Bine+xmDNEFZc0oIYolvcl8lokwLeq81HVr9oBxOpAJYKFcvy1l+ZIu2mwPB/Dh6BxxHqDw8SegLDqsFMzNO91gJVmAHTLBFYxcsmxNHjgL9ot1p+og2XpIQA9kqpVYP1d66N/OWke5KpxhMB13Rb1yPUSk118gw0YPxVKYJKOYxyJD17RCVbNoTq67Xbgah+XERl1A0Qq1o0vXIvSBAUmqhYBCRs4ATr1wJa7rfM9Sn01DIowor/6uX8zSBkAcPtgPVIIQfMehtEFzIS8LwOWlu2HISP/Ylqb/YJ8gcJybEnEjY/FlY1o7WNRgYQvBbPPuJsnErOf9YsUQDotmkhhndeQ566coBZVJCjEinE18aPkNE3OlCHSMHlXnkzZW7UJObS1mcRZwiBeK7PhqjsJ1WCe3jWvBULmZvaPUXR0dhGTI39pgH5r8sAvWyddsnoXjO5upb9J3kB18tUcm8Xy1lWvULmTMaifJz/IuOquFGdEnIkejTieGUwExDh+rUTNQyNZ8bLR/SP4HHl9lOhEPUCiaU1FPUczNhbQy7x3SDkGlCJF+eYNzqWWVguNZYRi2iSJ/F5VZ6bAxf0Lq1xwleIjN9GRz7VPuwKxKo7x4sv/CZ9u1k3rRKfd61uUdmaHaj9fZIXIRHf7uoioKNSV7FFwRbYox2/0SSf/moGvDiE3GGboWmV/T3gng90p0eDYiO8KGtIo0lg4uJvx6djFV77ZX27nNlWMbR5xW0hQ0NFDqFHNBvSb9Kd8uPwyVbjR+iCcJwQGIp0G8cXfY5jOI9uIShYlQ+mfypZzlQHHmPrqsR+8mAD6HJqxwGEHerx+AiGSS4xtnmc57XHRRZJ4jA2YtkHHf7nmh1fg559ZEJb8nQWb7HamSjj33tBrR85MczcDsVJ71Iryb3cv3oBK5NwT50QywFGTGUthjOA42h7l4X8Yb0PZ8Tp5RqqQCh3CUxkQfyhtUCdGlBWuBOVX5nv8dyco1ivR/UaHrJA5ycQ8SAMhJVNWQC+JZFc1+ziEPkWMowLjjvYeOXEI6heJJya6xUYNiU09JH12R9R/r13HVuIrU2dQIGtFEBItq8zkZGoALSPfLrWVri8pGaFqCGDumgXuas1ZUOQW/yJOnzZ+qFP2TM7ViI3MNK5bK1e9woVQZv76f4S631volD5EXnCnM= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 246100ef-a08c-44da-c3f7-08dcf3d26eed X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 02:20:31.0560 (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: IhsW60Tsuo48lYxPSbffxLLXg6QfF1RLj2Vrno1G5cEZqtayLw7g6OGDvUbuN2if9tMZckyddjjI3ekjpXOpRW2PeDTeVNzB9wPOWX4SO2hPwPGabO0VXeI77C+ADZIL X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSZPR01MB8629 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 Acked-by: Helge Deller --- 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 Thu Oct 24 02:20:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13848222 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 1B4D6D0BB50 for ; Thu, 24 Oct 2024 02:20:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 955F710E88F; Thu, 24 Oct 2024 02:20:38 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="cplPOAPU"; dkim-atps=neutral Received: from TY3P286CU002.outbound.protection.outlook.com (mail-japaneastazon11010054.outbound.protection.outlook.com [52.101.229.54]) by gabe.freedesktop.org (Postfix) with ESMTPS id A392210E88F for ; Thu, 24 Oct 2024 02:20:37 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FOdaBtGNrTg7KZBUQFDYlx2O5X527Ktr2M2qde2qEKOs1mQJcRDSlw1EPuSi6CPCB8rhvqNMUVv47rayYtDeQe1297KeQZytrYHH1lUjaM3TX4IRZTa/sX/gfhTLQ34b0c56D2WrjiXoFuLdCEH8+ROSDVRO0LazJXxiqYle6xIc03D+zntYuVgVnXvajMTKKq89WsCGsLBkok8CHGkHzqtQVsrWcH/8KQkdHAyS36igauMfnUn6B0Xt0KptxcgRK8FY50fBKkACvEWig9uuY+Jh5T6FdlGjhHEO6DqEL4ZKSVrCAAt7ktsFnVNTWY3bInw8E69keGXnTRH/EkqXAA== 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=e9gi2RRiB7Qd16arS49XABzBc2eDOLcw6GcUsaajS5Y=; b=RsS75qopR48K2btiiaIobhczliEJLJdGrv04+cT38GGGsG142SRfWDITxKb5kSvnLwT0N+U1PNuDIS4qSo7NBabUNWCxgzGeY5rFuAoikyJIkd+Q2k/p084m7tD2vtIKZwDgey7mrwLQQOl7JfhJVX8jARspe+/vRaeUeks7B5VqdxjywxrjKd+GktvmJeuqyAgmeiabS1d0P/h1OHS1LO39a37MwuGgjIvxtQqNzfKGEXjbZ0F8GRRjWfj7Tl4rKm4Twf4A5pbZx1FwcOeT/3yX8gc7HRCv0TDNn0r51Da9DEvKFYaTr1aTICX6bEo6UXet08LyJL4aSe6kd4pvXA== 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=e9gi2RRiB7Qd16arS49XABzBc2eDOLcw6GcUsaajS5Y=; b=cplPOAPUUwWD8XLQU/Z1PATaJdbayNBNchGKCGiVICB0+CNmB5oIZvBd3Lea3cqEiMKbYcIhidlJ+xdUyaX2UsKCBWwuPAdNTPy1wkaongwtp4vGemmBO3wMiP73wcekeNxEN4gsRWTBP6cae8IcBQqaz6x/T/hrPLWzzuH8Mj0= 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 OSZPR01MB8629.jpnprd01.prod.outlook.com (2603:1096:604:187::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.17; Thu, 24 Oct 2024 02:20:35 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%5]) with mapi id 15.20.8093.014; Thu, 24 Oct 2024 02:20:35 +0000 Message-ID: <87bjzab5sd.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v8 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: <87msiub5tt.wl-kuninori.morimoto.gx@renesas.com> References: <87msiub5tt.wl-kuninori.morimoto.gx@renesas.com> Date: Thu, 24 Oct 2024 02:20:35 +0000 X-ClientProxiedBy: TYCP286CA0188.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:382::17) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OSZPR01MB8629:EE_ X-MS-Office365-Filtering-Correlation-Id: 3380e272-8cdf-44cc-e2ae-08dcf3d271a6 X-LD-Processed: 53d82571-da19-47e4-9cb4-625a166a4a2a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|7416014|376014|52116014|1800799024|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: kR/a2AfVU3lkjU6h/4eRwbdKw2xs2AYD/YcUm2IhMBSpI+iTBY90EGw39TiYOgxV8+gCPlHCa1yeApWnk68n3bamybgByA+kep1/y3L8iSVWnumY+z/ey0uWbpGShtkuETeSRfZyyxR8KwiDan0IvaG4jsBAYicvmAO6qe6hXO14Fc6HfrCbUXVDXmd6rSqdfn8pC0VK++EnTXnKWrbiY7d1LZVXAtHl5W+UhCKXJhidL6q5u1tVSNNaJoXuyzK57xDcLSOnOKT6xfM5vL+OoHkYoQtG5Z15jxlRIqleeKEhC0oj0qdU+e6+/Y+52qeXUGCEsz9Rtjp4Zp7msneum3ud1ausmYVnvleYRK5XKGrjdnKGH3WRUCYEj9+Q5+FRyScq6RNa5KtHpwFjPX5wGMJo7uhx22YW8gC3H7xaF9BTI/YJUIFRLZTAZLU6+8AaoiUMSWbMC/Z9wQ7ANx3rkQblTFbTqiU80cwQj9nskN/2wY3SVTnd14bVTb+RKTWpF1bkH72WD0Ee3/KGNUW1Oa++nkWCWl9mKIJfhsUwwATm8LK6cvci/fMKiMfmqozJtE6L02LrSuptzniU150GWNoqWwug4Cutj9LwpVu7nS2NdDGKVtgmxZK7STFFgKydtS+87jq9AZZj3O1HhfTdOCFUVGcYECAM16nbEejLEFA/pfdMYKKNe/FwNY+AAg8p0+fELOx+fKQce0+FnfgCm7aW2c1JOBBQAzDKFRlLAbMdK7Ccr20ssDWXW51KWehaI1BGu3Ak7wX417AgO4SXBK/a0pIrj0yNkQPiHm1cSUO9nYmi87tnqSWyeN6HEoNu9jvNLMobFhWsaUcm2L4pRP+4fVeg8+V3+pBNIw3mp5XVrSM8GNu037fymM6206d5YCiLAo8IX/MBd5SOCqfwzRdGiFLNRf7wHRR5QaTOpMBfozdRXqsBiSD6GVdI3Wu1jh2VXALinq3fVbP1uEMZ/8I37axHcCFvXpYqeskG76Rc5k5PRUiF1yjUtzcTD3tjjwLbm5bFtfnTDmHQc3uAd2YmjmPTe525pexSBUanf1I43j+3k7dsZOixVLXedSWP96Lo/PQjT2DObnN2agekrBeMQoNDsoqaOgpdwy9jrP4X/rBc/YIH/sNvSGDZuvh6oDh//29Lz2XUB24KkWGKCAXsNHR8jKs99MIm37jnp9kuSQTigamJln9sM8kQbHRjsLrujIYZBkcNgfzjGeS+i03PXyRHcuTi1afP7vIRX2xMIkLdSr0bl7cKxvdKiEwnHOTn1VtaC4zwgjhDnt81Wbnt+je1GbX0sJmhOg01lqvxhUKBvQU5xUjAqG/a/EzLayZDK5nnBZF+9YsJ+n+El7q0Jm28JlqPWGFBlrwUmqsKK+Uqf2iL+1/GSsJt64Ed 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)(7416014)(376014)(52116014)(1800799024)(366016)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: CbXaYj3y4eB4pZ/yAlybefLy1HkZx5vexQVhNjwpss/XSzyQ2kMHUSwwCn6HNl7H9bHcYUH6yR7X6/hq2wvyrLFXclZhrFIroZasU33JCDADv2Z7w+Gb0iB0srm9MHagZyauNxrdkSo1fNR7DTcMuy534KckvPKVCzljPUsB3aHzAnlnP08tIlJsrKT/M7x+5I+SO54TtGItgqMTneCMfrGsx7R62sHlgMORF8DLsOdLnB0eA1nGAL4ibDGMH8t94cWzQPGJoB7qclVhQAGwn5JcwnUUKliYu8wDTNLI4YDDxIKYvTAsfKoSs2CuPXoYWCrPYm8HkYAIxE0WfQNo9CDz5oVijWe4vy+lQ6bwxgppYf581wCkPJZKBrDHWBJ3YFL+4ew5lphkv0lx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wBf2d7kci4QaZNxgVPvdzaPcUv8xCGUt9+hV4fndjaM1FxqaSxm3Z8NFsC2foxfddLiPOph3bDCYamnW/wPhnY+YUU2cd5Crl3Hcc/xbPJsH4mYTYp8x31VIfoc60FpurU5aIVV/nRqn4X+pwHXLr3DsrA= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3380e272-8cdf-44cc-e2ae-08dcf3d271a6 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 02:20:35.6249 (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: w/aRAhcEt5HSbiJj7V+8mmEmmnM6j75jFpSuAuUQoI2lwYMEqVqwBAOWfrMuBl/pswpH1Jieug84AP+mQLgM7kVioadbF7vpcqA54dtn0GCB3dAFuAuXxHoOTu+Ur2Vn X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSZPR01MB8629 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: Helge Deller --- 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 | 20 +++--- drivers/video/fbdev/omap2/omapfb/dss/sdi.c | 3 +- include/video/omapfb_dss.h | 8 --- 5 files changed, 13 insertions(+), 87 deletions(-) diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dpi.c b/drivers/video/fbdev/omap2/omapfb/dss/dpi.c index c40b87ffe8fcb..86ed4c077c30a 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 d5a43b3bf45ec..c04cbe0ef173d 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 f06debee02c5c..3624a7fbdca82 100644 --- a/drivers/video/fbdev/omap2/omapfb/dss/dss.c +++ b/drivers/video/fbdev/omap2/omapfb/dss/dss.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -919,10 +920,7 @@ static int dss_init_ports(struct platform_device *pdev) struct device_node *port; int r, ret = 0; - if (parent == NULL) - return 0; - - port = omapdss_of_get_next_port(parent, NULL); + port = of_graph_get_next_port(parent, NULL); if (!port) return 0; @@ -952,8 +950,9 @@ static int dss_init_ports(struct platform_device *pdev) default: break; } - } while (!ret && - (port = omapdss_of_get_next_port(parent, port)) != NULL); + + port = of_graph_get_next_port(parent, port); + } while (!ret && port); if (ret) dss_uninit_ports(pdev); @@ -966,10 +965,7 @@ static void dss_uninit_ports(struct platform_device *pdev) struct device_node *parent = pdev->dev.of_node; struct device_node *port; - if (parent == NULL) - return; - - port = omapdss_of_get_next_port(parent, NULL); + port = of_graph_get_next_port(parent, NULL); if (!port) return; @@ -1000,7 +996,9 @@ static void dss_uninit_ports(struct platform_device *pdev) default: break; } - } while ((port = omapdss_of_get_next_port(parent, port)) != NULL); + + port = of_graph_get_next_port(parent, port); + } while (port); } static int dss_video_pll_probe(struct platform_device *pdev) diff --git a/drivers/video/fbdev/omap2/omapfb/dss/sdi.c b/drivers/video/fbdev/omap2/omapfb/dss/sdi.c index 2a45f019ef457..2d3e5d4467c57 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