From patchwork Thu Sep 26 00:00:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13812641 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 80146CCFA0A for ; Thu, 26 Sep 2024 00:00:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C024810E866; Thu, 26 Sep 2024 00:00:15 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="c5PKDmWT"; dkim-atps=neutral Received: from TY3P286CU002.outbound.protection.outlook.com (mail-japaneastazon11010043.outbound.protection.outlook.com [52.101.229.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4AFE810E866 for ; Thu, 26 Sep 2024 00:00:15 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CFInghLsvTZ/TTSZf5Zf6gbMuRMa0Lkv3eYJT7rQZwE5xAd4PHNsg7lycCB4RdR4RC1VO/5I/Pqve2XpeLg++nZIGoBoTk//hikZgJXIh4WKp1PQZsK7fAlv3REnzHoiudhvOB7Y7+1R0LCwYntoAqx1dqXSWj+sZU028ZQbVz6Q0JMHFArujqTS4I1DgvlqQJwqWnkIjSsGgSdc2mwQZiyOdBzfaEPWGkTFtXbJg1/1rIVVC9ESoR3XAabCY5+M2gRDBg367E21btLWZ0jKdP9ChD8b2Oi/SqUW77hnyRrF3MybV6eYUv+qtxdb6mazWlktbk2U/RWdFgVl5t9nxQ== 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=aoRhWG28gxX+heC8uU4vMSaaRrU8bfYQHyHoVRrepsI=; b=n2/YdQbhyjKrKcB/JSID7vefG9GRSFMGmBe7U7BkpUmiD+h16qoNj29wjmeyguaCutB2ph23ijbOEy2/8c6vbcLfU3n9MbToT/glo1JtvtXF6InTQsLtK0lBjqG3NTFRZKbktNPuWnGEwGrWlTgUVZmoWfbXUkrIqA8M5Yjg6xX8QihzAEZ4DRRlBDua1CquMCNSa8m2OPWPRx3yFrBlwjyQ3uFHMy+qp38l4+lQCNmCTGic9Os7Mptw056RksW/xqJwyfc8vbXT6JkZ4Otwn3kDtYnnueqx5As8C/KT2tZiTWtDKK33HIR949MthqIavnyuPC+VtmfjWWl/T3uWOQ== 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=aoRhWG28gxX+heC8uU4vMSaaRrU8bfYQHyHoVRrepsI=; b=c5PKDmWT/TfnFWLYELgXjs/WRYtH/urXIFx0RbV2NpKZ3IUwMiYFnaRUm7J7Oyvd4be+HoDe4vuicaW2dFht41T4OW+ZhFKhXxVVxgoZJDamScif9zC087VgTkEFshyFjjgZhYvxhqwJPCPOPvT3LR+8hhYlKACidOGfEctFzT8= 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 OS9PR01MB13322.jpnprd01.prod.outlook.com (2603:1096:604:310::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.27; Thu, 26 Sep 2024 00:00:13 +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.8005.017; Thu, 26 Sep 2024 00:00:12 +0000 Message-ID: <875xqj9tdf.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v6 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: <877caz9tdw.wl-kuninori.morimoto.gx@renesas.com> References: <877caz9tdw.wl-kuninori.morimoto.gx@renesas.com> Date: Thu, 26 Sep 2024 00:00:12 +0000 X-ClientProxiedBy: TYCP286CA0023.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:263::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_|OS9PR01MB13322:EE_ X-MS-Office365-Filtering-Correlation-Id: 45c8c880-3a9f-4b38-888f-08dcddbe319a 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|366016|7416014|376014|52116014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: H+kXeJOWxqlqGj3hqDrADMGRvHrcu8Pi8PMO+ycUuii59CKhZ79FMnN1DBk9XlXQmb+Ekp8Ld0ERpsNjiG35lPxYwR39rKNEqCR9XmuIsT7rSXqBJxlU3lEJkUwX9Ujz9KXTQq2Nn39wlo21sHAte2l5tT7RgWPL4xuOCLP0a5i/HB5Np0L4vbstcoiTd61kY3Wt9Fsi9JPxS1irsC3paBbJOOOy2T66cqBAEz3vM+XYDp+6P/kEtk9igiOdCN2aMLkcsENvOXCdG/FNpKoJymaUS1FDNs27DmWSmpOVD6Fu+CXaw9mixmkkdCEVo2EoHw064A9sC4NzKhZbxTg2kHg41a4ptEcesTQ6qu4+4HcVoOd6buaOryKD189zg9sYyJAJj61QUaYBNYYRIoiKWP+WGu3IBjGslVsUroOqMUAUuRyn2qCfcz9A8yG/1xgR6NRgiVwoG8rYp6q0/yn65kN++Bi0GVYzyl0Y3IEDJSYZsEAekbZhPpSv6hgB86VKcZ5QI3NYDfmIx352Oy7kgoDIwbLi/3Acx7TXiS1wd5g7FoaJxT0aAtIarTmEZMsNwxiyIy+lYZPY4FH8IIPkopBjl5KXZNwyqyb9/4MzAEW/hPMF62b6eoaBLVfKqB3373zDQNrohwuPi4y8ZfH90am8dOkyNkZNH6nBTCb2qWBKfd1KdD9COP/4D86tYrHsEY7XYPZtC1Tm9y6CwOVmTSmpNMSPLRnsjzJ9h2jq9vu+Sa3pLak2DKotIwoH/rXMjrXZa56HsNtaM9vAkp0vkb7pPuqP9OVQCA/CaA8/lo+5fVSMnOibc/oAP4ImTE2nJRUmaJggjj8wFEd3oyxbbDLNavUiubArSA2tkJPBYuuIyKfpf+DXPPYktf+O3edXiCnkaQweeRONZkSR3JC1KbMb+drsLnR/RdWbMKWa5QeNosrUAf5z/lTksyhinWdrL8piB6KQEdJ6K1cirjFLWPU6kmZyKnKbPw4RxDd/x5Zw8cTPaGRYGnYbKpfTsfa86mB07SCbTXlhh/jniNlOkIdHoXEz9TH81CP8A7GoNv37g4Yd/fqddy7QIURtGUefmDOOSiFTm58DEJ0V6DMo17qWvUBNF5Ht24gRCfdWvXeBOcHW037q/n2YyvdlBxt10WNfNUV5EQHPZH6fyonxtX8fsZFqZJMxcuawZ7hw3OQapIxKPGsosDFH0E3q2jKCwCiyiYf2hp+p6aiTRU6yWbbEbiSdUxxoaAjaKEj+JWtNev3nbX2jq95sxZgaH0fAodAnKo1BODtW8Fhn2/Lwq+e8jZxmWH86mc8T8sBCj830BtywDk0XG/XAm07ftEKFwU/gkD3oDuyVlovyIP1abQk6xcXDoMXzPJpwHTBLur4= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TYCPR01MB10914.jpnprd01.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(7416014)(376014)(52116014)(1800799024)(38350700014)(921020); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ieHMhMWIpD9ix1SMX3GuIVa/7J33NVeHUWMArBLmjDoGQQ1dZqlDWUkQuQ9UekUp/nJt71+1anJFytWeIKpvfUPGzKU7F35es5v2aL/eS6piUtkkfciW+htAJ8omG0OieA8lFGq9Z9RgjjHYtWlfAO95155fu3bCaWrrVVqTFAg6fUlbPKROIFjIX/HBd3MNn+gJKGbGR4Ohghg9vkhbIWE4tGQT2jUO3RlPtle/RHJ/Gt6o9WmY3qOyGbum23hwv1mVp3BQNLFHGPgY+Iu1yGozdaTarX1XR076EBUqq+QbxN8GRMXzC+2EnxUTSafyhYFtEeeV9vBl1iXeQKCVSpvbFMHS2tbqrei82KkOdN+B3+GFSL0+0MPKjZWJMdd3noISrQ+qJ7vRepmKQr6wxro4JpyZX1kUk8FGa93UILwEIJ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uVl/uIU9pEUdu5ohEVTiocGmUXDPJ9mqR2WptBsgDB+T7+PDV4niC9WAMPxkbOTMDAVFhN1DyG+sOUE2pAAY0G6421VT6JXGht76jgkggPPK4aQalfcmsII= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 45c8c880-3a9f-4b38-888f-08dcddbe319a X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2024 00:00:12.7729 (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: LLuDFXT0AXbfSGt6qc7ZGSynkyXcF5B9r2/3/Eb3liZPJxZcc/+59ukdN4Mbc1DTyzYrnQWtcUtuskNkB0UQexLSsHul/FycjJC/QGVSHtbV4pL/UWYNHaI5PNkWtCTG X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS9PR01MB13322 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" We have endpoint base functions - of_graph_get_next_device_endpoint() - of_graph_get_device_endpoint_count() - for_each_of_graph_device_endpoint() Here, for_each_of_graph_device_endpoint() loop finds each endpoints ports { port@0 { (1) endpoint {...}; }; port@1 { (2) endpoint {...}; }; ... }; In above case, it finds endpoint as (1) -> (2) -> ... Basically, user/driver knows which port is used for what, but not in all cases. For example on flexible/generic driver case, how many ports are used is not fixed. For example Sound Generic Card driver which is used from many venders can't know how many ports are used. Because the driver is very flexible/generic, it is impossible to know how many ports are used, it depends on each vender SoC and/or its used board. And more, the port can have multi endpoints. For example Generic Sound Card case, it supports many type of connection between CPU / Codec, and some of them uses multi endpoint in one port. Then, Generic Sound Card want to handle each connection via "port" instead of "endpoint". But, it is very difficult to handle each "port" via existing for_each_of_graph_device_endpoint(). Getting "port" via of_get_parent() from "endpoint" doesn't work. see below. ports { port@0 { (1) endpoint@0 {...}; (2) endpoint@1 {...}; }; port@1 { (3) endpoint {...}; }; ... }; In other case, we want to handle "ports" same as "port" for some reasons. node { => ports@0 { port@0 { ... }; port@1 { ... }; ... }; => ports@1 { ... }; }; Add "ports" / "port" base functions. Signed-off-by: Kuninori Morimoto --- drivers/of/property.c | 127 +++++++++++++++++++++++++++++++++++++++ include/linux/of_graph.h | 50 +++++++++++++++ 2 files changed, 177 insertions(+) diff --git a/drivers/of/property.c b/drivers/of/property.c index 11b922fde7af1..f6cd614637181 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -630,6 +630,97 @@ struct device_node *of_graph_get_port_by_id(struct device_node *parent, u32 id) } EXPORT_SYMBOL(of_graph_get_port_by_id); +/** + * of_graph_get_next_ports() - get next ports node. + * @parent: pointer to the parent device node + * @prev: previous ports node, or NULL to get first + * + * If "parent" node doesn't have "ports" node, it returns "parent" node itself as "ports" node. + * + * Return: A 'ports' node pointer with refcount incremented. Refcount + * of the passed @prev node is decremented. + */ +struct device_node *of_graph_get_next_ports(struct device_node *parent, + struct device_node *prev) +{ + if (!parent) + return NULL; + + if (!prev) { + /* + * Find "ports" node from parent + * + * parent { + * => ports { + * port {...}; + * }; + * }; + */ + prev = of_get_child_by_name(parent, "ports"); + + /* + * Use parent as its ports if it not exist + * + * => parent { + * port {...}; + * }; + */ + if (!prev) { + /* check whether "parent" has "port" node */ + struct device_node *port __free(device_node) = of_get_child_by_name(parent, "port"); + + if (port) + prev = of_node_get(parent); + } + + return prev; + } + + /* Find next ports */ + do { + prev = of_get_next_child(parent, prev); + if (!prev) + break; + } while (!of_node_name_eq(prev, "ports")); + + return prev; +} +EXPORT_SYMBOL(of_graph_get_next_ports); + +/** + * of_graph_get_next_port() - get next port node. + * @parent: pointer to the parent device node, or parent ports node + * @prev: previous port node, or NULL to get first + * + * Parent device node can be used as @parent whether device node has ports node or not. + * It will work same as ports@0 node. + * + * Return: A 'port' node pointer with refcount incremented. Refcount + * of the passed @prev node is decremented. + */ +struct device_node *of_graph_get_next_port(struct device_node *parent, + struct device_node *prev) +{ + if (!parent) + return NULL; + + if (!prev) { + struct device_node *ports __free(device_node) = + of_graph_get_next_ports(parent, NULL); + + return of_get_child_by_name(ports, "port"); + } + + do { + prev = of_get_next_child(parent, prev); + if (!prev) + break; + } while (!of_node_name_eq(prev, "port")); + + return prev; +} +EXPORT_SYMBOL(of_graph_get_next_port); + /** * of_graph_get_next_endpoint() - get next endpoint node * @parent: pointer to the parent device node @@ -823,6 +914,42 @@ unsigned int of_graph_get_endpoint_count(const struct device_node *np) } EXPORT_SYMBOL(of_graph_get_endpoint_count); +/** + * of_graph_get_port_count() - get the number of port in a device or ports node + * @np: pointer to the device or ports node + * + * Return: count of port of this device or ports node + */ +unsigned int of_graph_get_port_count(struct device_node *np) +{ + unsigned int num = 0; + + for_each_of_graph_port(np, port) + num++; + + return num; +} +EXPORT_SYMBOL(of_graph_get_port_count); + +/** + * of_graph_get_ports_count() - get the number of ports in a device node + * @np: pointer to the device node + * + * If device node doesn't have ports node, it assumes device node itself as ports node. + * + * Return: count of ports of this device node + */ +unsigned int of_graph_get_ports_count(struct device_node *np) +{ + unsigned int num = 0; + + for_each_of_graph_ports(np, ports) + num++; + + return num; +} +EXPORT_SYMBOL(of_graph_get_ports_count); + /** * of_graph_get_remote_node() - get remote parent device_node for given port/endpoint * @node: pointer to parent device_node containing graph port/endpoint diff --git a/include/linux/of_graph.h b/include/linux/of_graph.h index a4bea62bfa290..6fbd2c8696fd9 100644 --- a/include/linux/of_graph.h +++ b/include/linux/of_graph.h @@ -11,6 +11,7 @@ #ifndef __LINUX_OF_GRAPH_H #define __LINUX_OF_GRAPH_H +#include #include #include @@ -37,14 +38,44 @@ struct of_endpoint { for (child = of_graph_get_next_endpoint(parent, NULL); child != NULL; \ child = of_graph_get_next_endpoint(parent, child)) +/** + * for_each_of_graph_ports - iterate over every ports in a device node + * @parent: parent device node containing ports + * @child: loop variable pointing to the current ports node + * + * When breaking out of the loop, and continue to use the @child, you need to + * use return_ptr(@child) or no_free_ptr(@child) not to call __free() for it. + */ +#define for_each_of_graph_ports(parent, child) \ + for (struct device_node *child __free(device_node) = of_graph_get_next_ports(parent, NULL);\ + child != NULL; child = of_graph_get_next_ports(parent, child)) + +/** + * for_each_of_graph_port - iterate over every port in a device or ports node + * @parent: parent device or ports node containing port + * @child: loop variable pointing to the current port node + * + * When breaking out of the loop, and continue to use the @child, you need to + * use return_ptr(@child) or no_free_ptr(@child) not to call __free() for it. + */ +#define for_each_of_graph_port(parent, child) \ + for (struct device_node *child __free(device_node) = of_graph_get_next_port(parent, NULL);\ + child != NULL; child = of_graph_get_next_port(parent, child)) + #ifdef CONFIG_OF bool of_graph_is_present(const struct device_node *node); int of_graph_parse_endpoint(const struct device_node *node, struct of_endpoint *endpoint); unsigned int of_graph_get_endpoint_count(const struct device_node *np); +unsigned int of_graph_get_port_count(struct device_node *np); +unsigned int of_graph_get_ports_count(struct device_node *np); struct device_node *of_graph_get_port_by_id(struct device_node *node, u32 id); struct device_node *of_graph_get_next_endpoint(const struct device_node *parent, struct device_node *previous); +struct device_node *of_graph_get_next_ports(struct device_node *parent, + struct device_node *ports); +struct device_node *of_graph_get_next_port(struct device_node *parent, + struct device_node *port); struct device_node *of_graph_get_endpoint_by_regs( const struct device_node *parent, int port_reg, int reg); struct device_node *of_graph_get_remote_endpoint( @@ -73,6 +104,11 @@ static inline unsigned int of_graph_get_endpoint_count(const struct device_node return 0; } +static inline unsigned int of_graph_get_port_count(struct device_node *np) +{ + return 0; +} + static inline struct device_node *of_graph_get_port_by_id( struct device_node *node, u32 id) { @@ -86,6 +122,20 @@ static inline struct device_node *of_graph_get_next_endpoint( return NULL; } +static inline struct device_node *of_graph_get_next_ports( + struct device_node *parent, + struct device_node *previous) +{ + return NULL; +} + +static inline struct device_node *of_graph_get_next_port( + struct device_node *parent, + struct device_node *previous) +{ + return NULL; +} + static inline struct device_node *of_graph_get_endpoint_by_regs( const struct device_node *parent, int port_reg, int reg) { From patchwork Thu Sep 26 00:00:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13812642 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 47F9FCCFA0B for ; Thu, 26 Sep 2024 00:00:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C1FC710E873; Thu, 26 Sep 2024 00:00:23 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="YmlCQTvb"; dkim-atps=neutral Received: from OS0P286CU010.outbound.protection.outlook.com (mail-japanwestazon11011004.outbound.protection.outlook.com [40.107.74.4]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8963410E872 for ; Thu, 26 Sep 2024 00:00:22 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=brbwy7RPs4knDGlYOlg9yWUXhSfPncFu7gLFvoiiUAK2fY7gDNKkykL6WoYqYoWA/juTOfPC4PROzoVrSh5Ca++2USSWbt+3MyLFSpF0woP0v1k8sPnXCRGg1zUdzjt24do3+CzVwxN3kBQbhSaUE62GSp5WmzncuY/oYQsuBjrDAEaDYAUkE+0HhmaDypmwlJ0po4mSDb6TccsvMiQCIKA9/5l1hsR2MIe7u9hZo5RNznTrTUepnwMi7Vew4Q6J2ptFQuTubTD7vT1u3+o7nGQ8CsakIk+1JN0F1F+yvUXQ022+gP2tvLUB/Yzs1oMKP83IrbzST0ioMajJQbhvVQ== 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=Of7vL0yjGsQed1yS6pcLnFbV59IKDDtbehs+KXCSEzg=; b=BRMPPEYIzS73TNrdaJna2owWgghX0W/jS5WDY7lQeB6U1p9FGjJ6bbD6SEAgSW+pRfN+KBNtIknDuBx5SGb5QuYNcPZ4Lklsu1zIqiKuBeKVojjp4bHIQBtSEMegXzEVw7aW1DHbKnArPWSHDkA8IkeLxCgiJRysQqgr19fY0AAWSomoNPBTkSG6Ju8Zc6pzF5OtfM64TeyTJ69xWcrBXm9TjRg6VucEDgHXlrXe426Cgt3hPmEPem2dEdwNBSKU8uVRj120Zy2mdDXSJTzHm9VxG228CfIkrb49SH0J9qMJOTYrkvBwdFVcyItvHQ1aiWiEpHLPqBPO03wvgIXVtg== 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=Of7vL0yjGsQed1yS6pcLnFbV59IKDDtbehs+KXCSEzg=; b=YmlCQTvbbfUctpW3y8UK7/zh5+9f/sX4dd96QQq/4EJvafj2Dj3VkzOjwvB6K2jQZPJwevRBMQBH//Emxc/IhmvH2/LBK32GKwsXAKoVMnbJC0AxGl6Cg6ArPa9otuCesUc88hERqqWORryTb1WIMT/NmUPY8319Or9k39iTlTM= 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 TYWPR01MB7353.jpnprd01.prod.outlook.com (2603:1096:400:c6::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.20; Thu, 26 Sep 2024 00:00:19 +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.8005.017; Thu, 26 Sep 2024 00:00:18 +0000 Message-ID: <874j639td9.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v6 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: <877caz9tdw.wl-kuninori.morimoto.gx@renesas.com> References: <877caz9tdw.wl-kuninori.morimoto.gx@renesas.com> Date: Thu, 26 Sep 2024 00:00:18 +0000 X-ClientProxiedBy: TYCP286CA0021.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:263::11) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|TYWPR01MB7353:EE_ X-MS-Office365-Filtering-Correlation-Id: f66c20df-05d8-4bfc-05af-08dcddbe353b 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|1800799024|7416014|52116014|376014|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: SfmFNcJ8yaKA1WdwfE/OI54aMUzr7UvZo+23H9E7LMAPmPZevblci6Tro4evQ3Ot2pqU1Q6nepPjCSXYhFO0oj0ieceDBibSEnpRS7TiTjqs9WEbMsDsJOvwhl0oCK68iX3nVpfhFwEB4RKfcyilmTHlilQRs5f5nNmw5as5iZHMaPsKvJiDsMMcBLy7JhQ0AwxYpNmtrrpqpOiEYkvDfNhhT26o2o1LQlXl525HryeQT0UuVx6WrEmu5UjgcJtrpdkziHznlA67mUeL2mvVP++FIYRDP4svqJDeZDyc4tr0gcu3V60QEVc0odQLzChIxwgNaXtWxX8OXk7m/fNw5QOFARMfkrVhEOkBfKtK0OIkJEtavq2t6qMnedh6AXqc1Eo9wivKpuz4nmGkxE1r1SjlMxXwVrtt7Ut7bE72fNjKWBmyhncSt6Xi18vsgS6UwaWzegSIlvkn+3b1TaOYfRIORZk6mx/aeNA/g2hAKnYrO3bRlVtIHTvAZUdBj++4QBzDPybZwpzyIMAQKQgzEhOBc5V5Q6rbTDNq0jNilL7WGP9XGpK2a8coDofdZ8g7Iln6ThxdVi7hOJwfCLxZ+7phYxaJ7qVU/6jw0kRE8K2Uqp3hKZpRZUBBl63+0yGcddDRwVPezCBEZ3KIB/YNsubsChf/J9/vVQRFU+E45Olu6GNIC5ZmiD6KyylMgqnuGwORhOIDz0VE6y1tcbEDwY2SrgP1Pet4H8DH5yYaMyhdCv8MbiytIb+gA6s6Tp9wVHU/AmT2GFiMF8UORcvKcLt0IBiKx8OU37DEBldfKTv94hdKaAY8NKkch88LRYkF4On2ziXUNntqCfhxYCCimh8MCXgTNllytdUUggd2gcepRingqGpBlvXZujkTTLZXeE/zYEkNMKfj/IO9e84t++UYy0wffDBVm+mb0Aoy2bpRdJT4fDl7Bs1THm0Zs4g+VkDOMsD5iXHOMX5Z5hnWP7PupmZAHSSkLQooOC8JnQ3rUyBX6mXcsicPduD3sZLpgF+FJEXas1OFF1LpKTRJM31hWpXQbVOZe9x/VOFz5b9K1i85fZ1fvufMLSCANCgc2CeCD89ifYeFvhe3Ku3t7vZuZQX96o72H4O2i/xVBgn3yEel7Q9+TxPO5pTmaNb8ZVkFiaDdhNx3gszK4GshPmnqkLNTTeLr6xPYt4F/LqKIRE3btbI0g7lTT2lJHEK+GqAPKBHsMJunYHZ0mEy0w6eekV7E+ECHhRsTdkY3hB0fCx+h4epQnY98YZ66JkNIdQiCI9Rasw8tE/AFX7yFs6hsomE932KssMFPL94fdGV1tZg2p/Kv8fi/Z6H8ld1pG8Lifsl0sp1hYyAk6EF1yhndmlUwTN/vNZWIOWHU7OckUtvvNbipeLKaCXt4vcu53BG3vd1fSc99qYUo15L9VEr//vayhvRkAFKOTGzHQi8= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TYCPR01MB10914.jpnprd01.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(7416014)(52116014)(376014)(366016)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: E7ArFshsGcM47hD8Xc3tm4VSU8Jk+r2v5AaU/dIWgymrZxlQH4lhd1TqFFMeI7WPPHcT8iXrHifrUj9iuqc67akh+r+NQwRpkv7T4KUgwbMzQfwxU2op5GUJ0AGc/9TiNHbJa8mxzKKptu6Z4RxK4F8/LpDo7D9iRN2DaWelokGrIsEgmQkipHEefZn3lUACr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jWfeSZBJ0iPQ62gVYROBPhdVcdKNOkMn5Kujkh1MRDPlwJRTft9LM468PwneGvjyqGGRjWhdpCb7+mkD5AiTBDYSg4Mo1l0WWN21i/YdOVDg5oIar6quJ1cpRXtdN1Vo7f7IdXdBE17wgBuAy1Mgkraujvk0sYgEGgVATQp1EM1ypgMBgMk7VSdDczDdYaesEI7w+dUCW2nLhGeTlS5aemcrGhmHaaW41jeiy0PGN7ls/kkKJco7ZRD6DOCwQadG/7wPFas37RBdpwq/sIWIWDgU0pS319jIBrFRJOAJ1VOkRVxR++beKC0NLz9zVPN1TeaQY6Tsd57uKfQky5mpvdT4WfBtEDDck54RaAhU1tIjDbJSKhPxATs= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: f66c20df-05d8-4bfc-05af-08dcddbe353b X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2024 00:00:18.8129 (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: TjOeZnGHTtQdPjrfvSaJubeOKUrHJyK21hJd4uxUqleS/O368k28DumEbjykZcp/snsVAPRQ/tPd/2TShM/nXOWOYG3PhhNvJMjSTh02nZkAXhBaHlQ4OFx3jX6WBiA+ X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYWPR01MB7353 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 f6cd614637181..9814414a781f2 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -721,6 +721,33 @@ struct device_node *of_graph_get_next_port(struct device_node *parent, } EXPORT_SYMBOL(of_graph_get_next_port); +/** + * of_graph_get_next_port_endpoint() - get next endpoint node in port. + * If it reached to end of the port, it will return NULL. + * @port: pointer to the target port node + * @prev: previous endpoint node, or NULL to get first + * + * Return: An 'endpoint' node pointer with refcount incremented. Refcount + * of the passed @prev node is decremented. + */ +struct device_node *of_graph_get_next_port_endpoint(const struct device_node *port, + struct device_node *prev) +{ + while (1) { + prev = of_get_next_child(port, prev); + if (!prev) + break; + if (WARN(!of_node_name_eq(prev, "endpoint"), + "non endpoint node is used (%pOF)", prev)) + continue; + + break; + } + + return prev; +} +EXPORT_SYMBOL(of_graph_get_next_port_endpoint); + /** * of_graph_get_next_endpoint() - get next endpoint node * @parent: pointer to the parent device node diff --git a/include/linux/of_graph.h b/include/linux/of_graph.h index 6fbd2c8696fd9..4a91de147604b 100644 --- a/include/linux/of_graph.h +++ b/include/linux/of_graph.h @@ -62,6 +62,18 @@ struct of_endpoint { for (struct device_node *child __free(device_node) = of_graph_get_next_port(parent, NULL);\ child != NULL; child = of_graph_get_next_port(parent, child)) +/** + * for_each_of_graph_port_endpoint - iterate over every endpoint in a port node + * @parent: parent port node + * @child: loop variable pointing to the current endpoint node + * + * When breaking out of the loop, and continue to use the @child, you need to + * use return_ptr(@child) or no_free_ptr(@child) not to call __free() for it. + */ +#define for_each_of_graph_port_endpoint(parent, child) \ + for (struct device_node *child __free(device_node) = of_graph_get_next_port_endpoint(parent, NULL);\ + child != NULL; child = of_graph_get_next_port_endpoint(parent, child)) + #ifdef CONFIG_OF bool of_graph_is_present(const struct device_node *node); int of_graph_parse_endpoint(const struct device_node *node, @@ -76,6 +88,8 @@ struct device_node *of_graph_get_next_ports(struct device_node *parent, struct device_node *ports); struct device_node *of_graph_get_next_port(struct device_node *parent, struct device_node *port); +struct device_node *of_graph_get_next_port_endpoint(const struct device_node *port, + struct device_node *prev); struct device_node *of_graph_get_endpoint_by_regs( const struct device_node *parent, int port_reg, int reg); struct device_node *of_graph_get_remote_endpoint( @@ -136,6 +150,13 @@ static inline struct device_node *of_graph_get_next_port( return NULL; } +static inline struct device_node *of_graph_get_next_port_endpoint( + const struct device_node *parent, + struct device_node *previous) +{ + return NULL; +} + static inline struct device_node *of_graph_get_endpoint_by_regs( const struct device_node *parent, int port_reg, int reg) { From patchwork Thu Sep 26 00:00:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13812643 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 70B54CCFA0B for ; Thu, 26 Sep 2024 00:00:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E094B10E86E; Thu, 26 Sep 2024 00:00:28 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="hsghpLOk"; dkim-atps=neutral Received: from TYVP286CU001.outbound.protection.outlook.com (mail-japaneastazon11011047.outbound.protection.outlook.com [52.101.125.47]) by gabe.freedesktop.org (Postfix) with ESMTPS id D894B10E874 for ; Thu, 26 Sep 2024 00:00:27 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=s0GHFku29GKZEt70Fd0UeytMSaI5sqyevtVFLOGRfCdlYbIWdcBpflvXLuUVGfbliG5jDal7+sJbxLX/i53j0O59IE/oueBq+e6og7LKfxCyZ6coym3xth/w0vqsdS54TntxRDvIUWpoC8xm6OLQY3MWE47W2JtYNX92UW2n88nPYFxYEWURDsKV1iPKxaIzymY8gZXwqxQD5BQ/21CwNLz1NkMLx03ulIlQRwvGAhOxGqCHirDpI+UAFrRcGqxaADwRTRmHt3fGph5sGoUM8xSujiHjB4AfoaACMwDLmMVb7WxYiOR5xNnSE220emApPyJdQeygQ+UG+GKudEiTgg== 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=FLb99AeBraDOXyyTde5WsdArDKYGSa4FTYxJzkzDM7EjFUHitFioPpDKKdVo1nduPao+jk5vnh5U10kR03YozMrO0h/BBjJAMGiJ2KRAphX4PJ9BIsnL5r51D2XmMB8yfXBSwzslTyY8ORAgIlUhv5UueEnjxofcKnSIClZpRF5GMjVGFpkX9uW2CfcKwnIpVbzemY0QF8/Ovgz+aNLYQ4qQlqhhUxU1AZl2t94xVz+/xcjArGyv04MDVb3xLZ3rsm+yiLq3DfKrtjfD8z0udW5Wn7WiP+E3BcHZC54MREJ6sF26Q8kSglojuNJxkyry7jBqVm0DoetC7gsUa8wRHg== 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=hsghpLOksoFDm53Mnr4ovN0J8cvQYAYnTM5ztQ6zhf9p52NRRrlDzcQT6Ow8T7C/oEzntigNfuMJkR5M7tn0BxPqHv6so+29o5gstWRjK7kJOySvuBau+aL83fXbG3cqtEK1G39cEP2WMuJlgb5zHgVU+KOy+Slr/564CG/fONw= 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 TYWPR01MB7353.jpnprd01.prod.outlook.com (2603:1096:400:c6::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.20; Thu, 26 Sep 2024 00:00:25 +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.8005.017; Thu, 26 Sep 2024 00:00:25 +0000 Message-ID: <8734ln9td3.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v6 3/9] ASoC: test-component: use new of_graph functions User-Agent: Wanderlust/2.15.9 Emacs/29.3 Mule/6.0 To: Daniel Vetter , David Airlie , Helge Deller , Jaroslav Kysela , Laurent Pinchart , Liam Girdwood , Maarten Lankhorst , Mark Brown , Mauro Carvalho Chehab , Maxime Ripard , Michal Simek , Rob Herring , Saravana Kannan , Takashi Iwai , Thomas Zimmermann , Tomi Valkeinen , devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-fbdev@vger.kernel.org, linux-media@vger.kernel.org, linux-omap@vger.kernel.org, linux-sound@vger.kernel.org, Sakari Ailus In-Reply-To: <877caz9tdw.wl-kuninori.morimoto.gx@renesas.com> References: <877caz9tdw.wl-kuninori.morimoto.gx@renesas.com> Date: Thu, 26 Sep 2024 00:00:24 +0000 X-ClientProxiedBy: TYCP286CA0204.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:385::8) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|TYWPR01MB7353:EE_ X-MS-Office365-Filtering-Correlation-Id: fe479a25-c96a-484b-0f52-08dcddbe3901 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|1800799024|7416014|52116014|376014|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: Sc9rrNI2TQLjJbNHYZ4+edDaDX4BFkUIzWDAWXxTc4nGbo7NE8MHVv6jskeoby08lxsUwcvEyVZXXW+ZaAD10v2x7YaYjQ+UKybz5J2nmGOtE4KLP9Jn7nj/e7M724y4UgTlqUqQc3xnSBPbF3MTMq0H8ikh5x+8oWGdnhXxOr5VWWUIN2ngt0Okfe55IP1kNosaaiqskeFpbuBXF8oXcqDUuZXZDJaD61VaEjy5BLocwbtXaLGyRtVptBw/7IB2ar2FHhyiNNfIFh6vxCRluI4yDZWxP8ifGYLj6JJNveCMgV+1r03of4/LKRi7bng4DFVf559QWqj0yovrUk8xdR/IUsDSpZIR6g+Qo8SRjD3owekEh62JJ/SqitGs0KVK4nABHy6BfYFs4lotsl5UwvnON9Btx/u2q99i5qEJtwHxOjw5N4XW1RovrJljcMPwaLpYmDR4uYskE12/KXcFhDtPg7IDaT9W3lKlX5+jDF2VQDkvsOubgRDO/BnJtWtn9nKC4DKOXCDZsHCtJuY5uDsRT+HI6+3WTNhh0lPfqu5JdPsfCny8U1oAKzfYkrStyJdSCA/l+3VMN1V+RGFqCX53+0lu5zj8aNejOmNR1OlZG3UeW//ao6c3BCARVaVtNUsQTxr3uOKJXDMyJDadG3CwePiGpkGylqUmtlD9m9wnyqbxuhA8MLeO1Yaly78eseug+j82o23ia8byygxv3RiS3SRWu5W/qliAtV55hf0wpjtzvXQytLb0iRtoXA3IWvbfXhBSoje6/b3WGQ7lMsj9Hly7kay0JkS7NlX74it0jpX7QgaG7c78aBpyCO50FBrmDof6jujApXoXx2+xjOIuN5ogyQ4fUoCzA/CK7QDS5NfvkJOYiQn39mikQaREcTQCCr9ZUM/+0wmOaIR3kfQ4OEBr2lr0KIwjlV3Bfy7a287DwYgEM3qkxyhyBmHDWWQqVnP2K93yGvORgLJ2BmvI2kAZRntW7U18Yvrz13h5ZLNQBopp7ts/C0sLk26frtRzzAFiuYj9y0uOa4LBeT1Is7ZgQoLjSaRyoF1uOZ+6RELMNj/9DdLkgAFdpZfSAbDu7PAU2p8MyV4RpMqku7yI4LYuv3+uwIe5U9/GRWRfBAIxKufl+noH9OL37fCIwT/9QVGFLI+SH4iWjxUCR47NAobiSKnFtSReAOO8Xx3/Fgb1hjjAzuVnl7f2WHZKMgEfS5Rc1n05Fqy8cKuY9bK7Xltj09EDepwMSpGKxR0biI8RLrNFnfO7XqJf6bmWNQJP0mLr6Ypuespt9qSAi4fBkbJiuqN0KyqUlP1s7KDGgbDe18j0J/C1qB9OwI/wqNDM5RlL6hkVEB1P5axhOS4MNM7olsn1iw/0sHmOYdOfbv7xFc27LCl20qF0C4AwMxO4OfUup/AQjCiSRnSDskWz63/Lwa1XccZ52L6wbHE= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TYCPR01MB10914.jpnprd01.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(7416014)(52116014)(376014)(366016)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HclE7BtUnNoOLqZCQRFTRn0nN7/UUE9sUPEVJM/k41KPPdkZyXsNV85ii9rxDbk+gH5MOXG8Me4fDojlWy7aJQV+P47JOW4ElthSmgZIKI5j31YFqbxT8qjtgpWIbuRJXnJLMOI8FOx3oJJEUQuyvHiQV01jtDRTnOyJq61I3NxHpi2qraEuwkubEDXyFIVeZfIyLac6F9nY72sHHg5wpWbK2TqVC04HaG6sx4lxM/c46mTZ2Rdw+goyVtVhTa4Fo9tlCQ546mmNTvEcA5Vmnz05R6okFecg+NNtrl+b4IgxsnfSNDalTHllMi3ezZ9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6q0nW8u/8zlH0OzJBB3sIEj1rQ7K3E7HDEv+dE3TmXxyInnUMmieYAhEp3YlXHs2DlTdfu1/zrPlvgN98cZCSafGNKSSfAWMptYKAK/ag/VsfLeXHOlDv/i2DddbjLsKNQwIx0/oFIsb2bCI3nyPbchMKgoZi0yP0ZqLL3AKTJFGOiCeuw6VvSzoVDzKffgso/I87Z6mTwbKwaA00WwY5yCTGoMOdxQDU+7JLEiaMMSbTDEBpNkIXqT0shYuee7c0= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: fe479a25-c96a-484b-0f52-08dcddbe3901 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2024 00:00:25.1359 (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: tz9ofmXQwx6xp88qB9aAXF4FyHnf5xv2kZrKA7dTmofILElZWjWrM8ukNSFn8srPwbiwrQsdmGIVhYoEKNDPaF+xOKTcUYcR//SBeJMGVv97RwOyOmDYsl2cGmivVJZV X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYWPR01MB7353 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 Sep 26 00:00: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: 13812644 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 7A5B8CCFA0B for ; Thu, 26 Sep 2024 00:00:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EA52C10E872; Thu, 26 Sep 2024 00:00:34 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="Ri2NY8r2"; dkim-atps=neutral Received: from OS0P286CU010.outbound.protection.outlook.com (mail-japanwestazon11011049.outbound.protection.outlook.com [40.107.74.49]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7254010E875 for ; Thu, 26 Sep 2024 00:00:33 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kBE0MfhDbQGM6K9rrZL2dUuUzuaa7tIN0A1evLcnSwFKfwNQSGK5vMq5kXlXsyoeEPZte0NS8tqpClJas81DwDcdwkZOKN5EinfBX2d3MLBD9u9FgjvuyEp/ZoONaYSUXTCwTubdq/2Cz8LMMZQcnssSc29jZ6+PL9zEC2LEKvz09JJ0NlJVT+bUgjmQseEfwAqNogoVuzV2JeVUYbjjqgJzdm4j2Un74CCJEWHAxnnQbLXcOuHCcVRfnz1tN/EaITuQ19mommHsoauujK1lUwWvh0pksldMxgbDCeLsHsbvLHlIPTn6mor+3U48XVVzZveDWRxpH3Z6GGMJMU9QQA== 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=koVj8ffD+8N6zaVVjRYsPwOdg2G8Pn8Jmxpzw7JecKU=; b=zFeUY5lfetFm6E86a4cmcL6QncVWRLr5efRmDKmNbQWP4tCtFRINqpKCGG8/6LF9ZCrhk0s1RlGpVduv/OE2j7SnJeiX0VFVDbEyoPPZClqdC1w11rmGSVik15VhroZuzCdGTUkU3qx0SX7H5t8D20bb6hGymLWTgXfFlf5BXLOkBDoFCCDAS8ueHGsPx5xa6ofPAzV/SFx7/MmXQgwTtBKtErXUlVCc5MYkaMvaWbMXc2viCJLGW1dHpW1QfRsabqxvcS2fcwGReCBJkA0OFM7prsNpUFUrEERs7Ir+Trc0BqjpNm6Yy4EW5QfzYaHpiR52kILlHjemwuIgbY62Aw== 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=koVj8ffD+8N6zaVVjRYsPwOdg2G8Pn8Jmxpzw7JecKU=; b=Ri2NY8r2UqtShR3PWwhF/2TpUgA/qOyDHvJzt/wEpJ8POhHaX62aXtI87E5JU1N2dCslVeYUZf7UFuQ2u41AdWXM+Y1k6tJ8lgFD0xy3Tyg16rTe9IJaVJIxqCnkpgaN+nv/mQeqDr6USJ4g8mZJB43O1TxYB6mn6M6eQmZyclo= 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 TYWPR01MB7353.jpnprd01.prod.outlook.com (2603:1096:400:c6::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.20; Thu, 26 Sep 2024 00:00: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.8005.017; Thu, 26 Sep 2024 00:00:31 +0000 Message-ID: <871q179tcx.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v6 4/9] ASoC: rcar_snd: use new of_graph functions User-Agent: Wanderlust/2.15.9 Emacs/29.3 Mule/6.0 To: Daniel Vetter , David Airlie , Helge Deller , Jaroslav Kysela , Laurent Pinchart , Liam Girdwood , Maarten Lankhorst , Mark Brown , Mauro Carvalho Chehab , Maxime Ripard , Michal Simek , Rob Herring , Saravana Kannan , Takashi Iwai , Thomas Zimmermann , Tomi Valkeinen , devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-fbdev@vger.kernel.org, linux-media@vger.kernel.org, linux-omap@vger.kernel.org, linux-sound@vger.kernel.org, Sakari Ailus In-Reply-To: <877caz9tdw.wl-kuninori.morimoto.gx@renesas.com> References: <877caz9tdw.wl-kuninori.morimoto.gx@renesas.com> Date: Thu, 26 Sep 2024 00:00:30 +0000 X-ClientProxiedBy: TYCP301CA0089.JPNP301.PROD.OUTLOOK.COM (2603:1096:405:7b::11) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|TYWPR01MB7353:EE_ X-MS-Office365-Filtering-Correlation-Id: d9b3d3d0-0c40-46fe-9e32-08dcddbe3c9b 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|1800799024|7416014|52116014|376014|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: ZSJ3lUff9gN7uceio5zBIjRtqFdJUw6RKv7qkv7Wi7HoKEN26O0khECLAZcAGDSA/rUFCGwkjkUGjU1W+d1hQEJhu0sHNiYSW1a+3UNUfPgiXuIbQrF/jrvETXs031FkIqSJ9G5ydmJNAk5BZQheVsaaFJXps6z2CC+xnTi9CympRjZQQa1DhK4ur0Ptcz/rQNXenyXZhVFwyruZIeESAYOqvSzuaJ/rVMkJ6GGjuoK+hxVsYRb3HeT2mZGNSo+a5/vxGF2YrsxkjjgItVvka3PHGZuunNfYeHjo5oWRc5zWJjqF13FrAjGq2XrXOLJBTawxzaAY4ECySylHs+lOSM30oVrkDl+e3gzYcBI3Nm9ECewZr+TUnP7qbzTJAEEtFq+iiq6qoBP8T33qe/pT9qz0zPx8guiU0odTwHBlhNBmL+++bdM5WT4uYaRqnuAFJZsiBGNrSbGBjeelRpjcxakSyEnobF1NQDt7Ng0syQVfVJH5uqmFm0sRZ2DN5cDxY+DR64cwf73cGsiLG/XZ5lCCat+ADw7i+zy40tv4y7u6qIrQjHNByZPEbsFvnzXkkB3xLVjzcbR7AJePYBeM3RjT1bmLvTieua6Lks+C7xyOZFPOW5PwwN9A2jmfgV9Dak7cZhSIUrIoqrGd5qr07D5iJipO3dVfTV45+6VPy6Uy6dv2JOLsWB/PmBQ1T17E2DXy9K0h9lNJz/k8GLRzkzZyF3BJ92jrdxAIL7nJyGq3oEYYEzwz4zukOJlQR4KkWvscKwORv/DmWNIUyCfW4XiDHq1p5KuZpYpLND77Pq6TAt7f4JhZKCvHrB2EZhgC+6kUSjWl3M2xX4Ctey+0C7OL61ndtQOE+Os17RnRQIv/WohecUWrEcQXAMBj5ar7iUuz21wrZqcb+ZQ04/yvHOZo7KtZRSZ96PHWPvmra6RZNb5bwWWn7RYHeyckqkDCbuhwIKTVGQ3y8DJVx9oa//HMVrpKbkKasFE4AKkVe+g7cLHc+Nt6vFoFwnfafI2RoIVfDLMpWSeWyVqWjaEqU5dWoz39CPfkWfnls9p2OHmbRhyc4n43eTbjkJPyqlI448uDToUxvkMGMpbVIx5sGc6OxzgK8TxfYsNfJG63JJGI7oYBR9VaVyPvGGxydJ6v6g+TdQDS0BmiqvGpZcTOpgal/KcWXOdymrVC8rDvfX4dZ+3e8izq5MlWq9yUV5v9051HyYbpSHnDHlF6p58703A0FXGxv9jqOLNZmMd33J6Ia1zjkTQTzI9j9VEF96VQsKgo70E3DAFiyMJHcBDrXHAnClnbImCtJ/IZuLjQbkNfQfTpQflf9+i3h3cwCZOa8ZwfeKFKxSISyc+TtpMWoJEpTTnhKEO13+fCbNoKgtxgoMIXjueSM6xKXTZ3Az7bkyaaKg/zmSaWLw9LcUQu8E/vj82WIMe0J9k33lOPmSs= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TYCPR01MB10914.jpnprd01.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(7416014)(52116014)(376014)(366016)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +6+1ulBT/dI8Lm/6ZAkxYSRvfk74xQWPdmFVh8Peoblz7APHmtsRUXsgISrCG7vZ++yTFWbfU7VJRDqsyOgSBas8Nn0gd8QHWeDjZePkamko3jzD/MHFmKC189KmpeX1JKXz21ZR71XkdDXM02L/7y0Uuv3XxYhRy/OcScNok8ZHOwtqtAX3zKkv1I3BI17cKfkpmUNfv7O1CgItZ1kMaCN7/+WnqfzGBg6Y+qU26jX/je2a9jGED4zcc/n3oTvqJEff9/qKmH+88xNk8FSwm0pslilZVG8q3N0kvW2W71f2BNLJ6pl6lFWLHbybo3LqpaDZl95P4pNyojugJYJKchl7BWeg19VW7LXSHXfjcz/SB0esMyPkF2VRQ86xeAnchDN9s4hf1W0kQ6xTkN1F+8TbCqA3DSSVOAoZshOPlQM9w/XIwGb6GEBvfKs+9mn9UgLxY4Z6Ffr8QzPGUZLXlME8+yLQfT2w8LJ0gciZkFF6eTMTQ7iFSOjoCU/SFO2SwC/1Poz1v9dTg/TF2SEEdLeZBHhWeA9HFKLosXO+wtFAKt8HngjO75UGkBvQ1IcYPrHBlu3JvbIfC/tF51XAuAFfgUwqyRpLwLMygRi3Nnu0T6iP02P5e6jZ4FGq+9KIytS0FAyYGC2YLG7Zc8+sbT0giXRkHke3mbVRd8YvvNZPbeHeAW0rlHs0HwbDNoep/7idq/kPNI1CBszVtLSL792B47iTWC+SDIgfYrUKyHXrtyIq8zLNv9f4Rh9cVYjARM4DKKVIy795J4J+70J7HQc1epHvZTW3slDFsWDxWKe50OlR34CWhIpcx8iNoRjl5HaMnzZQISPLvvaP7o0CUzRQI4N+E6CNnddL4IaE89Nh/v3Z716AzjrLniYFCEMspaI4YiNhIq1iPEXcorUT/6m6gkCF7izzp1PnR2WwjhDrtrLVhEvd5TLnYYSx9WglGttVz+TncbH/4fDTSYnTr3oAUt+16XhxxprXImA9zAWEIk7gxrYUR4oMcqdOdgVAMUfZ1ALGVjt3pPV8loGY/2oBX3E4DdDt+/iEWRKgYgKLHirUxCguhpPyII6e/MXzJhyI7zgsf3sfYzhHzj5GTbnyWeGR3pJR18+g1eMqca141HyvnObu2XpD7g1/Xopokuh8OH+08swecAj1hDN09LZEtO/rClqEHR34Uv72FOy8tBRVFk3Oo+RtpcHksgXkelrR2Vyqp1epf71AoEyw5r0+TZSuW5LG23AKCM09+TXEFrn28coeaAC9PsBW7yZwsX9f7wjAUba4diKnifOa/k5lzohKRlbWIh3OwpmikHfnj/0cCnFs6TkTYX8llr3/EBy9uKzEhTUp0wxqXNEVedqAEhc8qhvQZGcXzTletkKCbaTpbBLYeALPHzM1dUKmvfl9PRv8Ay89OmBvOv9ny+sY9uJxb2y5Nwdu9nfRG8iVAA/wSNXcEIHQ9jWTFXpRfTvgU1kMXspEHRpU4rLRkQboHkhXCSe3KPiXYtM4mNnwWqYWCx6HerLEOiE5e/GKYfg98N1g+yZ1YLzHtWrIcfBxUUTaEFCT+pXINpM0FK2mufB+B/GO7nmuGyBRIKwfesbAG5AMC+QOH9lHdsSd0DKQBEU40gjtjRDE/J/RMwc= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: d9b3d3d0-0c40-46fe-9e32-08dcddbe3c9b X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2024 00:00:31.2250 (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: ig8VZ/yeawlEm9DAmhkisyHvTyf85/O+JLb2hKdUnHI7Mm8PI2JWZ5uBl9ZMtQwgfcLEF9D2xsbA0QAT21UPX/QzUGkdW+1IaiqstcBbA/ONnx7xlvoozbUSb3MuUuMC X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYWPR01MB7353 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Now we can use new port related functions for port parsing. Use it. Signed-off-by: Kuninori Morimoto Acked-by: Mark Brown --- sound/soc/sh/rcar/core.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 9784718a2b6f5..a263e50cccd4d 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -1237,7 +1237,7 @@ static int rsnd_dai_of_node(struct rsnd_priv *priv, int *is_graph) { struct device *dev = rsnd_priv_to_dev(priv); struct device_node *np = dev->of_node; - struct device_node *ports, *node; + struct device_node *node; int nr = 0; int i = 0; @@ -1277,16 +1277,12 @@ static int rsnd_dai_of_node(struct rsnd_priv *priv, int *is_graph) /* * Audio-Graph-Card */ - for_each_child_of_node(np, ports) { - if (!of_node_name_eq(ports, "ports") && - !of_node_name_eq(ports, "port")) - continue; - priv->component_dais[i] = of_graph_get_endpoint_count(ports); + for_each_of_graph_ports(np, ports) { + priv->component_dais[i] = of_graph_get_port_count(ports); nr += priv->component_dais[i]; i++; if (i >= RSND_MAX_COMPONENT) { dev_info(dev, "reach to max component\n"); - of_node_put(ports); break; } } @@ -1486,14 +1482,10 @@ static int rsnd_dai_probe(struct rsnd_priv *priv) */ dai_i = 0; if (is_graph) { - struct device_node *ports; - struct device_node *dai_np; + for_each_of_graph_ports(np, ports) { + for_each_of_graph_port(ports, port) { + struct device_node *dai_np = of_graph_get_next_port_endpoint(port, NULL); - for_each_child_of_node(np, ports) { - if (!of_node_name_eq(ports, "ports") && - !of_node_name_eq(ports, "port")) - continue; - for_each_endpoint_of_node(ports, dai_np) { __rsnd_dai_probe(priv, dai_np, dai_np, 0, dai_i); if (!rsnd_is_gen1(priv) && !rsnd_is_gen2(priv)) { rdai = rsnd_rdai_get(priv, dai_i); @@ -1502,6 +1494,7 @@ static int rsnd_dai_probe(struct rsnd_priv *priv) rsnd_parse_connect_graph(priv, &rdai->capture, dai_np); } dai_i++; + of_node_put(dai_np); } } } else { From patchwork Thu Sep 26 00:00:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13812645 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 998F1CCFA0A for ; Thu, 26 Sep 2024 00:00:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0411910E874; Thu, 26 Sep 2024 00:00:43 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="Az9IIVsu"; dkim-atps=neutral Received: from TY3P286CU002.outbound.protection.outlook.com (mail-japaneastazon11010023.outbound.protection.outlook.com [52.101.229.23]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1056810E874 for ; Thu, 26 Sep 2024 00:00:42 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nAj9+mUOntkxsLKEb1TjyoenrM4IYf5Ix1dPC9+LiyWSoYoHCYkzzCF3l7E1albWJ01hjjMEY6byxKsBrBxsnihoQQC+s7c2nx8Va/4A9D6mgrrQ/As9V+Hc2mMHlCL9QKRs06QYfJlG8iYYvpJjrR8MWlyCfVktEJ4EmDm1k8g87KJxDuR3hCHJStGUhf49JmSl94rtDT4FG+XTRzzQMXGUIkItC4tJm9wQgFajhlaEe+VZpmi04h+DYF9hhGam9y/rudBVY1ZJpD/+z6vRPtJe4ST0EnkX4REGwjLFmeQc4p31k2q6vfrGkf3uG1BcAjoVOESUrzZUOcV4IDJ+cQ== 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=e0L1WFdRrbvuUshCZTpU8W3U4QvLM1atxuJ6UqELmPo+ndyJuHztfUh4RkIs/4VSTKaVuMDxStTK6Am6m/ERDzu88USDT3fDcl44BdnM4dD2dEpSllo4btDQKtmW7ZtSU1fmhrI9LMmTSxAF0faoqmqm/+Ccoj4KPFgfxja7pDxDbM+2lvxS7jm92u9zniukMq1MHdwRQ683VgEafu2dx8fS2lfUoL6d1AulpmHu78Ee5wP44Bc6WmnIzVMmFoBojtATQMtMqVR3dF+0fNr5rM2yia53cdJs/Z3s4U2ja7Z3cy8K6TU/jh6ryytyMXxuzKmXvspmudMPqk6xBRSAhg== 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=Az9IIVsuWUHBz4mMEIR82Smj/kh2UzcWNhbiFqTMKbN9X8tQKnTEw6VbnJhlSXh175GrYmbEiMIV7cpSMtFiCofG5VzRqkTkJg7SieKA2c6p8qrdejZF5RxPpWvQykUvgBVZN9jgJVugmf9GBzdKWFXMVcMBXca+KsfU6gQGatc= 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 TYWPR01MB7353.jpnprd01.prod.outlook.com (2603:1096:400:c6::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.20; Thu, 26 Sep 2024 00:00:37 +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.8005.017; Thu, 26 Sep 2024 00:00:36 +0000 Message-ID: <87zfnv8esb.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v6 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: <877caz9tdw.wl-kuninori.morimoto.gx@renesas.com> References: <877caz9tdw.wl-kuninori.morimoto.gx@renesas.com> Date: Thu, 26 Sep 2024 00:00:36 +0000 X-ClientProxiedBy: TYCP286CA0302.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:38b::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_|TYWPR01MB7353:EE_ X-MS-Office365-Filtering-Correlation-Id: 04421646-71fe-4f3b-d325-08dcddbe4005 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|1800799024|7416014|52116014|376014|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: B5jGYJLZl5glBAPjkXSE2KtLKn8hc6XIPXszVbLv39IMJin7fi/uGVRHE43ynd5NVZu6op7Oy5ewR1yK+6ijsMlQnvf1ps2IG14yzVh/qY+EBtJRzjWc8n+nC2O4XRzbu9lwfJNU+JURUDF9YUkz3xecJx/OIj9VqsGypqQ/Rq8IDgbWmWLlSX7HWWRGo9BRudDXJxj/OX84yGAEAOS1W6EK0WKVgmlRGfR+kLbV4PMF1i4agrcHV8lXzFl9Uwl0ohkd26N7WIuGLOjwevohNn4O9rtuqTYOj/asU6JrDA3LSsJtZ2o58nz7XhuwQcUpjV/sCbPYPFV/k8CAExF1gka/RZXF7Hcckk0m4sPLl+KmQGyt5oVKLlmWCHv6+8Iem9nSpJb55AubKRLa3/KY3uevxQTC8RFDYFs7SnwSLr+TixNVYrj94GmajhU7iQ2fmEC9UkP0p/n7+CCC6dZ/Orm3tXIgKpbZoReW2si9A89rKANgqHLNOpdCPzY5TVAcnX06lyWBXOW8qyOWBH2CrwoyjvF9Rbg5Tv1GYTgh06XkoJ7hAairJ9d9t4JDeYfojmzlPJZWhTuA1a/zYEtasemD8J3QiFR8Z82uPQC96qmt0FlZnMbXXTKAaPCrmGeFKEPXdjGx0cGuPxyABbKWAz0+I/UObfmNQ9lEGhnNlI7wfyDBjz+oM4KlQvrOegaXqDNDG2/2t14iV1/c5hd3HU/07Bk9D5CK2Io65mRP9Dih8RCCvm8BTybsARZCrwbZCvf8UeHO6ihzStWcGv7ThmrtU94pJnw4e0YaMeWIJdVX5nFNcR6zMr6OmwT9pRdDEFNy3necWwNlN5ShzjXb2jGWJxRQq7wRpaXlDjT3wA++b9YnWg7WnNrylgusU3vlZdgBhc2O9hwgCir49M3vfapkdemSjl5P+L8axbvDnxd2nUnrtlAdWqGWHB+dyPAU6IM6+5oAuN0+/f0hbHxeojF4IdqxMefoGlIZFqB1dQl99/ex6P6snmrJulD0ZB14anz9wddt6ylA4LBQ54KLmuoswOe2c5WRlihl6yOWV1MNmlmqJXUU1m6XBkhUbfX0YYhON6Fm+xvFB5O8mcz8IUH5MNwNX7I2VWdxmpSBaf9mIeOpu8kZirtk2NBT1lCdEoUQQZxvbvmIuBsTld9iVjovR+omcOipBshy9VfaQem3RdPIFxns9UyZLVB3k0kyvNj/EeDqSzMDR6r017dGE9tEfaI0KZjpKHSYpPjGrGXcSCK4s8f4Ns4eQb8la4zh0BqwY8LSTpENjFIYKlqkzLcKJ+YuS2/DUYH+kRcoKfncXANA12E9KvUjYxhXMjrN+AbR0eW80wsf1P+typCnLMhg+MwI0dI465jKyT+Qex78BsHYzvMsiv5Ou1CypN7wv3eTLWej6Ba6rtZDxqHMhQzJ1LqL/Tah/82QoOw5wjA= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TYCPR01MB10914.jpnprd01.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(7416014)(52116014)(376014)(366016)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GOEqQ3689Pq0zXFewdPd3NjIsz+wz8nehvR+to09K9EWGIx1dceoOYDnN32TN2sXuVft5wnOuzMFEy/NTESYO5bwopqGoLkY7Eq7Yv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/JCuGb4p7/Y/F2LSmDvgPBxvTpJyawIESsqh2FBTcVkQDESwqrV1U4/556Ar9Ul7rwusAuNAOQ2YHG4ShYiZ/wam3VtVUHGu39jD//bsJKNBZRBqY8qZ0qD0VnlYQa/2DgMFGPtc7pQ49VPLy69S13mpEGv7nb7G/v/ualELOaCNprEWlKzIMFq0MbnhZz8OXwqzvgwQbgi5Y7TKp8chhYVoodBgaPNMLjrlomfOKH55QgiN6JyUPRXjB7/FgQDZpdlyWRyx20S6pAMMwZAVEA80bpWCMoNEBo+AGwRm+Yn3OhEhj8L6GB+dgtIHe9svJdX0/5NCioydkb4D1SjDIAaaR5lKhZGqI9yHPP9wSfb6Yv6XpRmFLnR6E28CpZQNb7D05tGh0l+LgXyJaklhWDpeO58wfaaVKNxx21q6T2ntQY6PzPzD5KUWSs2i8vY4Q= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 04421646-71fe-4f3b-d325-08dcddbe4005 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2024 00:00:36.9216 (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: F44cDCBK/Y5JELMztu2Wh8JPAphj8KqqCC0VZtFVqj2T89BTU3FNbUEI7yfaIZaNs6HYkQL6vk/Qx7ku2veCBrGAMeXn3ato+UdESn0hH149q9F1QvRjPeyk4Vv5FFNt X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYWPR01MB7353 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 Sep 26 00:00:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13812646 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 8817ACCFA0B for ; Thu, 26 Sep 2024 00:00:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ECDE310EA77; Thu, 26 Sep 2024 00:00:46 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="XTTBr77P"; dkim-atps=neutral Received: from TYVP286CU001.outbound.protection.outlook.com (mail-japaneastazon11011026.outbound.protection.outlook.com [52.101.125.26]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6BB2710EA77 for ; Thu, 26 Sep 2024 00:00:45 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=omVmABVIdrkAzaVaHZia81i4jwFJHMW/2M+qT5fdDZEjZbkDT62UpWlrUEq5GfMQqDfTbNc+uQH/pgv3v4QqqHA2zgZLsrw7CiRunMdUmKdCusw5vuf40V4xuWSZmEJNHAiF/z6glHIjJp50hG0jeckh/CFSuNwPaleDA/sEzaJ3wm8QlXyVEi2uBj59HyNT58upDg8gUPpfIsSfi5tR6zygUK6UHfC2VAYrLddDileYKG+r/+wL/NQRbhwIT7P344mgu/HPdvPbEgFOjD7OowUmbsgJqUCAlVFUWuwzskw0FWquWElKpmFUVuK2n+ZiOA3Cj8v3+/OCXA0K2X6ARw== 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=yTRaMbHRWlJcuXDBOz6QXhvp1Ohvj1yuVDPSQBrioD6jzZonh1UYoR2hgV9gOqQaFU2bSMpB3fvd5nms9RrmZN7DFV0SmNES0eWBRGi/COKScvUSWM1b3D2DLuitcXU/tVgxMtNarQe8samJnmLEEZSW57dbUmYTlmBhDBC6PzWNeEI1npe4r0NDmSjgUXDhCtFOTNamf6kZJ5icypSkDE8F5OF1MQ2vRa+GhSjW6/rtIM9S8r5IbsP4+ljEsok0itnVy3OlZV8YkblQYSdv4O6Wej5Z3iJWDSwH+KPtq+ntBPoR0i1salv6aR/sXWLjWUrpTVxNpiPs78Ht2eivQA== 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=XTTBr77PUN8jPm2spZBY3tsTsvsR2cCBXGp7+TS9EfyPdbCjURsj39OXpFzgMTQ1y9DewDhdtvgbp55FmEl0uPafvi8r5xtpi3l2pVlIXu/78V4OWefRP2R1QYCC1DxfEiuEW2yYh3mBWBC4N7ffLCrOGBSp/NXw87uy3Z/gzpk= 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 TYWPR01MB7353.jpnprd01.prod.outlook.com (2603:1096:400:c6::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.20; Thu, 26 Sep 2024 00:00:43 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%5]) with mapi id 15.20.8005.017; Thu, 26 Sep 2024 00:00:43 +0000 Message-ID: <87y13f8es5.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v6 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: <877caz9tdw.wl-kuninori.morimoto.gx@renesas.com> References: <877caz9tdw.wl-kuninori.morimoto.gx@renesas.com> Date: Thu, 26 Sep 2024 00:00:42 +0000 X-ClientProxiedBy: TYCP286CA0229.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:3c7::8) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|TYWPR01MB7353:EE_ X-MS-Office365-Filtering-Correlation-Id: fb81d687-9cab-49c2-bd09-08dcddbe43c2 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|1800799024|7416014|52116014|376014|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: OtvCZfD2tUKVrB7pOagEULywBUHkL2Fot9Lg+7Bcq0BNJ57u6AxmBvWeLuaFMddWFKODcj1de7zb7qJhE1Jbh5xLLVGPKLv+3RmRt5WywEtycgymWyrt41IQvz63tjcr+Yh2lfgePnif2nhy+8g/57Ai+6NiiVPXuUHB1aE5o+6iNCeYVaFYqNMaUF2FceVjUnArzDCyQfqpApd4i0BddOcRyY64z6FyoGq9TjtIafr7n1rtccdQ2+M0df8JqEoQq2SMO4i6smX5v4bxESQoPTW7+AIRNDVoMCGobWh3p+Bybv2PIwH/SgEVj1hGlY2oXq90zCFDMj8AWpbSMbwft2pXzDqaI9BWTFfQkLg2OSa7Wq00LJ8R4z02xF6rmOM2HI4B0Lm8+V3ri7WEbuyK8pOuyx7HHnOqVNkRpGYR9prBAZNz04nIjEmEAY5XNH8HhWWPTlop7vdUYoxXjCusSWuYYyTh5HbsFVCGp5/vhbFcaEGsaSvEmPe+QgP8xvSX4Fk/uTsINEzi63jup+8N6WrquJv+O6jvm0ViDMgMsAeI5+sfyyXEO0a/c6tmyrvdxErk3ckE1xszIpD7kXtoxjLmpOyntrHgAiaH9DuVqqyR3qkpXkVjGAuNaL6ROsVq2WPc3utqpptCwG4xBSDSdl8SyOouQ0ita6i5Hcmo/Uyppp3GoPau7U+MpqtlUDgmRovGmmA1MVyZ7V09DrihQ3uQObtYdYSbln4Aw/ONKmGhNC9oLJzo8uRA62gxFkbhIXzasBClXRwd3UTtkEdZg7ThMVAdjMLwyA2fN4yEu6wiB2yMNs6Pc0Xka9ZT+Tsd2MjaQI135OaVpcYV/BqAzELPt+Cpw5fUdbyKvdHXUXyhM+OXBEGVxPca3ftgao5k9S6mqGtnpMbZgJbTZyb3E2r774gdeII4JV6SpKlaF/0q7pPsdUgvfUkavd8RSQ4TV78AvlwhwuONgFs6ZUit9wM2EkQASawZTC9Zgcm32MC5V0CtO6JAaoerSmOI8LBJMfJGslAHQvpFJmvhhE8qpB0q/vrduseMZYo7zztJHKEsl32uAY5nKouSAWzzHUqZBNqN4FH9B41mXQpfVbxAkL9NsoNJstTuvBtDjV5EszimN8CW/Z75YDcOiRgeNkYM64tl0qyzCOFbIkGZOF87wk/pfAVVlJ66PotwslXLis/1BnO5SUxtoKAKocOIK9V51yJ+1KsY043ebhJ2ch8yirb8yO3ZKmnMMk0mLOPkVnOKJUyGA1robkyyvFCqn+anzAhWHb9gjN8VKOdXDycouO1E/jXgyFzZv6/VCOgxvM+FycBsMBHMA+8iEPze49L5XUPxjnendChK69YeU3ZYB1ju+7Q7r7jQKdsKHLJE4KzpU5xi8gUki4T0XFT1FV0zI6QQruJGtiNS2bs+pXfj0Up3D0eJ5zmUy78x4vLTza0= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TYCPR01MB10914.jpnprd01.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(7416014)(52116014)(376014)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gXTF8AVtofVf+jkWvjMg8BZ4qa33Ywr7E7x2QB4zNC0V2meHm4t47u4qlLWvWQz2ytYa9QqApndtTQJQZlmp8XkeR4ptAd1uJ7I5MHoxRWgVzEs/jgW9XAbFaown50wSixt5GJqwK3udDXyw/Fxo6yZbK5E8Gc+96x7kzgMa8B9sDAAVXxSMYFd/bMbV/rRtM6YetGVbO2OtpVm0li1FS/eWO4sNbS6PsXKXNY3yDaX31pJSKR3B2nFfJGr3Ni5jmKPcGcfUYDBtNPDV2gH3mMUXHJQPDUhU9Syc2F7bzb4uZy1n+wWmLvYGa/KRJT32TLG0HtR5L1LNVwvhXdRtA9hRmyMHEdBTJWKXe2lmFJ54ypxPyFEK0CgRoTi3xlsvRCy1d8IAcwqjhsedUY2IlaWkJPU+jj1mTgYQJdK1VnwWXa4hrk4/i4zindEzCVHJO5KePVgObc8tn6S+2fIRL/16fTxk+9NgthLo9kPlrUCEysHk+inGAnU7DjufuZ31DMGe5Ku50C/W59iN98jIiNwWCy0MWRC2I4YZ/wOfNGQSAWFIN1fPj/khLDbEp3k+fvbd3A+eJ0uWyNoBJt8ZFd8R87NLmww0vZoWcgIWxbYjnjbf5EQmK+dOfdJ4CNBIItOiYc+5KyU7VafCkC1oaSyaSwlY= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: fb81d687-9cab-49c2-bd09-08dcddbe43c2 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2024 00:00:43.1951 (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: ouEmiL8MEoUDqP6kAB4twwvPWWozvX05MZzmdzw0MFCbO0GCltkAWh/iTYnZKrcSFtK8kMw2XYrTLSUR7n8D7uqCPUBusvp5uf9V/O/C6dwSv4u3rQEp/88qzLhxCOix X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYWPR01MB7353 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 Sep 26 00:00:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13812647 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 7E1FFCCFA0B for ; Thu, 26 Sep 2024 00:00:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0771F10EA78; Thu, 26 Sep 2024 00:00:53 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="PRlzijjp"; dkim-atps=neutral Received: from TY3P286CU002.outbound.protection.outlook.com (mail-japaneastazon11010039.outbound.protection.outlook.com [52.101.229.39]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2577110EA78 for ; Thu, 26 Sep 2024 00:00:52 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PAJSUYIfmhIfjNgP1xaFjUng7WY4Ng4t6FO85ncHMHQ0krvFOkaczp1aW5H9n58XW+HZ7NNXWHCP5w6fFckQ5I469y3cBs2ibGYBGKVGoJD5ioP6H+eAGeMsMB3c80rF+aPJdbKWgZFpaRz34YX92/paKZ+zUkLG9Ji91RsXmnoQjXvWnoqN9IFnwY/L8INtDB4GwHvN8FtlNMRsnVZMsD1QdciSTekjh52ZHKoS4o+XiroTooXMBHsOSnAioJINT/1j9Zefms2sMGkILpZO4a0oghVBOOFpWh9yanhsoXrP4jV6hdyHpVHCHO/B3AleMfhcqQfk9qGiwWGfsNupmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1UeslM4FQH6N1O2L6SqbvVyNONUE0o4X2TQYeq8tCfA=; b=CakL4hMJuKqjel33KfEcSE9Z6/IwVNnhHvA0umaLDXsbmrtOZHfnhRgWhO8A0KBsM4b9M7S5ikrLAHNLQ661fTE4XcLqYjlWjb6a68Wq2w9J6rWThCtxGYR2leBGwkcoXXRVJaplGOGUiGmem1xYlcgJK5/tJy25BsjF4gSKFzUhmo2ig0gUjjPQKWvtBWsmUmnSgXtTyejTzehcFks0w8PDnkxU31v6VFtj+9f3PoWQ6A7eqZI9j74/oEugwc8fwemQZaQ7KU6OZHTeqC/RjeMIMthZWEz26hP6utSSSoh2/XxxmO+maBI7xB6puMDHc1V8uVY/y3gm563yWhmc5A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=renesas.com; dmarc=pass action=none header.from=renesas.com; dkim=pass header.d=renesas.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1UeslM4FQH6N1O2L6SqbvVyNONUE0o4X2TQYeq8tCfA=; b=PRlzijjptb1esJ/NgsbnDtsJYwlbIhssOuGM7d56iUAlAZe6rwrk5qVoyzMqed9MJ1j61IaZJf0sgmcWM6HlytFGQFOa4MIWnYQsAMjqkLYSHEoQ2dUxmQAoVoOCckbfKQgpyatOBK/OPZ0p57q4pzx2B6yMy3cPMCtL8bP14i8= 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 TYWPR01MB7353.jpnprd01.prod.outlook.com (2603:1096:400:c6::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.20; Thu, 26 Sep 2024 00:00:50 +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.8005.017; Thu, 26 Sep 2024 00:00:50 +0000 Message-ID: <87wmiz8ery.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v6 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: <877caz9tdw.wl-kuninori.morimoto.gx@renesas.com> References: <877caz9tdw.wl-kuninori.morimoto.gx@renesas.com> Date: Thu, 26 Sep 2024 00:00:49 +0000 X-ClientProxiedBy: TYCP286CA0168.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:3c6::18) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|TYWPR01MB7353:EE_ X-MS-Office365-Filtering-Correlation-Id: 82d40018-6afd-46b3-c967-08dcddbe47cf 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|1800799024|7416014|52116014|376014|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: HYFTxsEoLKr9LV1wd5ypHKkJFQdWFiADguWj/ibDr+eG5ncrQbExrhxZYSbJnwgHCJcUKvlEiWtIiHCKwT82I9ntxGhFmqSEUkp14FrKbFTkANpWPROlxa7tYuoAV0QT/+4AxLRk/24Yn+EXtIAxvUm7wDjxv7Ib14jVyL9W6qAuNOpZroR4Zgy1WtN3H563LDjhnl78/a/MKsKZymlxM/v/B1Rdu3yssW6u/ddWvRSfUE+vdks9VHVkYCpaq+CeLhOk/xwBiJPcsdMeqmZngxSGHqTeniadtDC81QoeHw6Z1IRS99aMPvhrm/j+dn5VntN+reSC2mn4eEd0WdLNHoGXV+Dx58R+jOOI/uSYbxK+gCmsN9Q+BviLptp6LE1t/bjbVVdUHAa6rfL0QxW4hDabMvAnU2lMRSZd99BjGIOS0tg9bSD2wDUy7et9wzRKr+48a6YaighPH64vo+q6S3GsbKE8x44ZKHpoLFVXwHxRCkLSK41afOJC3PJmfq+PX2AcQLHuDHxNiOffegH7RYzOTDEz9GfxMtbElI7UPY2q59v2+f1hv7m1Itoe1KCwKmYHyytkYstYxMcOW0+2fwiBhinzomep7AsyqqxrmqOFmsfQeiFUb+JLLfWwwDjvcZYe1IlwAd55wT/dehBjAZnVnds8D3i4hx2avimUFium43PuXNXAi6KjQoFzYjbBgszhYBXm14wUtKNjmb7C7OTBiucy4lz6yMGun89iHtKguiSSFmCfaOSs367X/twb5SjZrFTs/vgib7Z63EDmaUPX5cC4g9KdoNthUEV0iTU2m8OqyOwno05HYswntt5MKK83C9BhKbvCjGfDlFKqaWZPBVqZWGOOSB34dB1TNtSpOBlcy9HVPdSx002p89e9gHECTZpAjqnQoAghcdnW48rfeolmU8RMbp1xUIWGodMgOIfunfBZQhs2De9i0tjw1cOcexA9EgcB3GdDUVjnk3/16iWksaQqoRWV3zrfFwGR93etcnfm2r1MZT+OL0x868ZRFoSDwyOcJWOfXsHjxuJhFiSSlWCbYSKmuxK+5ThQ1GC8KTZBA3TwqNTClnVQVpZ+qoWOJBXEY9EgB4GI6Q0g+Z4GsfuJ3dfnYeqKSaSvW3F5WnIK285auU/2egxA9Q+u+nhq/AePsuzk8vjwtgYzjzSTanTOgx9pfbK/cuR62Hqgp/+0iBbB2GhPAviywjyWqT79oVvYBetK5f89HuzEU/wCCWnIYYoUC6X0QlFnOHbfoPGI3u0ht8tWB0pIRjCLLBHfKHXth3jkheIzhW0HpDQNPVi5z1UBngQCBs6xH37pRDpJE9CEjY+hOCnirt9yTHYDDbnIxqTxcpPRmz02894rvP7gKvHe3NHpe54UbyOAScxVc7S0lo+nn/++yW1X9E3P1c9/TbxN+ohrXpqD8aTbIdaz+X+55LSpzsg= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TYCPR01MB10914.jpnprd01.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(7416014)(52116014)(376014)(366016)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0SGIQ4Kw6jSapcfSvwx8Y7eF3tSnbD5DgQ/5ImMFovsmSo4mljeQAilcaztHEjkrSkBeUmnQCvLFV0MJVDdawDPCNppE0HxOSS1GarstKb42ZAXcTJ9A6p5ZujFlcVtM02axd8Go8UdJMpdSX2qjVhRLf5ofAQ53cZq8Whi9GyvPMzGi6vBYDqzZqyZlOk7AzYt78HNTn489+WQtelmj/0SSbX7kUwubN8CBPEjQiIzfF+GqKKoDjpnbLDtO0YEUZrQvIo4u2NT7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8WZP/XV2Dm3xziALPWnBE9ugbhTCu/k7KwB9T+TLBOktUeQapmGILh+nT6Q2HTfz9lSrrdJ4zuqWecJJ+PnQQCPQqIK49JIa5L8iYJRQjDNsTCpoSLeI0plT8W8bvyYJRVxKPm7L2uuIg5FGW48Zm+zJ+1Csja2uPksJUNAgENvlLY8iglgz03STXZyAWalpRvriHRtta+MIQUnVz5e5Hdtpv4Q9SOPb4EKe1b9gTmiU/0s8H9KgHTqA6O9YEqILgtT5POhmJnK9PMV431iGRXFOi2A= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 82d40018-6afd-46b3-c967-08dcddbe47cf X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2024 00:00:49.9719 (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: vHpLAz2bG0YDbzPP/MhdovWHBGFjqsZ5yotp1o5HKYEXQbpWZxINVvBeVF0oGVNcyaq9ddy5jcLVjLODUnD3BcoDq/PPoaFGM4h0RfGZehcEUHldD3/HqzYAGSNj6Gdo X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYWPR01MB7353 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Now we can use new port related functions for port parsing. Use it. Signed-off-by: Kuninori Morimoto Reviewed-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/dss/dpi.c | 3 ++- drivers/gpu/drm/omapdrm/dss/sdi.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/dpi.c b/drivers/gpu/drm/omapdrm/dss/dpi.c index 030f997eccd00..b17e77f700ddd 100644 --- a/drivers/gpu/drm/omapdrm/dss/dpi.c +++ b/drivers/gpu/drm/omapdrm/dss/dpi.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -709,7 +710,7 @@ int dpi_init_port(struct dss_device *dss, struct platform_device *pdev, if (!dpi) return -ENOMEM; - ep = of_get_next_child(port, NULL); + ep = of_graph_get_next_port_endpoint(port, NULL); if (!ep) return 0; diff --git a/drivers/gpu/drm/omapdrm/dss/sdi.c b/drivers/gpu/drm/omapdrm/dss/sdi.c index 91eaae3b94812..f9ae358e8e521 100644 --- a/drivers/gpu/drm/omapdrm/dss/sdi.c +++ b/drivers/gpu/drm/omapdrm/dss/sdi.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -346,7 +347,7 @@ int sdi_init_port(struct dss_device *dss, struct platform_device *pdev, if (!sdi) return -ENOMEM; - ep = of_get_next_child(port, NULL); + ep = of_graph_get_next_port_endpoint(port, NULL); if (!ep) { r = 0; goto err_free; From patchwork Thu Sep 26 00:00:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13812648 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 31CF4CCFA0B for ; Thu, 26 Sep 2024 00:01:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A275210EA7D; Thu, 26 Sep 2024 00:01:04 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="SKPPIrg/"; dkim-atps=neutral Received: from TYVP286CU001.outbound.protection.outlook.com (mail-japaneastazon11011049.outbound.protection.outlook.com [52.101.125.49]) by gabe.freedesktop.org (Postfix) with ESMTPS id B359110EA7F for ; Thu, 26 Sep 2024 00:01:02 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=We4fH0NaDwx+JLYbzLnRL2KvBrJJrHWIMg0piBwz/cxfBN2HDxRyMbNrEnx60vf7fYtkwjlagdzTzc9wvbb3ZPQ6JW6gQmomUaUobCQMWi57VSn9d/QoFDgtImD9MCWBvNbudkkR1i42IgASckeL9bPuvVj2xaPRXLGuumPwH+Y5xtJ/NMzsWnisSs4/tba+ZD1pA+xIiW4/BA0G8tOTOKjRV018UpU/D/Mg6fdbSDlDh1Obd9BKHIy/Cn/nY0YAqu4yNPvbM+Z82aMgV4rsQx5ouLln2eUBRtc86dKEtTtJRtCHAQ3YLqFlsmwyKAf91pIG6rH1wn0hvmM+Gsxvdg== 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=DHgw6GC5axbivs2dQKRUpOp7ZjZ23MoMVhFLEtfLidc=; b=ZZO/wnDMYb7gYWFL96MVSAQvM7YwWuva/HM4VSitNq7A823iSqNA5Iia53I+Ftgzmg9MaH1Cqw5WSYwNOAmUOOMze/zpf8vBxZP97LbUEJqDt9V0glppLbQUFQw4MrtypyKG9DOA76dtQu7kp6RSUYFTokXU0LeVi+s9D20uAhTUurY9TENgkoSo6WXzZJZzQIzKEgc3orkYQAsiEP88nGpPIVFtxQdEODkRTKkflDwrK9RFwAFrwPycw+MkeSzyD9p0TWzhmZ4OJBXWVEWjFFaSAxdX66fEu+M6lRic8J1qOCkG6fOV7hHsPZVKrrkvKZy0fhHoUdiWThYlMua9dA== 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=DHgw6GC5axbivs2dQKRUpOp7ZjZ23MoMVhFLEtfLidc=; b=SKPPIrg/7nIKr4rXPtuyfC+VMnej6Nr9MiEYSdlOtY6LK2NUPE3LhmCKCYBtacG754AFfuIJlwVnKQ+893Hp4j2CWkI5lds3uXPABkKX3P9BRiyoHrux2OsttjsPbEpoFxKfxDdnwGk4XfyGpsDwIHksXDoWPgx0/gfi8HLMt1E= 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 TYWPR01MB7353.jpnprd01.prod.outlook.com (2603:1096:400:c6::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.20; Thu, 26 Sep 2024 00:00:57 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%5]) with mapi id 15.20.8005.017; Thu, 26 Sep 2024 00:00:57 +0000 Message-ID: <87v7yj8err.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v6 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: <877caz9tdw.wl-kuninori.morimoto.gx@renesas.com> References: <877caz9tdw.wl-kuninori.morimoto.gx@renesas.com> Date: Thu, 26 Sep 2024 00:00:56 +0000 X-ClientProxiedBy: TYWP286CA0018.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:178::8) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|TYWPR01MB7353:EE_ X-MS-Office365-Filtering-Correlation-Id: 413bf290-18e0-4108-9ee7-08dcddbe4c22 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|1800799024|7416014|52116014|376014|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: H4q1AeKSsf7tsqQlojcq/ps3XqvTFzJh8PgO9qYlQFg2qD7aSmWBNBfGKB7RQ3N/Wxcic5afepLKxkFm9eIs97XvVdqPvwJ3Sr1Eoter8p5wIeWPjp0Pm8wEacmbd5JAwP7+/jlHhOihU0OroArojWQHWk6Inf3M9Zk28TeWqoeZsxrrdsulDL0YxxfUuaQc96UMCC89hUm9HwYYAGT5RQq6JjktnEUnTdnzuoOxIwclyUHWQJyXFN1xzeejcZTQRjZYv9UKkDgo+hbQDtRE7Szd+a0CFOKrxXC831mMxmEC99ZICYPZKmq4+eyxksAtV0v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rBcLVGagODtZj3g/D+Gyt9xsCK5MHxidam6S/GlKwwu63I+EyM= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TYCPR01MB10914.jpnprd01.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(7416014)(52116014)(376014)(366016)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5hwo+WpRS7mDP1AUBPIP3SEM0ADBEqBzD+hD5dMfvULK2mSsgCjft3KBr319xh1kxS7CWbdGPDp3Ut72M8zfb+L72scH8xjFo5f0DJ1ppISNYTvVVkZIoWJE4ZX0frzapnFqNPqoHGbQBY+yp2L3xfXomjdYyXZxnaWJdMRcra1ZjQfTRi5B8jn3w00rnf5TgsD8snrM+bEFrBIeLmsa49S+7D8/9u6ccaPHRriQ+xTDeA+hun7HzeUTsPHZ82zVlk1vPIhqM8UVPn7d1NDZuOO2SstcxvHpUBZpky+8euGuLHeqwqBMkb4i0uTfgT8XsITbrCtTqlRiDeN15PB5OgP6SgWkML7o5uIV5FnGFlxjyhQ/Nf110XRlXrcC//gyMSekBAADFZgR+kvBDTPlc3TCW9bRHCbxngexYGJBgs9KC41QVFVWUzN274hC0j4nrvizYlg6XwSYbNE9WWxhZbwz3o9YcOQThRjZ5ed48F8gXQDDyJLgolMyuI4OneK4Q3Qevnelp0KVFuwKCaGOyXzqR71LS+63XAOocV+9b3YwRcKHIC0hCi64iUNzb3o1LRKX65r6R+9ZaMuz4C3Ts7rM6mehJOTyq0mJKTKKEkfZ175J8PhjwUeSpaLPBuAL2GQeUlDJLSMyrlb5lKkEm7AQWdRX0qi6Yt6mW3xTT/MGGlezEAhrfibeGvI84ZAv31vhkEHgk2qniRTzXgLPUifDFPGA1kDxhu0734YouPq8IYWO9F+cyxboFFK6hNv3pNpwLdXnng13jj5T5Z7NkgyOOWVrQKKZfKpihj2nanlnFRymovF0fDpXHVPZ/Le/UeaiEGcCsd5X2OKFOWTdVaVG8MKqECH20Ut2GRDo6DhByCr0wAfZljyL0ITx31FZALrS0UjNwWqv8OKQkEkrGdHxImGx/A8kQHuj08sVz1btYVSRxQdWowpAh+Juy02pvO5BGH4k5OkVhZdbK9N3WODEGESO4lteK5BdI7oHUSpOmgiNPe0G1mkVdW746Vo/e9H+7e2CYW2IWugBGxRzBXAR8UOOs5llH7nlPDWtwHCxLZeewbgHMzDDb1z+AvYVkC2OkWd4Ed2W7NHHFqFiRrMLAONQpD0b+iLNrHmDKgp8O59455A2VAbxEZfsieszaWnPcKWb0AGqAASwtH/pKcfxI9P0VsF3NQ5glsFx9/iLv6hAxQI3fHsYYgAi4M6vYzTzG6b9uV3CAwx0AlQlUVXjFBxUVd0XBNLJhG08dSyRrBECWiktJ6l4TMZVZHXNkFB3B5MZMbiU9xkOIk8wsuqCLLfOCsfrVw9A3MrFKYoEu8HSJQiUAkCwIP0T20LWpj8wVE3znnPJS2XS4dGPpN1IRwRuJcJ4RKDAOtgKmao4jIMc9rCD77jtdZVkFlLFL/xwRJjECwNPuld+NJoU27DGdjcKSqqy58KA7Ib0917WkRH+jDjhc2qo/D7d+JS3Gny6rki5+NW0z2t+S3auMHX4ctBP+LbLfbjFhVUmDWrgotcIt+60dr/ZllQnpP8NPXXhQqugpK4X5R65Mf0TF0Roka0hEz3F4KOOdi/z8WjLi2Dq7QbRp2JBsQoYEE2VUvYVcAxu6OzDI4Ic779DQl1jlIfSBRic8p8XhTPu47M= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 413bf290-18e0-4108-9ee7-08dcddbe4c22 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2024 00:00:57.2412 (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: cy/faLtCqcMCtZpeqWHLQUPdd2ZCVrUBQd7rTSMCDUSUmEh2LRtWWY93PoTxCRcgSp/+97httCxsZ+jNEetToo+qB/fT10/n4VpwjPQvVKzax3Rfi5dAZpVJGBkSIuI/ X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYWPR01MB7353 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Now we can use new port related functions for port parsing. Use it. Signed-off-by: Kuninori Morimoto --- drivers/video/fbdev/omap2/omapfb/dss/dpi.c | 3 +- drivers/video/fbdev/omap2/omapfb/dss/dss-of.c | 66 ------------------- drivers/video/fbdev/omap2/omapfb/dss/dss.c | 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 7c1b7d89389aa..395b1139a5ae7 100644 --- a/drivers/video/fbdev/omap2/omapfb/dss/dpi.c +++ b/drivers/video/fbdev/omap2/omapfb/dss/dpi.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -845,7 +846,7 @@ int dpi_init_port(struct platform_device *pdev, struct device_node *port) if (!dpi) return -ENOMEM; - ep = omapdss_of_get_next_endpoint(port, NULL); + ep = of_graph_get_next_port_endpoint(port, NULL); if (!ep) return 0; diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c b/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c index 4040e247e026e..efb7d2e4ce85d 100644 --- a/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c +++ b/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c @@ -15,72 +15,6 @@ #include "dss.h" -struct device_node * -omapdss_of_get_next_port(const struct device_node *parent, - struct device_node *prev) -{ - struct device_node *port = NULL; - - if (!parent) - return NULL; - - if (!prev) { - struct device_node *ports; - /* - * It's the first call, we have to find a port subnode - * within this node or within an optional 'ports' node. - */ - ports = of_get_child_by_name(parent, "ports"); - if (ports) - parent = ports; - - port = of_get_child_by_name(parent, "port"); - - /* release the 'ports' node */ - of_node_put(ports); - } else { - struct device_node *ports; - - ports = of_get_parent(prev); - if (!ports) - return NULL; - - do { - port = of_get_next_child(ports, prev); - if (!port) { - of_node_put(ports); - return NULL; - } - prev = port; - } while (!of_node_name_eq(port, "port")); - - of_node_put(ports); - } - - return port; -} -EXPORT_SYMBOL_GPL(omapdss_of_get_next_port); - -struct device_node * -omapdss_of_get_next_endpoint(const struct device_node *parent, - struct device_node *prev) -{ - struct device_node *ep = NULL; - - if (!parent) - return NULL; - - do { - ep = of_get_next_child(parent, prev); - if (!ep) - return NULL; - prev = ep; - } while (!of_node_name_eq(ep, "endpoint")); - - return ep; -} -EXPORT_SYMBOL_GPL(omapdss_of_get_next_endpoint); - struct device_node *dss_of_port_get_parent_device(struct device_node *port) { struct device_node *np; diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dss.c b/drivers/video/fbdev/omap2/omapfb/dss/dss.c index d814e4baa4b33..70bb35ef48b5b 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 d527931b2b165..22a6243d7abfb 100644 --- a/drivers/video/fbdev/omap2/omapfb/dss/sdi.c +++ b/drivers/video/fbdev/omap2/omapfb/dss/sdi.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include