From patchwork Wed Aug 28 05:11:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13780545 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 ED51FC5472D for ; Wed, 28 Aug 2024 05:11:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 50E4810E497; Wed, 28 Aug 2024 05:11:42 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="UNidP+Dt"; dkim-atps=neutral Received: from TY3P286CU002.outbound.protection.outlook.com (mail-japaneastazon11010037.outbound.protection.outlook.com [52.101.229.37]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6915710E497 for ; Wed, 28 Aug 2024 05:11:40 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tQJrf7fP5rpcErzN6iDM9WTIZrl9gF+gpUA/kbPERgCTPX2AYfdFTurs+pbhY1Fm6eckIzNjqm/fmHQ41IryV7F4inohlfNMVu4hYJPXJw/OTeol8NOU6JL8iW/s0wLdFyDvPGRYN2Av3yhvzhn4r40JgRPq+/9Zo5gpd6LPyvQPB3HTG8nQoCyOi+wTEOQsT949WRfHNtr7OBliz+mtByDdXFpeP6Fpb+a5nctjKB8AyAoZ141qGOu9Eog5Mh7AYDDYqiceyy/MdIQTgLR8rcwMJJ9Px3MFLHNm5Oc8by5el3qnmm06HTdHFUcEAyFz78J7wcxT9z+VKOrjUSWtGg== 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=qZ3Q0/mts9BCJVhMN6tJG7zq3/dJiWfL268lC4wgoW0=; b=YHwlnihB4aYZszRb3Q3/9hKU88gQ4iS3fpIaozuZ/kNuqg6peynpj3o2JVreb1eL0HQscLTfXauuJvOeZ4ujpSNbrEIpcFO+mt5FA/Oz/3aynxrkXbeGfxiFen6dfLXaetJWE6WdGtJzICaU7KwtMbEvosepRJz/Oer9RlxB1nI06FMI3mKUHebpWhT503ogHwHXXUOqHu6U4GdA5jw50p+0dg8VIKUROuW2CnLttk4ukTbycCyinH0GlD0jcxfXcfdhlPuc4NNZcWKHvzfdNb7zTDE/0Z4Gj5RGf7pRaj1B+R8MaD9SpvGk0BAStT7Zlk+e76l4SEB6+dK2thqp1Q== 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=qZ3Q0/mts9BCJVhMN6tJG7zq3/dJiWfL268lC4wgoW0=; b=UNidP+Dtkfmynf+aLj+Tktq6LENGudp7F60a3B0OFPp/eqmbZ3PjZE+VOFBZ6iWXLVZl0GLu7p7xIiIwoyk2DixNZaBXnBATyo3mkB06x9DNgmHmht6IOYvjxmvTkzAa/85ODq6UgHJLBLEJB1JbOKN7qP0j1V6s9uafRUZ+Ffo= 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 OS7PR01MB11955.jpnprd01.prod.outlook.com (2603:1096:604:23e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.26; Wed, 28 Aug 2024 05:11: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.7897.027; Wed, 28 Aug 2024 05:11:37 +0000 Message-ID: <87a5gx2pva.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v4 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: <87bk1d2pvt.wl-kuninori.morimoto.gx@renesas.com> References: <87bk1d2pvt.wl-kuninori.morimoto.gx@renesas.com> Date: Wed, 28 Aug 2024 05:11:37 +0000 X-ClientProxiedBy: TYCP286CA0005.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:26c::9) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OS7PR01MB11955:EE_ X-MS-Office365-Filtering-Correlation-Id: 99f1c982-bacb-46d7-ba70-08dcc71fe4b2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|7416014|376014|52116014|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: qni01Wile97Zj2T1KyRKapfuLbGz/YfU1Xdccu1gKeoHj+4A6xY367PTjCg6X5TcplFnATnzTkz918uugu4boHlmyp9Pe9t6Ry/GM7Aa7tclcbX0SB2dwTLl0Xq6dlH+vnesrrO/32j2PxDdrm7pz5+E9DOTgbCGK2nfqk/dJXQIOb/i2O08OyLsKd3Y+NzbUgQOrhzLkhqNo0bj+Gxoy/WoMlXCJxHkQGIacgL69teLu+KhYsQq7hXE7AznLiLhN3OUMfowxgrTSl4Hw5Ek8g4KpiMSNYP4T3ztomVBffQ8WKAwIQEBnXgZlu5RarUCBY1OcIpjKiq+Wv/nlv/XhQM21I7taVODYAcumk+2fwztui0i3hHDMQZWFBN2TXNk+U7V+W5n/jgakqlctE7s3a+JJ0AFmH8CQRs09rJkp9QYX9oowjmEQBvsPBd4q0cVBsgts6L2S6+GIukma7eq1n1rFeJfqOj/eFID5L9lXOAWzPCHTZZriO5tWjpcPf9ISpsB4bZ+G12UsdvPoNzHqR9B43grzdI16BQePN2CcSCiUCM2zRkjI7DZW8vKPBbQMGclz0PYSFO03KXWiis4QX5SFBbAP7HKmJaOhqwtk98vODiFrJ/OsrWibLQ694dz2vBgVFEeeKSOYYXPLjRBvjsyBkuCl5AyEo+q4TALoqSaTHK02p+meQrJ6fI+Iv5o7oNDbhMKHnjbAraprPUxo5CvgOvciwbJ5lZ3zKrsgObVOr5zW2YsxGQ6vt1AALN/bqoXHFy0105cGCKocT+/yGym5fGUvrJ4FEm30PktpEectNj/1u85Zr6G56FEyPf6kObopI3OtZaIhBg9FTESFST6x3Eie4XReeus9Vfy1xFE0WMRyhuTEtJFhDQhN2V/Ib4lci63lm2k9Ea2hRepP34puRmJQEx4SMCo93b7BGIQb8uP/lK7c/MfKVkmelXrLcqVA4fg/49HGp0ZD8t5lVDBRs3xbf3MtU+pjis9fDgfF8qcg/UGejGUICKweruFrTc1ykHkgQTZI0YalYZbnXpAikBBO9BJK8HvljtgHmoHj7FDcapx1bdDCpWEXhYBbKhY8j5lc7f/Bg0K0tF3CyzzVQd18CG4HSb/GWvT6YFrEcRcGo0RZDnS+7/4BBpcNzzZFLwHtvTPAWqWPgjwrhKPcnzRA1pqDDVAMVW9L1vQwqqnAO63Bc3l8rl9f0yuWJH+lwYN/G2wyAVVgOZxzoXSRwQMcq8jOg9YmHr53HDnz08H0aPNsHmDxO1PaXFkfgw7mOm63+Y2psT0BzqkcNuPZyKf5d7xRWHrN3E/yByFmDWCFdHKd/1DQUvXy6xzraR1JG82GLiJ1Ef34ZX+SnDq7QKt3TofE2zivipYFsQWFic6XWWFbTbNkSfLXmK8fOxsDTjeIur0CckaGrwbEABanCQO+mfVIAYjG/Tt0nE= 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)(376014)(52116014)(366016)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lA30kb00NFGnDco5ddsOb3FUZQcrxcpumWAEDjfKZODWMtMOiN2ZbVrizutomnGXRmXUryxAP0PYgUb4Z5MyqID/lo+08m3q+m4lpVnpJIRYIv+ESNlsarcUo9ejpOAlLttksONde953Z5L9P5EaVorTcOo8UxKN4553OObt6v871vqVPlCNypqZ3IhtHMtJ87CreUYAtw93EJPoCWoAbOhOV4r6dRNMNvWyoefNSYNINb44imsRvU/AmZJQhYcxEO83wWrJdVSbyAw4ChoSSFMdpYoV5ifavKWEFVkKijR3Mm2KZbbwdxJQruM2FFjgnPFecxEixYa3WpBpcY+ojiPnFwfPSq1hr/PVQ7W1diOSMjw22bhGd+Chy7zLGOPfBMl4I0EY/EozNJ6Mk8NVXyW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DlvE/QNmpp4yMZcrzSsD+IK3LdvIxS+gXGo3J9i4U+cgUW/bBt9BfhDweAf+PenXkx4sr2TSpcsMltwZ/rVNnbMqQwXpk6wR00v5VTOTCu+Xbi1i1gwe7uWcfN0FjpkAkol5Q25Qohw0rL+9CjqBT6cn62pBumPESAff0= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 99f1c982-bacb-46d7-ba70-08dcc71fe4b2 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2024 05:11:37.5392 (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: 6gNkqrZXjqG5lpnQzwHFzmpQ+t/aKBzBqOsoUEE/r7LUsnGFUes/Y7TH/NsHBLaly2stuYZFQIz41NobtqIjwyKnEwr3l3WERkNu56fDfCbocRVAcbfnGjl/jmwnfXsl X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS7PR01MB11955 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 | 108 +++++++++++++++++++++++++++++++++++++++ include/linux/of_graph.h | 49 ++++++++++++++++++ 2 files changed, 157 insertions(+) diff --git a/drivers/of/property.c b/drivers/of/property.c index 164d77cb94458..d99b34dd2d5b4 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -625,6 +625,97 @@ struct device_node *of_graph_get_port_by_id(struct device_node *parent, u32 id) } EXPORT_SYMBOL(of_graph_get_port_by_id); +/** + * of_graph_get_next_ports() - get next ports node. + * @parent: pointer to the parent device node + * @prev: previous ports node, or NULL to get first + * + * If "parent" node doesn't have "ports" node, it returns "parent" node itself as "ports" node. + * + * Return: A 'ports' node pointer with refcount incremented. Refcount + * of the passed @prev node is decremented. + */ +struct device_node *of_graph_get_next_ports(struct device_node *parent, + struct device_node *prev) +{ + if (!parent) + return NULL; + + if (!prev) { + /* + * Find "ports" node from parent + * + * parent { + * => ports { + * port {...}; + * }; + * }; + */ + prev = of_get_child_by_name(parent, "ports"); + + /* + * Use parent as its ports if it not exist + * + * => parent { + * port {...}; + * }; + */ + if (!prev) { + /* check whether "parent" has "port" node */ + struct device_node *port __free(device_node) = of_get_child_by_name(parent, "port"); + + if (port) + prev = of_node_get(parent); + } + + return prev; + } + + /* Find next ports */ + do { + prev = of_get_next_child(parent, prev); + if (!prev) + break; + } while (!of_node_name_eq(prev, "ports")); + + return prev; +} +EXPORT_SYMBOL(of_graph_get_next_ports); + +/** + * of_graph_get_next_port() - get next port node. + * @parent: pointer to the parent device node, or parent ports node + * @prev: previous port node, or NULL to get first + * + * Parent device node can be used as @parent whether device node has ports node or not. + * It will work same as ports@0 node. + * + * Return: A 'port' node pointer with refcount incremented. Refcount + * of the passed @prev node is decremented. + */ +struct device_node *of_graph_get_next_port(struct device_node *parent, + struct device_node *prev) +{ + if (!parent) + return NULL; + + if (!prev) { + struct device_node *ports __free(device_node) = + of_graph_get_next_ports(parent, NULL); + + return of_get_child_by_name(ports, "port"); + } + + do { + prev = of_get_next_child(parent, prev); + if (!prev) + break; + } while (!of_node_name_eq(prev, "port")); + + return prev; +} +EXPORT_SYMBOL(of_graph_get_next_port); + /** * of_graph_get_next_endpoint() - get next endpoint node * @parent: pointer to the parent device node @@ -823,6 +914,23 @@ unsigned int of_graph_get_endpoint_count(const struct device_node *np) } EXPORT_SYMBOL(of_graph_get_endpoint_count); +/** + * of_graph_get_port_count() - get the number of port in a device node + * @np: pointer to the parent device node or ports node + * + * Return: count of port of this device node + */ +unsigned int of_graph_get_port_count(struct device_node *np) +{ + unsigned int num = 0; + + for_each_of_graph_port(np, port) + num++; + + return num; +} +EXPORT_SYMBOL(of_graph_get_port_count); + /** * of_graph_get_remote_node() - get remote parent device_node for given port/endpoint * @node: pointer to parent device_node containing graph port/endpoint diff --git a/include/linux/of_graph.h b/include/linux/of_graph.h index a4bea62bfa290..d5e9d0ed3145d 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,43 @@ 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); 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 +103,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 +121,20 @@ static inline struct device_node *of_graph_get_next_endpoint( return NULL; } +static inline struct device_node *of_graph_get_next_ports( + struct device_node *parent, + struct device_node *previous) +{ + return NULL; +} + +static inline struct device_node *of_graph_get_next_port( + struct device_node *parent, + struct device_node *previous) +{ + return NULL; +} + static inline struct device_node *of_graph_get_endpoint_by_regs( const struct device_node *parent, int port_reg, int reg) { From patchwork Wed Aug 28 05:11:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13780546 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 1DD23C5474A for ; Wed, 28 Aug 2024 05:11:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 958D810E49A; Wed, 28 Aug 2024 05:11:50 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="eJMR+mY4"; dkim-atps=neutral Received: from TYVP286CU001.outbound.protection.outlook.com (mail-japaneastazon11011011.outbound.protection.outlook.com [52.101.125.11]) by gabe.freedesktop.org (Postfix) with ESMTPS id C23C910E49A for ; Wed, 28 Aug 2024 05:11:48 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=r7xKNAit5lvTg5lK1wlyG07i7hBluCZ+Ie+wppg1g/Kld8pNXo4nSNCfF4pm3L021/7XCVZYhzOqwWeiMttkLZfCmV3GDgetQxkDdPRt76Va0QzqgDTpZVS86/UlyDUnts/SNlrJXCbjvLZHvm8LaIlYcJRIg8SlmrogM0K/W6C47GyAQBWTzRm2/0q1D+60Kt38u0V1FY1mh1qVSuGKNB2omNC8EwJP8dzkFo5dEZrAG+0NLrb3UxDJaX+3sIQfLNd4DqDmnfriauTqBwpUJWCtDxZwJz5HoSmXrRyp/LIG8IaItR+EaE2mWnFxVW0BQhLGbtWQX0jO1/GQ5T11Sg== 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=caINNuwjSdjF5e9AjP2qw+j3mL2DYJ7HEtdeMmZlYc4=; b=o5HFwKKhXQhdOqzwYa8GBoRH/6Qy5vTToXY9xwhzjRdY9eZR8Aog8KCt9gVUIw4Azg1gZRmAtmVw33wBRnBuEYn9hI6aIiZQebxR+C9XjAG894QY2Lz1kEokWFCfdezs+xLvva3zmviyjmLdg4sUVks4L3NWZ54dyaZ63fiN+99PrZLLjAMB+DlUNGKoirPqLcR525rIF5pdwYhMWF7nK7MrgynHnY08/SWDKUM5TfXxY/XRYLlKZ61UHoErrxJZ0cSMhozdwNo8JctHo6iSjJHnsIc1+4Qp+Coam9GE08GetJXXqVCCvEOOjzUsaZOj/SXimjpqv0YU25D5Tx+zUQ== 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=caINNuwjSdjF5e9AjP2qw+j3mL2DYJ7HEtdeMmZlYc4=; b=eJMR+mY45S8BIBiMnMqdNIFn4FRhKvkwGOS1dmLYsvIhyvcWns9lBIsQgzCznCfGTywYQyBsB8aCPgVQD+gCXJS2d6WGRv4BPhnhBRYgSfyX7q3ieX1xF3QbT12DOrztAd4bkFPYbhQJqSNOWhn2cZIKRXVJ/KAj5JV3quGd2WE= 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 OS7PR01MB11955.jpnprd01.prod.outlook.com (2603:1096:604:23e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.26; Wed, 28 Aug 2024 05:11:44 +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.7897.027; Wed, 28 Aug 2024 05:11:44 +0000 Message-ID: <878qwh2pv4.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v4 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: <87bk1d2pvt.wl-kuninori.morimoto.gx@renesas.com> References: <87bk1d2pvt.wl-kuninori.morimoto.gx@renesas.com> Date: Wed, 28 Aug 2024 05:11:43 +0000 X-ClientProxiedBy: TYCPR01CA0179.jpnprd01.prod.outlook.com (2603:1096:400:2b2::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_|OS7PR01MB11955:EE_ X-MS-Office365-Filtering-Correlation-Id: d97b14c9-464b-415f-395a-08dcc71fe8ac X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|7416014|376014|52116014|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: oa6eVMwPEpGJhsN1OwZLwXytS5P8bIrFEv7JyA1vboNndVoiG/eUAm24XlKtTB3cX65YJcdJ6pQUO0Q67uxrnCCwTBvRfvtQ22wuSyiRMi+YyNyBivb6FdgIXqf6zlP4FL9szkxQ0+egQNXkzVpPZQdyuen4elHwCk3lUixTR1GuhVpADbrYkJjpRJjTJcXZaVGVcefgzqL6ifC4pSqRz2TYTw2sUsR0nWyAur1hlwWhuwr7QcwFs148TsC+/OH08qx99FPL65RGWr/u/R/bRI3BqMJ+ojb53bn46h/HPsV2dZYipqJAls8+GhERH3a8Q2oQqEUaPitDF0isqVmX5qefN1TG2ICAWHIqtFXvLAvqK9Jq5WFJaam3TDO3OUETPlQQ/NY1vFoCUPuHl2EXpNJJbAVGuEdyXa5HSNiz/YLjgQSGc3ub9GNeegm/z5qwzB97A0kAk188rZox/35RMqz1x15I7X3WKZgZgY1Kd/S0O5nEI6Q8lQZW+jnViBvyE0+NGYTifHCHwkXZblACYaSx1Z1T1TdMR9RLDgcGlZTPf8MV+hFB2TMzLv30fSlRH4RMHpZcfsoqXjov7iA+KnJv+c/CBjof35FWT5dX++QePVAmgMaEaMe7MLKkBIF9jD4VuspHQ6CafDMvwxH28Bah8EK9xd6nvLHJpf2hJlxa2Eo4Ooyy0cKPF1jIV6fP5WI5EzBzKcf7eu+FzhTCK+qfyXVCWgdeT+xVn1yGs6EZ9C9R7FHEicxU1DYkg2gTrlegFZ6qtb339qld1ohp+as8cl1stP9jBkMLrNEOdnaM4v3G4xT1xDq6p+wvSs1s+AGMfxJpYFGYURowLKMInu8wd6G0z9nMLI7I3WUD0AFD3AXE05mP33NOhRjTVdWrIomZ9UgMNiOv+WZrtHFm72+UVDxSNgVGxZLccIekrhtBOnj7DpvOjOskWGzJoydNdZLzRwIwX8N9RY1ipLVLO0y2IcvYCYSMpJzIGludlEv2fGKdILA7kKlyck1PkygsoMPJmDtpL9BJphfkT/U/iRESWKf2Im0mjmBolY7Evt25LbQrJrQ8Pa4I9Vm78Yt9XfqTpHUlCiFFpTLNmTFeNQ7YRAAC+MUttasPBMbNnmt6vTVdUhuQD5wiSYUGu59rto2SwVVHgXvJ0KAcI8+eLjH4NCn7uAuV6EPrtm7ZbvBf274V2wrIVkBD8kE4sMk/dsjwIiAPJ1u3M1AvokZG1cJJCn2XSz9lmRgq5h+gyLcCoYOhcpyH1/WyjnaHQc3V27lF604jF1momeZBPOui5KQKnVNKrxZ/9C1MAf54p0BPnqt/nK/4qMFtBd77KCjCXZturMYYX5M7svBdICvPwMkClNny+2s+c9NV5JtelMiAwh/Bzf/A2gN9IA13p7OXafCEZ+KE9EVPY3k66MtFmCAZFvYhnmw63GwLHoRlGJY= 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)(376014)(52116014)(366016)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KUllNGSUJEfeW9XOgjL18bwLekuVomNOC+ILtLxrFETUjQs7BMXCItkfvu6kfD8smz4dEiU6RHing1wPib9/1yNfCVrw5IW1FtBBt1cyi5n8wDTfATZoLS3YjqJXY1DeaJlH93+8Ak+8DIoSncMR2JUJ+cc/xazAd63PNPMr5c3R4OmwV5gCkMEGFLtl3Mnxf42NJzp73XETZHYZT4Je5xP9/dwG/A6MyIciEcRxuoMvWSYK+lfCiFHDEpYxahhzLnthfRLFlCLvA94BccBfJPNjEPlhw+WXmmU5zIHQb1tVUX8txSo9EqLYxsfhA+b1GFzFQkGp3Fg5R9anTk5pNWBzA2hJhWjeFwAPlu1XquEwNfJ4vGWNJhXUWlxwKoZmE7Fvh8OU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OqGNbKks6XSmlCjG9nD4AMT3KMVFHK6q2p0QoXRcmCRXUwMtj97hjs/mZXJ1pqDF8k1kCIR0o0jIY3bAFw4hytIMfkv2ptX20Flnm9oqJEUCal50l9Er6rYtD0ydFYKwBpuN8psiiLLqHOEJTgE7YQg0Bs2d3wbI= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: d97b14c9-464b-415f-395a-08dcc71fe8ac X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2024 05:11:44.1932 (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: Lcx24qF5zuu5rgBf6QPn7c/HOJpJtHwE3DlV+W3QjarPgadw9UzZgjGIT9B1JIkY1o/XTjfghDEHl/Q/rcm59QCm947haD9dGF0iXECc9imXbxWWQSkBb8v8Fqmy269m X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS7PR01MB11955 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 d99b34dd2d5b4..5d253ca365aca 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -716,6 +716,33 @@ struct device_node *of_graph_get_next_port(struct device_node *parent, } EXPORT_SYMBOL(of_graph_get_next_port); +/** + * of_graph_get_next_port_endpoint() - get next endpoint node in port. + * If it reached to end of the port, it will return NULL. + * @port: pointer to the target port node + * @prev: previous endpoint node, or NULL to get first + * + * Return: An 'endpoint' node pointer with refcount incremented. Refcount + * of the passed @prev node is decremented. + */ +struct device_node *of_graph_get_next_port_endpoint(const struct device_node *port, + struct device_node *prev) +{ + while (1) { + prev = of_get_next_child(port, prev); + if (!prev) + break; + if (WARN(!of_node_name_eq(prev, "endpoint"), + "non endpoint node is used (%pOF)", prev)) + continue; + + break; + } + + return prev; +} +EXPORT_SYMBOL(of_graph_get_next_port_endpoint); + /** * of_graph_get_next_endpoint() - get next endpoint node * @parent: pointer to the parent device node diff --git a/include/linux/of_graph.h b/include/linux/of_graph.h index d5e9d0ed3145d..83bcdac22169d 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, @@ -75,6 +87,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( @@ -135,6 +149,13 @@ static inline struct device_node *of_graph_get_next_port( return NULL; } +static inline struct device_node *of_graph_get_next_port_endpoint( + const struct device_node *parent, + struct device_node *previous) +{ + return NULL; +} + static inline struct device_node *of_graph_get_endpoint_by_regs( const struct device_node *parent, int port_reg, int reg) { From patchwork Wed Aug 28 05:11: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: 13780547 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 A748DC5472D for ; Wed, 28 Aug 2024 05:11:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 117F310E49D; Wed, 28 Aug 2024 05:11:55 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="Q91f6b+2"; dkim-atps=neutral Received: from TYVP286CU001.outbound.protection.outlook.com (mail-japaneastazon11011056.outbound.protection.outlook.com [52.101.125.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id BEFAA10E49D for ; Wed, 28 Aug 2024 05:11:51 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=RZdhg3HqoT1iMCjOHZeqKtIRCeQ2562nxzEexI8cFn/AQzFYPQXviAVJfYse6yjXtaU7mxFRmkqQzMDleDDpXnVgRZs8YnG8BzShgMNs+JmY5e3kL3gOevxPq1DUhoEpmspiJMcjutOu2CQdxlyCgguqDFmty/lW5+LdboHvXyx6Rx6Tj4VKL0JWKgGc+5K6RofgH6ktZsbCmmmogOWjL1+wxVNC7Ha4zMJJYKqVlOKfg5TIfJB8ltjCDBSpllRH3ZRO6b51JZLBy7dC6FttjWUyBG6DX/jDfxX1VxShVvhS8EJdn4JZm2yMC2LtXf9bwX6aiebUGGO5Pm3YMfQQoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BvJInUuNEUe4jRcgs+FO2MhQ+2U/Xyt2piTiOMROnOo=; b=qu1WAgG3hPmykGQOdt5SgYfRbHKqCQjOEn5JCUGQs4E4XtqqLw26c+BleiQEuOtb3cpj7hADBj+kA77ugO/LbQ+VOe3qzIYsucet9OSAMAi/EC1vGrn9TQd9MQ8Hbd6CN+zyaJeIRn019yhwFWuCsBBA3p5QsUh1tlm1A14KlUM/XwdwTm1BzPIqnJRlMk5aGYQ+ghr3DWIQi7HzHh1ZTP7wX+p6WBtuu/jdSekzllvXucW6TwonK8phpkxzzSb/o/pRgvf3YthkPVAh5ZRwtBG5bM4ig6HAFpURcSaRq1Do6YW/DH6wCf+t85VTyZfdPHGzFBrqLvmz5y8krtQr8Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=renesas.com; dmarc=pass action=none header.from=renesas.com; dkim=pass header.d=renesas.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BvJInUuNEUe4jRcgs+FO2MhQ+2U/Xyt2piTiOMROnOo=; b=Q91f6b+2Zm9I118JkpGYJjlRvt/7DZAlmBqu6VPyQ1CUCC5JB9YISiG9Axs3uE65vW4kGAzWdocN74MT7MkSwWdVQOks7kGajFsORs97gpDhc3eevTFadqxlgGHkgkoFtIAu47OCWgdFsw1qjNqHIRhzGi8/6kGJ/paptNzRaVM= 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 OS7PR01MB11955.jpnprd01.prod.outlook.com (2603:1096:604:23e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.26; Wed, 28 Aug 2024 05:11: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.7897.027; Wed, 28 Aug 2024 05:11:49 +0000 Message-ID: <877cc12puy.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v4 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: <87bk1d2pvt.wl-kuninori.morimoto.gx@renesas.com> References: <87bk1d2pvt.wl-kuninori.morimoto.gx@renesas.com> Date: Wed, 28 Aug 2024 05:11:49 +0000 X-ClientProxiedBy: TYCP286CA0253.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:456::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_|OS7PR01MB11955:EE_ X-MS-Office365-Filtering-Correlation-Id: 848a4489-339f-4549-edf7-08dcc71fec09 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|7416014|376014|52116014|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: C1XzWVYXbMfuKkTVO80BanJ7pW4h1lPrV62MXNqbDHpJnscM6qsOwo73VcqlxM46Pk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b1geoHhieGKzTZ2zZ88bcpdfrvm1NAMsCETQjnWpHtW1dxTMPPqJfvWI+eoxQDbDwz38ZFnmFBhbRwtUB22zVYbdIq4cxRTaCDICaV2xZhVJAOrlnCCYWpemvenl5H5TFsMPuw5sj6BMH5X2T1OlFmCGYuzSrqKDTfTJSGu+r7LlNB1xOjULDz+5RX4uzAcS0uc65NPS+JeZDOXJkF6FFIczmQV3l900lMAwQR8x100ErfRS+HwCSFx4xvSC51fgCiszkRBkrNiHEb9pGT0HsJGBTrkEKUQcqiYATeU3LtkTaobKYy5ACSfczFkTrc= 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)(376014)(52116014)(366016)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: CSpKHcGOQUgrWuSaTfXOQHCOgDUhfa0w57GFb7RTGSyyaxvaXGosipP9fmykqoPPePV7e37ECcv5paT5nv4dkqEmcklKoy7E+SprXn0YZbXJSXf2qaM4as86elPPwMBwIoXLhvKz7MM/DDJTxAQwHhpHQQILTwYZDoj5m4BC0y2YQRNoKOltfK2TOet3U0ZlJ9yA3eieczxQZ0sX8ka95p4m69EJ/1E5Xri22nRB8CKuYdmnjpbWOBEY/HioFVkwecMo7GiClKN640KRaTh1NS/FSKbvdaS0ZcU0xq86t0B/n6H4/KBDfolMRCflNP1EBixmB8aMchuE9YKtBEt2IBugwObijn853DkY11eNxj50K8xDSwk3kMnwU7qb1vJdUHZUAIYeSo1pv+ulZaHUSlEG4AjXQSgLCe7NeZCCoXLaeMk9u7Nt/p++SS04LW4HBTZAEfQATXlQA5tkHyk4EFVJyk9N3MXacth2bYWfE93TbMmXFYPy0KcCp5GHzAmIy0+TYBd82FP1qe5qH1VtTnkrPm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XSOAYyeU7JWJA2hZZHb5HJlE= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 848a4489-339f-4549-edf7-08dcc71fec09 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2024 05:11:49.8614 (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: dHQGx+je15kBRJC9VVsSxM/3rUAQNbIeAWdsgQOn4izlX6AOxCW1iSXcSEIrOoET8MEVh4KK+VxYy5AJwFtc4+knppu8IjrjXKbJMSt0VuN2O1EiNKtszyJe57tc6mh3 X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS7PR01MB11955 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 df2487b700cca..521015d870854 100644 --- a/sound/soc/generic/test-component.c +++ b/sound/soc/generic/test-component.c @@ -521,7 +521,6 @@ static int test_driver_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct device_node *node = dev->of_node; - struct device_node *ep; const struct test_adata *adata = of_device_get_match_data(&pdev->dev); struct snd_soc_component_driver *cdriv; struct snd_soc_dai_driver *ddriv; @@ -591,7 +590,7 @@ static int test_driver_probe(struct platform_device *pdev) } i = 0; - for_each_endpoint_of_node(node, ep) { + for_each_of_graph_port(node, port) { snprintf(dname[i].name, TEST_NAME_LEN, "%s.%d", node->name, i); ddriv[i].name = dname[i].name; From patchwork Wed Aug 28 05:11: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: 13780548 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 54750C5472D for ; Wed, 28 Aug 2024 05:12:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CF41110E49F; Wed, 28 Aug 2024 05:12:00 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="FWjf1mid"; dkim-atps=neutral Received: from TYVP286CU001.outbound.protection.outlook.com (mail-japaneastazon11011005.outbound.protection.outlook.com [52.101.125.5]) by gabe.freedesktop.org (Postfix) with ESMTPS id BCDD310E49F for ; Wed, 28 Aug 2024 05:11:58 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lNps9HmhdklcdTOxMb+GYjVV8xK/st9ZrZaOn7fOSx9MU9eybWh8jkN0hdLBDiz87E7qk/M5rUwyTrw1Xlf3YLO1ZLs3EOVWjp+t2segFW+EORve8u1wzvwC0eM+yBplzzcmzo8r+NPV0YbjTL/ygeSQmOlwi35TNfEl4OxjnGnIK4tK7+Bq0C8DjthSMvNv9HgHMZkSK6VND9KP0HfGwC/Onq2jGHi2jJvRdAESiAnDBIUz34eXA3otfkLgIByT47DmsDuEAFJ9EAVHdj4o6IcbRnFRtAdffnHTpr22tyuO8obKLFFdIYIBhZZTBvV4NodtUdQarKGkXJd9uBIH6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zSTy3OP81bOUWiIaiLJlHM2sjNqpFXTV3MWJ/ljI3OM=; b=kg2qrEHi/8aIDNwGCcOygDP2Dal8aszELB6LqhNDyvZoXGrQvLbWGVlHCDzP4dQ12QSDTz/+PqKJYl3iqbnHa13fENGgTpUqMxzs3kBwtPyjXq1A3Bo9kPQ85nRKFXgLGB76yZuZYyBTXSIWKQoyP6Sn07mLgmahuQUb0WzIuk1EcXNkW5OB85LdYyquD4uJisMfO3OSi865pfqz15FviDAN7K1X+F8qHptqAW/jiSnfR7gOEE2fVkF63DjG7SZdhTx606eg1UNZb+1dUtcgAFwl8p7qcxoTrkV+HSi6NLhP1JbjMZOwwnjabnsBgb8ZNWKQdQcwuvzV9PeZDH/uwA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=renesas.com; dmarc=pass action=none header.from=renesas.com; dkim=pass header.d=renesas.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zSTy3OP81bOUWiIaiLJlHM2sjNqpFXTV3MWJ/ljI3OM=; b=FWjf1midR+LodzwTuHADcVHWgoGc0Vllq0KEYvuYjXdn8nZHRjMEp5aH/GdUltADlM9OuYOECHwWAdICPC0IM8X53aQNmvv/rwDeVh1odqC4hi0wqUTsHaFaHZBxquf7iF6dfNXnAE+htR/HkAi3a54ndJbayxmu5XIZ3JSixb0= 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 OS7PR01MB11955.jpnprd01.prod.outlook.com (2603:1096:604:23e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.26; Wed, 28 Aug 2024 05:11:56 +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.7897.027; Wed, 28 Aug 2024 05:11:56 +0000 Message-ID: <875xrl2pur.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v4 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: <87bk1d2pvt.wl-kuninori.morimoto.gx@renesas.com> References: <87bk1d2pvt.wl-kuninori.morimoto.gx@renesas.com> Date: Wed, 28 Aug 2024 05:11:56 +0000 X-ClientProxiedBy: TYCPR01CA0138.jpnprd01.prod.outlook.com (2603:1096:400:2b7::17) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OS7PR01MB11955:EE_ X-MS-Office365-Filtering-Correlation-Id: 3df3315d-313d-42c5-853a-08dcc71ff02c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|7416014|376014|52116014|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: LGIlfwvIC325lYEZS+v2MnkaB+7G7f0O3/XBL/pBhjfkxqtdkXrWX0WFmnCwbbElHtIGeTgp6lkQvK96hCtTrNtYS1vpRZ6ygTOuFs8c8q9dHBkRsIz7q5WtXV80fbZEcExlCdKMSe1YytEGCIaFk9OFwtol+YBVBcs/0FgkyzPJn5ZHzSWka4Ddj66usJ5kFuTmJyfIsn0eNaS7Q6R4gTC9tORou4Wk3CPYObbH2K+WGRDlLk+evsu1gu49nz03KsmBhFBd6IdGwXkcmB+M3QV5V1PeoXid0qfP53TGebHRP4dj7WGPhwp6R3vFh+noM9YwUCM35lcskfJWlYX3ptyTUV6eDR4WqNSZSfUF6fNRucN6/709Us7pBvYj91CKBKsc13635TamrN+umSUK36gdWtPpVVf+9zMU/tqYkZhTy3JfhXAcDsk/2GBLEtVYi0rJ8BlfoWew/BeE2j4o0Dg0VK3g8HwNsYVsRdj8Jawi+7L7q6gYuDL7d+9zHTYHfQ9vacBQNV9Y621dqFjsxdBRC963VcDzaPRUXwzzgNyzTsUvYOFdqJbEl9nNN547hSouwkB7hxDmmRmUkQucDgfE38ypXxndais7d7jYxDTTseUuQa9ye/QPla0zA+m6yZ0Au9CxaCCE+wWV29354XYH3kICiGxPFlbiz58nYNfJvi/WmzCLyiWgx2BSAo8ZssnNllagypX/2EyQ8WuJMft7LoEw678ZBRlNscdkrIVlh99h8r9yNEdStouZDctl3gtk2WqAsGEy51wk0pmnRASQMl4M4Hchq12O9yAs/Bm4aB25nGydH8YFdZtd7bzkSaAI1C6nUFXIdugphL7u7zaarPMv4hvzjfR9rKq3nc30AQgzKdX2LgHURsZLbcNxYrA0KDNv/4qT8RUihiN2jQysBVcCE9EOuE64TuoThkhXXw1rNbhXJGnVG80AF8A36q+xm0wITPxbnEQcQ+7GzUYCenBlrsVtN6WhuH1YEZ4hzKAz5GMcwWOsn+QXPj3GsAvARBoFemUctBHXm+JrKBgNh2SMMlwn7QPsuv+T2MSfXQWNCoQS6tiFEStuIwLh6S2jeffWcpstHpnBp1KDPv0Hw4rL2GwT4qE9BAKLpc6JxQzrMPAzxES4KXPlpsg7jLMlQMd3NKq8+IneHwSJOqQFtNyBG4sZzo0DNl6A2JhckJfnBIySFXqWMIKcLwQcbuyDDzPzI0ogoGQZ5dXkchnzq20FnJgkqmjRY8tUrP8RteEv8y4DrtHF+WUQDxsgjI6zi0pTVvvZpFiJTMi4yKwBHwJfbW/1dl9soqWQMaIXUirTtIG7HV6/9C2HUP6zBiOb25POk4HCyrfKsW4tnC9CH6kbZYuE0yNRFy0ug5wdt0x4ag4GSKVSi24nlNZ0w4IU5vJdC/pFVAAycp9yCxkQkyAhQ/QPH0tIOuYtubw= 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)(376014)(52116014)(366016)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SDcbmqG09OtlqrDebfld+pn9ewxka2ZKeJKJnVna0DATWwdW3yjZWx5zPAbixeJGzjAHk54Z12DBnuN0hyzoCJ9RycfVYnrni+7Jx4d7/kyexWZynbruZevdguw7rwjPPYolq7C/XzeOv1ECsC1UohMGl42Gat9lDd4yyQOu78T52Qv4b71oFUiwVbCAhdPsbaht8k12LFaatPrsgqK/LpNXEqK1Qd9oI7BcDT2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GTYkizv7g0EegjGFCN/SZ2sDPKgGaji9JdBROlY8UKp4UF9vggS9mrO9w6WwaZDYJTN0iFbiM7LJbcRoiXBsBFacOWKX1NrRWfM6lNpzRGBnw2RyOfReatPKW5QzXDh8MYMltfu1eE97wiqhmmFQL8TE1SHARFM+1iVFY7xjCJVlXPsWr2NGVXP+7Q3maaDhHOHpn7BNpfuGUOz9u1adP9ROs40R4PVHAEgAImAQwTYzjuIYpoRPHHt2thGAS3MwufvjkVDh0M5gK5WLdLhh1HLJiUewRcPCUOS5CUKC6dz88OnVfXfLs4sPVEC98Ju3Rq/hukoXJ8uHuPn/l+M= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3df3315d-313d-42c5-853a-08dcc71ff02c X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2024 05:11:56.7869 (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: CLiUgIfs2Kw48bMAu4SN4kWKa3+838FUz6lN4r0A+9GLigbxPfVdmCHf2yvt9Kkrmufniup8gdhTb8ygtz6wBJVPUk8HkOXHwTHnddn+M5l8sstOm9wlWSfqXqRrT1Nv X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS7PR01MB11955 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 15cb5e7008f9f..281936ece760b 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -1237,7 +1237,7 @@ static int rsnd_dai_of_node(struct rsnd_priv *priv, int *is_graph) { struct device *dev = rsnd_priv_to_dev(priv); struct device_node *np = dev->of_node; - struct device_node *ports, *node; + struct device_node *node; int nr = 0; int i = 0; @@ -1277,16 +1277,12 @@ static int rsnd_dai_of_node(struct rsnd_priv *priv, int *is_graph) /* * Audio-Graph-Card */ - for_each_child_of_node(np, ports) { - if (!of_node_name_eq(ports, "ports") && - !of_node_name_eq(ports, "port")) - continue; - priv->component_dais[i] = of_graph_get_endpoint_count(ports); + for_each_of_graph_ports(np, ports) { + priv->component_dais[i] = of_graph_get_port_count(ports); nr += priv->component_dais[i]; i++; if (i >= RSND_MAX_COMPONENT) { dev_info(dev, "reach to max component\n"); - of_node_put(ports); break; } } @@ -1486,14 +1482,10 @@ static int rsnd_dai_probe(struct rsnd_priv *priv) */ dai_i = 0; if (is_graph) { - struct device_node *ports; - struct device_node *dai_np; + for_each_of_graph_ports(np, ports) { + for_each_of_graph_port(ports, port) { + struct device_node *dai_np = of_graph_get_next_port_endpoint(port, NULL); - for_each_child_of_node(np, ports) { - if (!of_node_name_eq(ports, "ports") && - !of_node_name_eq(ports, "port")) - continue; - for_each_endpoint_of_node(ports, dai_np) { __rsnd_dai_probe(priv, dai_np, dai_np, 0, dai_i); if (!rsnd_is_gen1(priv) && !rsnd_is_gen2(priv)) { rdai = rsnd_rdai_get(priv, dai_i); @@ -1502,6 +1494,7 @@ static int rsnd_dai_probe(struct rsnd_priv *priv) rsnd_parse_connect_graph(priv, &rdai->capture, dai_np); } dai_i++; + of_node_put(dai_np); } } } else { From patchwork Wed Aug 28 05:12:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13780549 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 CF2ACC5472D for ; Wed, 28 Aug 2024 05:12:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4D2C310E4A2; Wed, 28 Aug 2024 05:12:14 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="Idk7Z/nK"; dkim-atps=neutral Received: from TYVP286CU001.outbound.protection.outlook.com (mail-japaneastazon11011056.outbound.protection.outlook.com [52.101.125.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id AEDAA10E4A2 for ; Wed, 28 Aug 2024 05:12:12 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=otNjU0w5LT8tLNqd5AS74MJMlVyAXrqYKlitXDq5bAZbkF59ST67HFwrHkOiVBOXDoyMw2cjj5RBtg8yx8ANLfze8Ws3RTCqW/QmPgOPyHZ2IxM82ky/J7z1fIDAJfk/YyY/QXq2ELwcelN6bORmId1JxK9SVAWFypLzF7BRZO2iQ2MwBNyOAuhwUmuqfJMuLePpYMQPg+nVuVd785MAjs7brWPBWfJv4vvRf92E4vIrD3jnKHBnE/JM1qQgpFQiUT2EHg/dw40mJ34hMiP3NfyRVQuUuuTn6blH8hj0hYmP19awEjfmflfZ6u2+F1euG5GlbOXvIQG03VLprfMcYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kkJ0ltVTSz196uhSee9Ig9BdLX9O4PwwW/k2og7b4lU=; b=j6Akg7tvSAYNshTF6VJAABcDrovwO++eHtz/BTJZHBp/oR4qwgENotQoz87O4VIcIPGfFO8eqaiDx1duniIDQ6SS3znB01Lvx3kr8XAKJ1itfg1vq/tAU+wbNsEMZEtSKapunJRXDRnd6rsZ7PXBi2+c65CS2o93Ymazt31oc8c5udMmd6g/iVI8U571MLc3YpgQwytfllDkIoo/Hszp7FIKS7AzY0hISG/8gUU2zFupXrgw59rSwT/hdQdEPLlQ+gShR43f37gb7vGS1h6baLzJn4J0yy7trcrz8M5XOUrZ1OgSKP8LbMwBdi5q2ybnWgF3EKQmtTKXbTSfM6mJfg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=renesas.com; dmarc=pass action=none header.from=renesas.com; dkim=pass header.d=renesas.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kkJ0ltVTSz196uhSee9Ig9BdLX9O4PwwW/k2og7b4lU=; b=Idk7Z/nKD36/s93jIdS2Pk8cY4LzadawbIhwgkDv798YotxXhvUAKG2TBnK0AJGwKyQsCtA6KSJuXrHqfTsXPlRqin/C2esYa8/85LYp+p7Nc05xS75fiOEsPSrREZAe/NY60098zHP4INZl/FiHqwWaZ1IIsAViRYw3jBxCXq4= 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 OS7PR01MB11955.jpnprd01.prod.outlook.com (2603:1096:604:23e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.26; Wed, 28 Aug 2024 05:12:04 +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.7897.027; Wed, 28 Aug 2024 05:12:04 +0000 Message-ID: <874j752puk.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v4 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: <87bk1d2pvt.wl-kuninori.morimoto.gx@renesas.com> References: <87bk1d2pvt.wl-kuninori.morimoto.gx@renesas.com> Date: Wed, 28 Aug 2024 05:12:04 +0000 X-ClientProxiedBy: TYWPR01CA0046.jpnprd01.prod.outlook.com (2603:1096:400:17f::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_|OS7PR01MB11955:EE_ X-MS-Office365-Filtering-Correlation-Id: 3a4cfee6-ca7d-4b79-d921-08dcc71ff4af X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|7416014|376014|52116014|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: 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5Yh0TBbsfZm90UQRciNTIv1pZ1i5jDzNEkt0x24dEcuCXdya12ZHUq779PqAojbrPPG50BAK7IHWeKe3t6jwQwwcuC0xaxF+S+nZZLcpiuqtX5GhEgzSFuEpNRljFhKJxrWogZ2WWeBmRal+xtQOya3IH0JfRHS478EX+H4IsN3+eFQ0Pun9T2aLgeExl+dC25UpBimioIx2YfesNAgNqboIzreY4gDT+dVsj2+Tznu03X06DoLbTTmv66HF/58gtHLDB42h4HYfJoekOSji8Dg1IfMGA3neV69Qn6PW4J0ozd9wy/MGi90w/9iXEGAk4+20mxtMEofgFp0OwTtoVN4gF5+u7LjPdHsbIBwXS7Q4BMHhE72o= 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)(376014)(52116014)(366016)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3VK+WfYoJ4ChqaOtFnkmZ6wHSGL6epTCFGXEpkMcuOchCeJbG99ApETWQG5pmySvY6B1pMbjjRNj8rShoPsg5BjVTwTLTw0An14zg9/g5EDpoe+k7NfY4KDy+H4biHVv7yrIqihpjb+MuqE7tlYc0TiXCImkhMv9HLPsQv19gGbzBK7fAz1eaJc2yuEhR/l5Hv9L2k/+XiF4HgdPHMIzr1fmUSKK46hpakbkmW/00rVjimthzF21BpJ9PyvETLt0S5u47xJIxmSbtSMbIPC0a0przigFEImgU7kDwya47nY2udXBiuOrdTKw5w+siZdNCSUtBGTELlf5hbfTYw5aYrJ4pbhHfU8YsXm/HnP5HvIHBt3t7ijZk2ZH4iVHA+RNyijEgV+W7TtqlRS/4KiDBWOpi3UktPObEuh4WGwVkxEq3vMqby7dkot0YbejxdQ4AONLsdUUrxpMxwr1SNBIK3d8/bFYSJUJv7C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EarB9awyo05QEQB16f/GsltYOiwvSZfh/xaDCTX6poYS13B9RJ1LKkoZxRT/cxVy7kziHzpRRSEAd3hKJhiFr3AJWdL0= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3a4cfee6-ca7d-4b79-d921-08dcc71ff4af X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2024 05:12:04.3494 (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: Vdc0pQxlxt+kde1qMEzA4g5rdatEzkFwPwKYHliBV8QVkVUJHp71PoO73IJRosLs1ORKL1grAa0bY4Q7n2+zwTZ2Dj3fMMED4iDKK1MvAisSXtRYgijQug/czIDzb28k X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS7PR01MB11955 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 | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c index 1bdcfc4d4222e..e7fd3d70ce091 100644 --- a/sound/soc/generic/audio-graph-card.c +++ b/sound/soc/generic/audio-graph-card.c @@ -361,7 +361,6 @@ static int __graph_for_each_link(struct simple_util_priv *priv, struct device *dev = simple_priv_to_dev(priv); struct device_node *node = dev->of_node; struct device_node *cpu_port; - struct device_node *cpu_ep; struct device_node *codec_ep; struct device_node *codec_port; struct device_node *codec_port_old = NULL; @@ -371,13 +370,9 @@ static int __graph_for_each_link(struct simple_util_priv *priv, /* loop for all listed CPU port */ of_for_each_phandle(&it, rc, node, "dais", NULL, 0) { cpu_port = it.node; - cpu_ep = NULL; /* loop for all CPU endpoint */ - while (1) { - cpu_ep = of_get_next_child(cpu_port, cpu_ep); - if (!cpu_ep) - break; + for_each_of_graph_port_endpoint(cpu_port, cpu_ep) { /* get codec */ codec_ep = of_graph_get_remote_endpoint(cpu_ep); @@ -408,10 +403,8 @@ static int __graph_for_each_link(struct simple_util_priv *priv, of_node_put(codec_ep); of_node_put(codec_port); - if (ret < 0) { - of_node_put(cpu_ep); + if (ret < 0) return ret; - } codec_port_old = codec_port; } From patchwork Wed Aug 28 05:12:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13780550 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 4E068C5472D for ; Wed, 28 Aug 2024 05:12:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BAAC210E4A0; Wed, 28 Aug 2024 05:12:18 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="MzD9U29b"; dkim-atps=neutral Received: from TY3P286CU002.outbound.protection.outlook.com (mail-japaneastazon11010063.outbound.protection.outlook.com [52.101.229.63]) by gabe.freedesktop.org (Postfix) with ESMTPS id DAD1110E4A3 for ; Wed, 28 Aug 2024 05:12:14 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=G7qlpa7t8wdTpS7rEDBCB2JlGFYPIUsZylGCLVqq4ZOUmOHQdrB0tTUNJ3r5ky9YArW/OQRUGZ+eMT+pvwem4jExohq6pW2CUW2Kba6oiVA26QEm6y8QZ4CDoYnqb4XvLgLCN7I7mpqAEFWy9YrhVdnW8ZULcL70fk5neUdudma53Wz3R0dfPovWLP8/Sf8IgSwQUv37BZceZGGdwqecbomwGmvpKkh/mCVbTblc/37asTpDADqJ7qfWMr369jtNTUloYeA9WhzqYOBOBZ2nL4cdvrlHYDB76312ovaCKeEel0xY+9Ld0BmB6bZ5KUO3eAQB38MDaMElWvJ8ud7SBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Hp4n9zD26Pjr3suPV3xZ/lwMpWsgUaeqizfk9RGR8Ns=; b=hYWpbQcFN6p30vQPEToko8WsrI/rnQAeuRyPiASTmErTy0GUG6I6mLR8mOue6egA5+bNn1h9qto/wZVBGKz4akS+krrUCZVixwLKYZMbdO4Fk/KeCYvNWVoFBKNSHm3a6/xiD7l8sLH2iwFPoMqVmE8+xDIodBW6rH7KpVE0AIVOl7VWa9cAdug2aadhbhihAVaFc06aXxKVwBG4SeWlX/4hUsy6nR9npyQg4TY1jDG1z2ytb5w5tLmrLdfKf0IoBgKkMHb0/zaQ+CHio6Pg855RiW+gTQiPSO7fcbfyYBEN740P61tObvT7yF2g7LOJE0bnvDgqQkse6ZVPKRd8Cg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=renesas.com; dmarc=pass action=none header.from=renesas.com; dkim=pass header.d=renesas.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Hp4n9zD26Pjr3suPV3xZ/lwMpWsgUaeqizfk9RGR8Ns=; b=MzD9U29bG1/CkipUzEvD25mIcS7NGhhPK7YqEwyg+W1/ewtTwrvmlNsodi5leUs8JiUgH0JeNZmU6jkNNMJm5nLr61gCVktVHDV4hzl+xnDGYuze2GwN5d5BN88HkxKoa30FRwczK6IP2h2h95JVQRJPIBHlCpew63mU4s5H8Fo= 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 OS7PR01MB11955.jpnprd01.prod.outlook.com (2603:1096:604:23e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.26; Wed, 28 Aug 2024 05:12:12 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%5]) with mapi id 15.20.7897.027; Wed, 28 Aug 2024 05:12:11 +0000 Message-ID: <8734mp2pud.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v4 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: <87bk1d2pvt.wl-kuninori.morimoto.gx@renesas.com> References: <87bk1d2pvt.wl-kuninori.morimoto.gx@renesas.com> Date: Wed, 28 Aug 2024 05:12:10 +0000 X-ClientProxiedBy: TYCPR01CA0135.jpnprd01.prod.outlook.com (2603:1096:400:26d::15) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OS7PR01MB11955:EE_ X-MS-Office365-Filtering-Correlation-Id: 3a29ad9e-5b4d-407c-4120-08dcc71ff8a0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|7416014|376014|52116014|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: eAxwP2JwezQEcelM4qYopxTB/LRV2pJq0LZ9u6q6Ka2CgT6b5V+MjVhuIi0WZDHojaE/9aA6xHvVap9+5PaqJ/RBhUgQTsHmYmQfEqB5QuLozj5jhr4wkyjaB+P0SX3fPOrpLe08QhnWghSBjHZUH06ftdDOuI3ISuvvX80umniMgSecCBx3do/qdDrlCWUGMOxCdrEe3pnbiLGTsILWy/dOWwKNZf+vgohFnovQsd9sp3vIMTsW5AVk4fWezHo4YUg2SrOADuDpiMAq2apUYt8qUprKrF077LCNxz95+MSaNa6+zh/cQDinHNg+c4NkANDlj1VZE9EixcVYZYEOPF1FD84BlfOoKkkpxWXppD7p9qpn5GKwrIHkvGAEbz40+jnf3IUSi7t9M1V5gbu6Q3UWFEB9xJ6TUZnmWpFsM08FmA7QctogM8dA+bZQ+ViiCxduYz+KPgXv3GXRyEUFBjH0HuZWKZ7+1qAK0sSUFPOc2Q7VvYA8Q5+TDFcVcpwmpCqUiQS43nvHv7h/THOSemZuoC6ldNR/pgOYRabKU42c/B3XGv/5iO6IeKivojZNwtZOOGhQY+Bb+SNL0CuAwSnfU0RUYRJv30aAjM6ZNUGw40DktVQUYRnGa41MmfcrBAo/JwdXz9IZInUusSNuhz4/9myScymblJLpu/6dS7lTwb+xlmXmBKwtAdC8LiIp48cKpAQbqdpbhuDdZAZnEUWrMQXEM1s+DbfgbvHi/WO8BZmSFJqkJT84lm7+RnDFgfpK94lftU8X+w9Pd9l5y25yvSR9vbOaLVAvAGEYWYQDBLvAi8Ri+ATMUbwqX1ENprmhxfE+ZHCNcOe+0nOZ/5A+fCE4Ah2af17uZ7m0eN54+urtWTc5mxIMq+dGHzMB/hIIFCFEMYXmrbrA+DzrZjHfTvQBPSvks59gqV0sCu3RPQrE4Nz2kECjsrU2nlsCK55GhrNmg1ovGxNFjmADEbgA+Ot3aJR/vTc2WJNAwbDKm0WlACa7W2bc+UBdwT893COGU485q3CqgOrFExLgdGZHzcqyWCiaHgy3KbmwFLtMDgbHvRrv4GRoLnPeVzkrgZ3rKScr6GCylRdQkAQccX7iAiED3UmuqzNUG8phPTxZSYdRLRYZ8ee9X1ii1GWfJzEfSnU98dZx/nq89dWdeMXaMhwwm7MM9CE1HuVV9duyTpScHMgzbTJDEU2L7E08p/Na7DUq7lCUgcPK/JC9bxnZ5YfdzRXT5B7R1FTdH0AGACcpi9mrmZs/6hjjZHeFZEEq0midWtWA+TqIryAFnINjdrnOUqcpaBiX63I1xUL3l0YuxRRBZ7W0pHRRJ6b4dN8dAZAF8MbrOi/7eVK+xFP4ou1hw/hL8NH56J0Ht/EJ3w/YfaCW2/9xgfSAWfcY815PGRAWSOQHI/woiDHYKph6eGnZfpYT5Bf6cnk0vIk= 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)(376014)(52116014)(366016)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSp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UGyE1r5Psl2B2w3/LmBaK5AeAM5PlEupMgR3ucplPVTSVb2403l4aXcXz1yqG94Uc3D8k0UiHyXjqwxVpmvgmfvjiWqsbs/eOeL8V9Yipc5EPoHAzgxJsYUTweOXyDoOSJLnVF83fi0KbWw5V8FJQsmbSMU4c7A1ETyJ7NR5XyT0YU8jbT6HlBjPqzoj5vYbGAlYBQnodf3qa5u8GJLSkg4SauAOqJA/o++R3EK3ib11NuSeObeAGZ4CBfJpfcf2KgS52+KtETt0iq/zP1knZc5NR+23GzpKJF6E7iYYUzYJ45zd8u9mZv7Hz7g8/rGO63rwiR0c2WNZuAzt49LaG72mE38HFdNvelep5PJsT+LIIpAzP1wVrKWAZtI0JJs7Lmf/XZeB2yMCPy6cOJOBnY52hw06X/GEKdZccDKHsh8Tzni55bhRcOY3BsrSf11SZGAYmIj0zgCs8SYlatAp10V6FcyJ86/uFNW2+EQYmhhrbY1ce6H1t3mz8VCTk8B3mD+2qEfBSj7V0wlWA8u1W/mSz/HuUbb99cJSi/tNfnVQd0m/apRur9Es1P8q7STLQ5HsDTm90ZoIKEX3FeI3ftqpckoxQIow644N1r//Q= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3a29ad9e-5b4d-407c-4120-08dcc71ff8a0 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2024 05:12:10.9590 (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: Sr+yIjYXCEbkWtCRsMhTZDubj2sjiNno5Z/JJ/+ZNTcyuzT2ORqHSEfKRBAaSmGPGurkS0mwwXeJEKmkUohNLdgdmStw28fcrULqxc2oUf8uzfJ3nRsFuVWIR4rcay4g X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS7PR01MB11955 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 | 113 +++++++++++--------------- 1 file changed, 48 insertions(+), 65 deletions(-) diff --git a/sound/soc/generic/audio-graph-card2.c b/sound/soc/generic/audio-graph-card2.c index 051adb5673972..90babed0f02e4 100644 --- a/sound/soc/generic/audio-graph-card2.c +++ b/sound/soc/generic/audio-graph-card2.c @@ -234,8 +234,6 @@ enum graph_type { #define GRAPH_NODENAME_DPCM "dpcm" #define GRAPH_NODENAME_C2C "codec2codec" -#define port_to_endpoint(port) of_get_child_by_name(port, "endpoint") - #define ep_to_port(ep) of_get_parent(ep) static struct device_node *port_to_ports(struct device_node *port) { @@ -351,14 +349,9 @@ static struct device_node *graph_get_next_multi_ep(struct device_node **port) * port@1 { rep1 }; * }; */ - do { - *port = of_get_next_child(ports, *port); - if (!*port) - break; - } while (!of_node_name_eq(*port, "port")); - + *port = of_graph_get_next_port(ports, *port); if (*port) { - ep = port_to_endpoint(*port); + ep = of_graph_get_next_port_endpoint(*port, NULL); rep = of_graph_get_remote_endpoint(ep); } @@ -530,67 +523,66 @@ static int graph_parse_node_multi_nm(struct snd_soc_dai_link *dai_link, * }; * }; */ - struct device_node *mcpu_ep = port_to_endpoint(mcpu_port); - struct device_node *mcpu_ep_n = mcpu_ep; - struct device_node *mcpu_port_top = of_get_next_child(port_to_ports(mcpu_port), NULL); - struct device_node *mcpu_ep_top = port_to_endpoint(mcpu_port_top); + struct device_node *mcpu_ep = of_graph_get_next_port_endpoint(mcpu_port, NULL); + struct device_node *mcpu_ports = port_to_ports(mcpu_port); + struct device_node *mcpu_port_top = of_graph_get_next_port(mcpu_ports, NULL); + struct device_node *mcpu_ep_top = of_graph_get_next_port_endpoint(mcpu_port_top, NULL); struct device_node *mcodec_ep_top = of_graph_get_remote_endpoint(mcpu_ep_top); struct device_node *mcodec_port_top = ep_to_port(mcodec_ep_top); struct device_node *mcodec_ports = port_to_ports(mcodec_port_top); int nm_max = max(dai_link->num_cpus, dai_link->num_codecs); - int ret = -EINVAL; + int ret = 0; - if (cpu_idx > dai_link->num_cpus) + if (cpu_idx > dai_link->num_cpus) { + ret = -EINVAL; goto mcpu_err; + } - while (1) { + for_each_of_graph_port_endpoint(mcpu_port, mcpu_ep_n) { struct device_node *mcodec_ep_n; - struct device_node *mcodec_port_i; struct device_node *mcodec_port; int codec_idx; - if (*nm_idx > nm_max) - break; + /* ignore 1st ep which is for element */ + if (mcpu_ep_n == mcpu_ep) + continue; - mcpu_ep_n = of_get_next_child(mcpu_port, mcpu_ep_n); - if (!mcpu_ep_n) { - ret = 0; + if (*nm_idx > nm_max) break; - } mcodec_ep_n = of_graph_get_remote_endpoint(mcpu_ep_n); mcodec_port = ep_to_port(mcodec_ep_n); - if (mcodec_ports != port_to_ports(mcodec_port)) + if (mcodec_ports != port_to_ports(mcodec_port)) { + ret = -EINVAL; goto mcpu_err; + } codec_idx = 0; - mcodec_port_i = of_get_next_child(mcodec_ports, NULL); - while (1) { - if (codec_idx > dai_link->num_codecs) - goto mcodec_err; - - mcodec_port_i = of_get_next_child(mcodec_ports, mcodec_port_i); + ret = -EINVAL; + for_each_of_graph_port(mcodec_ports, mcodec_port_i) { - if (!mcodec_port_i) - goto mcodec_err; + /* ignore 1st port which is for pair connection */ + if (mcodec_port_top == mcodec_port_i) + continue; - if (mcodec_port_i == mcodec_port) + if (codec_idx > dai_link->num_codecs) break; + if (mcodec_port_i == mcodec_port) { + dai_link->ch_maps[*nm_idx].cpu = cpu_idx; + dai_link->ch_maps[*nm_idx].codec = codec_idx; + + (*nm_idx)++; + ret = 0; + break; + } codec_idx++; } - - dai_link->ch_maps[*nm_idx].cpu = cpu_idx; - dai_link->ch_maps[*nm_idx].codec = codec_idx; - - (*nm_idx)++; - - of_node_put(mcodec_port_i); -mcodec_err: of_node_put(mcodec_port); - of_node_put(mcpu_ep_n); of_node_put(mcodec_ep_n); + if (ret < 0) + break; } mcpu_err: of_node_put(mcpu_ep); @@ -674,7 +666,7 @@ static int graph_parse_node_single(struct simple_util_priv *priv, struct device_node *port, struct link_info *li, int is_cpu) { - struct device_node *ep = port_to_endpoint(port); + struct device_node *ep = of_graph_get_next_port_endpoint(port, NULL); int ret = __graph_parse_node(priv, gtype, ep, li, is_cpu, 0); of_node_put(ep); @@ -769,7 +761,7 @@ static void graph_link_init(struct simple_util_priv *priv, of_node_put(port_cpu); port_cpu = ep_to_port(ep_cpu); } else { - ep_cpu = port_to_endpoint(port_cpu); + ep_cpu = of_graph_get_next_port_endpoint(port_cpu, NULL); } ports_cpu = port_to_ports(port_cpu); @@ -779,7 +771,7 @@ static void graph_link_init(struct simple_util_priv *priv, of_node_put(port_cpu); port_codec = ep_to_port(ep_codec); } else { - ep_codec = port_to_endpoint(port_codec); + ep_codec = of_graph_get_next_port_endpoint(port_codec, NULL); } ports_codec = port_to_ports(port_codec); @@ -850,7 +842,7 @@ int audio_graph2_link_normal(struct simple_util_priv *priv, struct link_info *li) { struct device_node *cpu_port = lnk; - struct device_node *cpu_ep = port_to_endpoint(cpu_port); + struct device_node *cpu_ep = of_graph_get_next_port_endpoint(cpu_port, NULL); struct device_node *codec_port = of_graph_get_remote_port(cpu_ep); int ret; @@ -883,7 +875,7 @@ int audio_graph2_link_dpcm(struct simple_util_priv *priv, struct device_node *lnk, struct link_info *li) { - struct device_node *ep = port_to_endpoint(lnk); + struct device_node *ep = of_graph_get_next_port_endpoint(lnk, NULL); struct device_node *rep = of_graph_get_remote_endpoint(ep); struct device_node *cpu_port = NULL; struct device_node *codec_port = NULL; @@ -1007,7 +999,7 @@ int audio_graph2_link_c2c(struct simple_util_priv *priv, of_node_get(lnk); port0 = lnk; ports = port_to_ports(port0); - port1 = of_get_next_child(ports, lnk); + port1 = of_graph_get_next_port(ports, port0); /* * Card2 can use original Codec2Codec settings if DT has. @@ -1037,8 +1029,8 @@ int audio_graph2_link_c2c(struct simple_util_priv *priv, dai_link->num_c2c_params = 1; } - ep0 = port_to_endpoint(port0); - ep1 = port_to_endpoint(port1); + ep0 = of_graph_get_next_port_endpoint(port0, NULL); + ep1 = of_graph_get_next_port_endpoint(port1, NULL); codec0_port = of_graph_get_remote_port(ep0); codec1_port = of_graph_get_remote_port(ep1); @@ -1139,21 +1131,12 @@ static int graph_counter(struct device_node *lnk) */ if (graph_lnk_is_multi(lnk)) { struct device_node *ports = port_to_ports(lnk); - struct device_node *port = NULL; - int cnt = 0; /* * CPU/Codec = N:M case has many endpoints. * We can't use of_graph_get_endpoint_count() here */ - while(1) { - port = of_get_next_child(ports, port); - if (!port) - break; - cnt++; - } - - return cnt - 1; + return of_graph_get_port_count(ports) - 1; } /* * Single CPU / Codec @@ -1167,7 +1150,7 @@ static int graph_count_normal(struct simple_util_priv *priv, struct link_info *li) { struct device_node *cpu_port = lnk; - struct device_node *cpu_ep = port_to_endpoint(cpu_port); + struct device_node *cpu_ep = of_graph_get_next_port_endpoint(cpu_port, NULL); struct device_node *codec_port = of_graph_get_remote_port(cpu_ep); /* @@ -1195,7 +1178,7 @@ static int graph_count_dpcm(struct simple_util_priv *priv, struct device_node *lnk, struct link_info *li) { - struct device_node *ep = port_to_endpoint(lnk); + struct device_node *ep = of_graph_get_next_port_endpoint(lnk, NULL); struct device_node *rport = of_graph_get_remote_port(ep); /* @@ -1237,9 +1220,9 @@ static int graph_count_c2c(struct simple_util_priv *priv, { struct device_node *ports = port_to_ports(lnk); struct device_node *port0 = lnk; - struct device_node *port1 = of_get_next_child(ports, of_node_get(lnk)); - struct device_node *ep0 = port_to_endpoint(port0); - struct device_node *ep1 = port_to_endpoint(port1); + struct device_node *port1 = of_graph_get_next_port(ports, of_node_get(port0)); + struct device_node *ep0 = of_graph_get_next_port_endpoint(port0, NULL); + struct device_node *ep1 = of_graph_get_next_port_endpoint(port1, NULL); struct device_node *codec0 = of_graph_get_remote_port(ep0); struct device_node *codec1 = of_graph_get_remote_port(ep1); From patchwork Wed Aug 28 05:12:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13780551 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 3580DC5472D for ; Wed, 28 Aug 2024 05:12:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A60F810E4A5; Wed, 28 Aug 2024 05:12:21 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="HO4J+wn7"; dkim-atps=neutral Received: from TY3P286CU002.outbound.protection.outlook.com (mail-japaneastazon11010021.outbound.protection.outlook.com [52.101.229.21]) by gabe.freedesktop.org (Postfix) with ESMTPS id C2BA310E4A3 for ; Wed, 28 Aug 2024 05:12:18 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=J4q99qRDMEEEos30gYTovgLVQEDbPtha5gWaBH+4fniRNIdP+UcWXCkO5BThpnD+AYR82S1WYbrBBIS2JCI0GgM6OX9e0+3Bwl7E+gm3uvX3n4CEe6oRmb0FgkXlYoZ/6XDHAPxpSzORqL7Bvgm9ZraFOvco+ITpKWUACfTSQHBf9wrdk00sMgxrIInAV7jLr1LU9yHOq53BZXFXZ1PekVGIj7TjkgoouPZ/tURivV072uEelVFL02VcPDTsanmpx2zU2sENS9gbPPsL8jx2e40ANEZsmYAj7I+Ht1PwCxdGCfoKZRzfknNINsLR4LJL/yhEh1yilQyJQ4xVblrIaw== 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=M7IYzIIOnHDAgj+OgXA6Ds2HHlOQ2ne0nf8ncdfgf7awCXZr+cisuI7GiW2/joZ7sWR9WgFTEUvvPOrXmNaKvcJpewPN1WRu6WxOmUA/47IBSN0sEtWKrRg4PbcnPVm2ex2t3T7tPT93Y4fPJfzkXmyR/m9PnUYJ0BdE+U4l7LZyzmK2Qsk0Ki1B5flmHeCxvhGA+9chF47B+nslsqSPugTMTjrLb7v8qh9TL6lYdU4ezSnMx/11ZGRYuqFdaPZm4JK2P4e9tgTgIxs1FLA4AO0lfgSSXzUWr5s+jmHCRyo3DuNoGQUQkrrJTHNv8QdRxShh/F9wpG7j4mNzkMZDag== 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=HO4J+wn75TXcLCKs663XkcQHEhidWQAdaFui3T+C9Tn1IehZ83s/MNmtnzu5wjOUX9TxhDi1i60/N+wR6LFe3YUr7ytaFghEmhoxX8j1BfRk6ly1l5n38lbKIQZCGLnVEN+Gakz7gBKyY6bDJ+4/4oIA4LxEFXomxclaTirmlfo= 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 OS7PR01MB11955.jpnprd01.prod.outlook.com (2603:1096:604:23e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.26; Wed, 28 Aug 2024 05:12:16 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%5]) with mapi id 15.20.7897.027; Wed, 28 Aug 2024 05:12:16 +0000 Message-ID: <871q292pu7.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v4 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: <87bk1d2pvt.wl-kuninori.morimoto.gx@renesas.com> References: <87bk1d2pvt.wl-kuninori.morimoto.gx@renesas.com> Date: Wed, 28 Aug 2024 05:12:16 +0000 X-ClientProxiedBy: TYCP286CA0345.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:38e::6) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OS7PR01MB11955:EE_ X-MS-Office365-Filtering-Correlation-Id: 71a68700-1a2a-429a-549a-08dcc71ffc06 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|7416014|376014|52116014|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: Ky8X1IsS/NowMGa+vZm8WcCLAten1yQOyX8YvoMzstGcmTDV8fZxSP4E5RGVv0NoLuRSZTbrHVvSw0skZfMKsi1GqZZ6U7tRgGGm5qgwPyjGIuCDBkMRNQ0kLv0NLdMDi+8bOU9NfjpSSZZRPGm/Zle3ADOZl/ljY0D6RFPZymV+zqIDGda2D7qt/hBojC+9QEVdShWjZY5FjmwpZcPK7PceGXcmnlqDfQfnK1yLiKHwV4qu47a8mCqFZzMat/XEUd4pPOPQqMA0cQLtHW2Lqi0N5/wwnvUpz1KZk+ZyMVkR9sd0nEFBZYzNU3UzbkFV29j5VQnG2c8yuswOCdvN7Go+ZfBMZg4Si58ZsXr+e2BOUKMxyL0l28aSWMW0rCwRj82G/yULukrRMNhLqG6HIBmi2KFjlaMs1l7ZkdAearVgBiB4BaGlMWgoE106DNbiaBkYTqe8BjIs2FONB+zS/f6C+6O4Akh4HT41uX6bFCxpCgTuMaCcr5c6z8xrx5XJwtpeKaNci0vuIdO20rehUGyRw2B7Xxbl+hJOhPSDePb7uLZIYzLWJKoQvOOv4yRbzz5mc1dXBMOvPv3UN82621Vv4hCy1erDpORD2hyf3NKoBYR4JUqQQuDfI31yXQACzzEVKZAgklZ4rWOUH9SISFo7968QrkCjUkvNOJql1UI3waKfw9+IrEArJuvfa8KjArLsBP2vxDEr9b1isXVxDPegy5uj7+0qll4CQvGV9XoGCpErqambROYh5u9jWbS+SO/cMpEiHIP6RodlvCztme0UXsZO/VL+hK5ERGYzoxYjujzUqMKhYk865/PX1v0foY76vD/FuHZ/k2/Cop2s06zor745uMx2bBGo/UHlEW0AoF4qYihyas0dS03JNInaYbpFQR454XSwjiuRzn8aFZk0iE8FbN2X1uAVlbcRzIXQoZpG5JHzU/lZHpp7JkV3SFOa5efVc8AZkgFDYlKDZiUdS9/WLX8bthzhcsI0nBHMYjsLTSKp1QGlavwpVavDVbRCIjJM15ouVNSslG6+tmF4tki5OTHSVz26uc0ZThjqCF4SskrQeYywABixh0MeKvKBjSMHbfvRtnTpmSW9R4BtdxMRk3Dbo9RNvm0pL+9Vnifx5H/1eJENzjuUheJoHLGMQCcZUYBvTG+zzdf45iN6W65BYBKGogO7NhYQhFG4btLh48aBEfYYC1ScZUyyQIA6nm+6UsHyaezh5ZKG7ObNADF/QkYk7l1m+ODjfwFrpNph/yp0+bg2abdByXgBnIDCYDMtTa5WqrjcmXnNJQVOmGIXtjMFpaAnqd7pfzxrPTS5OFgmwi6/TGLcoWcqNELBL4nHK9r2byCibonq/bskNMLTvZ1Wn0s30m8FvdeL47mQP/yzV3C5JcPTI1nbFAT6kxRdR/rnFz4bF+pHtz2OFhYXGLYj2Uhy9lLjXlU= 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)(376014)(52116014)(366016)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: y0HXUXaub7zvBCWbqhHqVlo/o56osM/ctCzpILZB8h5k/6mGkbx23093s1m+6XwHctlo5HTjHGQrwgOfEaLyDNXCo46RA3w5tFkbH57c1PGnthdDqwwFeENRW8+V+5bIWGOiI2z/K8sFbkjwKdOlfP4IHtbwdjG5b1n2x34QNDWEPhAK+m119qljaP8wcNWSGkK1eC9/eOE64IB1ENbONmAZzy7GtF/SqQc3eOI1LT7qsc/g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/TwYKXWjGnN2LTl6mCuINfh8QGgQG7SmRrYnfvpf1ezkQjxFOD251uacsEFkN7pBy5TRGZcOhXOHyuDbPZ7v95Fuc7gNfz9XX9GAwI88ipjTRBRR6fFWV4XGKWVlmVSDHy9gScBOr880lXvS6YdD0KevMzulz9FgFd9fmOh2UsRRbz217txEGYx/vBNrii633pUd3YmzdOXf0iXJxxfOp4IaPfwv2is58u2npYYPa5dpFkD4/zTp/ldmi6OTFnD3J0knDJ9p0OzQUK0Wkh0t6+6zCAmwDer2J8CzDHPt0L3qD10k/GBBzQFGsbxXOWWaZBi3AULHI= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 71a68700-1a2a-429a-549a-08dcc71ffc06 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2024 05:12:16.6671 (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: MN1Y+2AKXUIL5iyj38x5z9w+vwaqCYKGRF5BpeP0ZNN6NSsjV4R2WpwdOVm/lYJjTyj4fzli0jbsJYSZ59WA7C1cpcXMZcDNbtFirSqSDuI3yvYn1FULiWX0fTefKsnr X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS7PR01MB11955 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 Wed Aug 28 05:12:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13780552 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 3364AC5474E for ; Wed, 28 Aug 2024 05:12:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AED2B10E4A4; Wed, 28 Aug 2024 05:12:26 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="FECwB00v"; dkim-atps=neutral Received: from TYVP286CU001.outbound.protection.outlook.com (mail-japaneastazon11011057.outbound.protection.outlook.com [52.101.125.57]) by gabe.freedesktop.org (Postfix) with ESMTPS id A9A4D10E4A4 for ; Wed, 28 Aug 2024 05:12:24 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=s5WKRhJ6kv7ffbofa/Wjo3hpXl/E8Qwu14DGHGsES2EZ2HHn1CbFkyO4q7FLLjpAWGfkJ6ziK5NFrHFb11EJ/TuF91dvYM8zojxQ3HE6X6PnbTCKP83sPIO+Z7AUAS/3siNK4tnSkOsh8kT7/CskkrISFZeCJVIMNOI5FZw9HwoSM8hBsdR4yrQ1BtbDuJXWpVVs2u4NWyxETYAk+xtky8KGH4o0XR2GnbiGslTb8unC/BQsAQ/CFl1+2LcNcy6Ce9EuOEkSmlYBTlRkMpF2gpZtZ75fySEvy0j0PwtZnRw4y6C3JNKzo9thaBBgZxSiE36M0RKF8/JCpQOE04V4hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nqSzD+TIEwJcbIxbpPutR6QFJxPtDwZqrLqSIzc8yHw=; b=Kxaogy/IdWydZqdoJUit9x+oP2iZNbI/VZHzZbij1NzdshAyAfpGaxu47QK12IK5ndYqHEuBR3brf3PBV9xb9saBxzabSotq6IexoZXVIzX9PDwdWH9b98SYkjnQd/015Iq+yLKUtp3WbpWOU0WQUT4T9tRNUFYxQO5gbTRcxM+nP+JnHzuBpvIqmuHORUIb4UZtZaFbiJKPH2n7bgF6TAb1AjdFN32tO2KcAXqLx2+gbG6VPcDWBc5vZRbFDzJtKzJdW22v27HTYfpAtpnsjyRLdYHjqU0zm9rOyBxZQs2Sw4tSfj0PhA0La1fpj+PNZbmf+8xS88UXWldodF9tTw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=renesas.com; dmarc=pass action=none header.from=renesas.com; dkim=pass header.d=renesas.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nqSzD+TIEwJcbIxbpPutR6QFJxPtDwZqrLqSIzc8yHw=; b=FECwB00vLcjDW/F7GTx8mFOE8CNUI1FC1kO0nqTYoZASQhSywvPWQY3VFWTXoqmVsE87RX5X6TNVlR8RUtt9nyczTUIZsPwc+rL2zzdYxsvyZglOYuaxVFyDHcgHtOwYtqNn6LCLtJdptE4qc02g/JWGtSoqt15PnzMNI6VsIOg= 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 OS7PR01MB11955.jpnprd01.prod.outlook.com (2603:1096:604:23e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.26; Wed, 28 Aug 2024 05:12:22 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%5]) with mapi id 15.20.7897.027; Wed, 28 Aug 2024 05:12:22 +0000 Message-ID: <87zfox1b9m.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v4 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: <87bk1d2pvt.wl-kuninori.morimoto.gx@renesas.com> References: <87bk1d2pvt.wl-kuninori.morimoto.gx@renesas.com> Date: Wed, 28 Aug 2024 05:12:22 +0000 X-ClientProxiedBy: TY1PR01CA0187.jpnprd01.prod.outlook.com (2603:1096:403::17) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OS7PR01MB11955:EE_ X-MS-Office365-Filtering-Correlation-Id: ffe114d1-2c7b-4600-7780-08dcc71fff6e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|7416014|376014|52116014|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: j3uEaqMK75JckLEgTvaygCdYMdVvyh1HXOxu/bM2STSqaNQkaHXWds8B+MArHDq1vflAtveRAGHPCW3BnHzDTdLND4WOgRCjQ1zl10D6qvHCWI8E8LXnBz7AVdxVEmL12hjfU92rjzNyX7id7BGp86CIHxFx/AJ4ePAIvwVLJzWXbIcLXJ0V3dKg0lZxrPy2RHsfrpTbJyPwLIC501orwbw5vE/GZswD7PrWIRtVgBnSMnF7IVo8BFy5rpatGHYvTomalRNKiJvCg1YyLGda63GFYY2o1ytAnS14+N+xPi1DHqG7kzA8E7ppAipLQ8aH3jdA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/WHW5sXWq2dM2+1egb/fdT9qJdL9thfEKHBfz26aVo0AINqbg= 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)(376014)(52116014)(366016)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: itg9mOQ0nUzUJCXtSIWTb+6TsEBvma7EWGKUTH7TbrzSVpftmjR7V0d0qQz46EC8UeZycC8YEYBtGq/5Rpat7yN/a/OJxiqdxOOujc28g1REF4+HVvri3Ir1uDLNhcIUh0TTP5O0/pj2n7hceDLAlhPcDxX16IjljhPUKtLs7FyC1k9kXHqUzcHfaPKbzI2KzAKAB+GHquMlJ4y11262ryjdbSF18kvvqNgW+kHl6zX7i8/R7Kiweyi3cK7ECYP8N3A3BuqLnk7of6KgPw+pt8FkBp7LTv3PvpVuodis7Cmf9pGTW7/0au4eYBwDGq1PnJwkQ8CNgcN1mEl9aomZfBmSQiaOGZEjPahOVlUBhF4VqZm81rVh8ySo2zgrhFpSBcPB5bXZF9mMKG/CEUnGPtptFtjj59L6VXjcuLX0Ej5iL727GaKe8Qy2KykZ/VTMZlFGUsEMJG2YLl/RG+Pv0gizCkdAfLrHUXqXzQ1jUUP1NcjeNaiXnbdW/Bfd1BdzryDKNv7OaEw0PUHzZ+RXkD8OKPrP7fIRW36+RI76GehmSRrT396ShUYb3voLb3/onQ2rdVHwnbMmQ/lG3c0t5Dl/rTNMjun9imX3FOGt/GLL+dwJr9Ae482+QQ9JwY+RHPmjAKfAVXEFLAWyij2LG79RBBREQrVbWihBgLNedFwkKLiuQMOWv8Xd+IdiiUoxP4u9IAmH4+COS5TRuUvrPj6ZnprJZpjhWnBR6Tr+fMlu2RcyS9wou3gmNG58xZ4K+rFd7LjMILVMV9tL1VQeUZ6PLSpLDmKlwnF7f+CkN+FEN7duaksFRN4KppDGJ6jhe/NRea0AsO8use6ZR10OAbwC0UHJua1lvpSJX4DzTkhsV4iiNB+P2HfVUWT7PM/NEQtqOjtaUTaID10JHkaf3wHBc7M0/leimx0PmhxylxWYs+fnJrjoKwTD0FiaP2mShc0rBOSVE/qwk9wwImq0Liyt1OzI7R9O3iJFYee//i/6iBVUUU3P8ISXJN7UDDhChtcQT9ZYNkLQHmasdFi5U8K2xd0dU9jQYta4rPIOpYRbBEZrYE6khghXc4LN7LzjawVRoNjNG9Fw75QWcE1QUWGmWPN0BUiH/goSDhkV8+ZFptlsqOTU5I+t8Yb6sBwKbHDpNxE+xeHaMOi9fqlY5SbNaAuYqLdfS17aVsmBhO5gyA8N1B+QZBf+yJdH/X2Pe3guCHLUIPXSVklL8Vr+EIwJg9d9S5dxfDBAp2ChgXW9mv8D1hhPugF7Hggg0tnD9P0wLa60JoX7+ggIuYBjIVzMERCUzniFmFi4fglqy6N2/bMwcUaRQeh3ih4XQydx3ZLRmh7jGpIxvw5pZjyqQocvik7o1Mhc2ueXwZCX2pzUiuqegkIR2gDhLNl74qX0Euo9XjDj12bo3uBgyO920VOpJ7qoAwMdSxQ+Lvm1WdRNM4zqwzFOoW//xYbTAGB94NGafmQIZYJYt6AEJ8rvrIXI8k8eKxwAJUF3otwgau0rTOrYDccFUK5njQaOvTV0LjlnVw5SjQA/IN297sDz7PfQuSvWec32Ec9XZd5L+/FXpOsU99atEw4STidBwnf+4nyyq+/RjKLnZ3DLQJlA1vpGybQJkuYcUE4pJTV/6vw= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: ffe114d1-2c7b-4600-7780-08dcc71fff6e X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2024 05:12:22.4177 (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: fhgGgzz9Zqz6nP4DKabh3NUin8vyDxSmDrpZYViC1w8Qhx6xFHZAyG5vJ475ejhz41awfB2Pm4ncwsal3ke0uIGWEiP80PmlpPLC5Mwldf60he6FfdVL2P7V9FD4U2hb X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS7PR01MB11955 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Now we can use new port related functions for port parsing. Use it. Signed-off-by: Kuninori Morimoto --- drivers/video/fbdev/omap2/omapfb/dss/dpi.c | 3 +- drivers/video/fbdev/omap2/omapfb/dss/dss-of.c | 66 ------------------- drivers/video/fbdev/omap2/omapfb/dss/dss.c | 9 +-- drivers/video/fbdev/omap2/omapfb/dss/sdi.c | 3 +- include/video/omapfb_dss.h | 8 --- 5 files changed, 9 insertions(+), 80 deletions(-) diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dpi.c b/drivers/video/fbdev/omap2/omapfb/dss/dpi.c index 7c1b7d89389aa..395b1139a5ae7 100644 --- a/drivers/video/fbdev/omap2/omapfb/dss/dpi.c +++ b/drivers/video/fbdev/omap2/omapfb/dss/dpi.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -845,7 +846,7 @@ int dpi_init_port(struct platform_device *pdev, struct device_node *port) if (!dpi) return -ENOMEM; - ep = omapdss_of_get_next_endpoint(port, NULL); + ep = of_graph_get_next_port_endpoint(port, NULL); if (!ep) return 0; diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c b/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c index 4040e247e026e..efb7d2e4ce85d 100644 --- a/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c +++ b/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c @@ -15,72 +15,6 @@ #include "dss.h" -struct device_node * -omapdss_of_get_next_port(const struct device_node *parent, - struct device_node *prev) -{ - struct device_node *port = NULL; - - if (!parent) - return NULL; - - if (!prev) { - struct device_node *ports; - /* - * It's the first call, we have to find a port subnode - * within this node or within an optional 'ports' node. - */ - ports = of_get_child_by_name(parent, "ports"); - if (ports) - parent = ports; - - port = of_get_child_by_name(parent, "port"); - - /* release the 'ports' node */ - of_node_put(ports); - } else { - struct device_node *ports; - - ports = of_get_parent(prev); - if (!ports) - return NULL; - - do { - port = of_get_next_child(ports, prev); - if (!port) { - of_node_put(ports); - return NULL; - } - prev = port; - } while (!of_node_name_eq(port, "port")); - - of_node_put(ports); - } - - return port; -} -EXPORT_SYMBOL_GPL(omapdss_of_get_next_port); - -struct device_node * -omapdss_of_get_next_endpoint(const struct device_node *parent, - struct device_node *prev) -{ - struct device_node *ep = NULL; - - if (!parent) - return NULL; - - do { - ep = of_get_next_child(parent, prev); - if (!ep) - return NULL; - prev = ep; - } while (!of_node_name_eq(ep, "endpoint")); - - return ep; -} -EXPORT_SYMBOL_GPL(omapdss_of_get_next_endpoint); - struct device_node *dss_of_port_get_parent_device(struct device_node *port) { struct device_node *np; diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dss.c b/drivers/video/fbdev/omap2/omapfb/dss/dss.c index d814e4baa4b33..5cab317011eeb 100644 --- a/drivers/video/fbdev/omap2/omapfb/dss/dss.c +++ b/drivers/video/fbdev/omap2/omapfb/dss/dss.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -922,7 +923,7 @@ static int dss_init_ports(struct platform_device *pdev) if (parent == NULL) return 0; - port = omapdss_of_get_next_port(parent, NULL); + port = of_graph_get_next_port(parent, NULL); if (!port) return 0; @@ -953,7 +954,7 @@ static int dss_init_ports(struct platform_device *pdev) break; } } while (!ret && - (port = omapdss_of_get_next_port(parent, port)) != NULL); + (port = of_graph_get_next_port(parent, port)) != NULL); if (ret) dss_uninit_ports(pdev); @@ -969,7 +970,7 @@ static void dss_uninit_ports(struct platform_device *pdev) if (parent == NULL) return; - port = omapdss_of_get_next_port(parent, NULL); + port = of_graph_get_next_port(parent, NULL); if (!port) return; @@ -1000,7 +1001,7 @@ static void dss_uninit_ports(struct platform_device *pdev) default: break; } - } while ((port = omapdss_of_get_next_port(parent, port)) != NULL); + } while ((port = of_graph_get_next_port(parent, port)) != NULL); } static int dss_video_pll_probe(struct platform_device *pdev) diff --git a/drivers/video/fbdev/omap2/omapfb/dss/sdi.c b/drivers/video/fbdev/omap2/omapfb/dss/sdi.c index d527931b2b165..22a6243d7abfb 100644 --- a/drivers/video/fbdev/omap2/omapfb/dss/sdi.c +++ b/drivers/video/fbdev/omap2/omapfb/dss/sdi.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include