From patchwork Wed Oct 9 01:44:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13827401 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 9E958CF042D for ; Wed, 9 Oct 2024 01:44:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2A6C410E624; Wed, 9 Oct 2024 01:44:55 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="lNVGoDj9"; dkim-atps=neutral Received: from TYVP286CU001.outbound.protection.outlook.com (mail-japaneastazon11011026.outbound.protection.outlook.com [52.101.125.26]) by gabe.freedesktop.org (Postfix) with ESMTPS id 571ED10E624 for ; Wed, 9 Oct 2024 01:44:53 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=E5HKtOMySErihMIfENmnURQ+d51HeBk6daLdGKAn/emfY1TWKMokA5utqdDeCmEtI+JstRIgn34lRkergugUo/I9BOpibNX7Bltk7GSAkZ0TAVeppfY+OqZcIKeo737J3r3/2pb+J2miHkpjfiPxhaVHNouxrfx/lH1t5ClPDRyABOeFZPD9RgGhthqBI4lP/Lckng5Q5He6I/hPVTeDjAgU5Ds/4u3lyPZJXmdN6wI6LQCDl2GkNgtD/3LX26jaX/bL8wS60K11xmBbX0Fyu1chvtCvOSqOerE1htXXBA3tNG84Ui/RSM/HK9NQ4/Q0QyMbdMl+Jrgx9nymf+h8eQ== 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=lGjZIhB+elB0dqTsvRysDjB811MCxqKaJeFpHJ6knI0=; b=KShvQ7GFjpZv78XWq4grdDd7rLotoI9SXO+GsQoXo+zd4S5x5SO7ra9JsZg2sygxnmYqoM+64tzkiQOyTsPXhWNxMxrztAg/eztC/dgCj2946xCgO1otaJB8EzghX8ggHvqhd8SMsUXP7lO449wigeFZCbYIY3Pq2bVZsAs1AynPvdfIhLkjprYUDVrsV+Miw0RhAuaY6BOHbIBJ7tv1pOSOElxgYsL+nBj+pxhuGjeEAItKDVwmgrt/lLzNXKzs3frQtvI6zlODfeFxp5zblsznS0S7e2ouEHFA6S+uZDxOzOfyiRvXnDoq0WhPYBZo0eC+aMtuzGkilvet9Y1d5A== 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=lGjZIhB+elB0dqTsvRysDjB811MCxqKaJeFpHJ6knI0=; b=lNVGoDj9sjJ0mXWdVLjsoyvwMZo5S1ssZAV3S8MihiYi9OGwtmQWV/a36Vz2NMf7QSJ43mUfG4kfVMrODLS8GjmPnrGsqXh8M8unjmCHVyhm9DBIFsEntA+r492soVNbMqRSErJ/AtqvQtXjvHB2yULXv86SWHu1TtVkSpVXsPk= 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 TYCPR01MB11140.jpnprd01.prod.outlook.com (2603:1096:400:3df::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.16; Wed, 9 Oct 2024 01:44:49 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%4]) with mapi id 15.20.8026.020; Wed, 9 Oct 2024 01:44:49 +0000 Message-ID: <87v7y2rqwf.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v7 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: <87wmiirqwy.wl-kuninori.morimoto.gx@renesas.com> References: <87wmiirqwy.wl-kuninori.morimoto.gx@renesas.com> Date: Wed, 9 Oct 2024 01:44:48 +0000 X-ClientProxiedBy: TYCP286CA0180.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:3c6::13) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|TYCPR01MB11140:EE_ X-MS-Office365-Filtering-Correlation-Id: d190d650-d59e-418a-690e-08dce803f60f X-LD-Processed: 53d82571-da19-47e4-9cb4-625a166a4a2a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|1800799024|52116014|7416014|376014|921020|38350700014; X-Microsoft-Antispam-Message-Info: Nc0sTzZqwtzqyYrHAtXKE43tH0akrPwnPkN3XeLBdMhjyxVz/fxXz8JbZ7ljkGj9JWhhjPkb7MrfwxaY5sTO+FKmMuKwqo4fYOv8tK4OD6YrHydjDtqk+Bn/PPZlFns/RQI0bT8BnLb5Sg75QJU/gKgjcKtyr+R44g0Z8XIzMDj4tCaNCS4ljtgHW7JeR/KimAq2Zpm6DEhqtCfd3O8i4pHFZt1sQziauSisA6dF+x36TwQJe1iLdenqOWAIxL4SMlIMdoPFOmBFEblHLrsqKqqKtVauzZMlqpxl1E2oGEXXc9taRaQDLo5tCzOd5c8haBuknuM52+KlAex9Le5DY1CFtqk52ycFogzcoFRZ75VLeKoFY2YescvnfKW4V2o/vLdR7rAX9skIlu22UPMRe1tDePKfkr+MyDQqsksKQpkSUfAgmaFjCchNTZFib7wCgqBg00f4xUbo2kltt+KeCo4UfYNzsJ9XjmW1DoD6vwqqik1BwQQLXRMQ9F4CoAOnl2uh+5UF9w8Fc3ypRd6/ZlwJQPf94odL68Bdh0Dg8YI/vJ5LxHjMGb8lMmcRpgFxJ8z0oQ6FTFlYNbOyky/wS+t0uQhXKC/jQ+ktp8GgRwosOry5GH8k1sH/jh5ng/UqiXmLq38vZSo2WGAFXm4Q/iRs4kEMcqa5Dwwb8BoPVn3cTK5AcBJ0Mo8ex4VD/v0vmZUDzkFQzvJZu9sXZtvI1/GCqoccMbHxz08U4wFo4MPdLXgN5v9FwdNpZ//z/Xxyk8ziwOrMGWM/Nwec8cH4lZ/Or/ur0wz21Hl7gVyJkKPMR3nUSzwkua5ygCfE3X9bildAHhxxVryzJZClA6/ul/oPlpihTK8DTCU56ghGFhSWf6HXQkJdahpttGlnuKQ/YIcF++cc81MuCjb/3yYDl3+XTwWz9zLOEDYe5hinq2KhWJqpubGn8TfbUmjGUdBOBCw3454Ns7Wwl3GD0EE3FmX4lRn+MOsKY4dPCFYnwo7pxgU26DhT6y9lNzL72AU1peDaELScEDIaHF5XPw/3CG8aoI/3rRPQcXACcjbARNOZGFs0RnbE48Y9A6IjbjG4aLZvdBibbMFYvlbnuC1T9ua8YrAW/u9UaluogM/MIyijqLi8kh+jalBP7W5rixqMXpzLdBz9xFdhRiSCLwLdlElZs3RlbSatmldKMqRBla43FD8fx89NnLHs0UjCZgwVzOB1VsShOoN70eXGOTb6ypgSehBWKFXsEknXhvuTfTfL1IkaMda4wdvw0kpBPz099WNlLJTxJF39oqFQyHX5SYDQaQOo6yhfLvUuYXi0laCKCpNuPb30kuhaKbi7exo+sNEBd+LMGMmvgSij6Lf6i+LU9D0XjlqkFM/GnI3RON0= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TYCPR01MB10914.jpnprd01.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(52116014)(7416014)(376014)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jBImTV7yhrFful175lzEcz4peFx4VZ88KkJIANTqSHVGPcx+cITFw78VeH7QM2i924m652FXw5uweVdUTGuu2rkwJ/KzJDX36P2GnYOMf8GcbcS6x49OiInGb5tA+zbbX3+gAj3b9ejFqpJwXNsWQjNXCRo6oY2GK4imWgK17w0g5mQbcB+FmIpGFhZ5FfzjIfXJvv1Rn1/Wmj3F0V5nT6IZ/SAOKYpkwoLM3CJL/NeWwVBiyeeS65TWzq0okVYzB0GzcoGEskZ/wMUe/hEVpKfKPU1oyMzt/1qbnM0/+Rs5h1XzSpmxohG8IlmkTsKPm6przwAcNGid1Iga5X+/3M3M2hDm/sdTXC9gNn4July8BXvCiFZc6VOQaiCyoJPVJQTdV1A6cTDQv0TEVFW0eV70BDBvD+vk++PNkMuLqJeaHY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luAXb7FUm/EAVRIclxckANo8bwlJYA19UZN8eOAfGcl2RxNP5vwmbopxpF237fHCtW3cEYnzlK6MthVcwhUXRJHObjmcEvPaUe78843hpOc4gBpzkcunX2w= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: d190d650-d59e-418a-690e-08dce803f60f X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Oct 2024 01:44:49.1597 (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: SKIAV+4aaRLeuDdElsJt2Haw31KNbuQfTMM6omgI3L8K7aWGb4XUSzGgK5nAaQk6qUwhKLTQBY3u1S3bi57XsUomMe2vISdTJW1REN7123465xEmdoHVn0xeOhLq3GkO X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYCPR01MB11140 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" We have endpoint base functions - of_graph_get_next_endpoint() - of_graph_get_endpoint_count() - for_each_endpoint_of_node() Here, for_each_endpoint_of_node() loop finds each endpoints ports { port@0 { (1) endpoint {...}; }; port@1 { (2) endpoint {...}; }; ... }; In above case, it finds endpoint as (1) -> (2) -> ... Basically, user/driver knows which port is used for what, but not in all cases. For example on flexible/generic driver case, how many ports are used is not fixed. For example Sound Generic Card driver which is very flexible/generic and used from many venders can't know how many ports are used, and used for what, because it depends on each vender SoC and/or its used board. And more, the port can have multi endpoints. For example Generic Sound Card case, it supports many type of connection between CPU / Codec, and some of them uses multi endpoint in one port. see below. ports { (A) port@0 { (1) endpoint@0 {...}; (2) endpoint@1 {...}; }; (B) port@1 { (3) endpoint {...}; }; ... }; Generic Sound Card want to handle each connection via "port" base instead of "endpoint" base. But, it is very difficult to handle each "port" via existing for_each_endpoint_of_node(). Because getting each "port" via of_get_parent() from each "endpoint" doesn't work. For example in above case, both (1) (2) endpoint has same "port" (= A). Add "port" base functions. Signed-off-by: Kuninori Morimoto --- drivers/of/property.c | 54 ++++++++++++++++++++++++++++++++++++++++ include/linux/of_graph.h | 28 +++++++++++++++++++++ 2 files changed, 82 insertions(+) diff --git a/drivers/of/property.c b/drivers/of/property.c index 11b922fde7af..6a5d27dd0c64 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -630,6 +630,43 @@ struct device_node *of_graph_get_port_by_id(struct device_node *parent, u32 id) } EXPORT_SYMBOL(of_graph_get_port_by_id); +/** + * of_graph_get_next_port() - get next port node. + * @parent: pointer to the parent device node, or parent ports node + * @prev: previous port node, or NULL to get first + * + * Parent device node can be used as @parent whether device node has ports node or not. + * It will work same as ports@0 node. + * + * Return: A 'port' node pointer with refcount incremented. Refcount + * of the passed @prev node is decremented. + */ +struct device_node *of_graph_get_next_port(const struct device_node *parent, + struct device_node *prev) +{ + if (!parent) + return NULL; + + if (!prev) { + struct device_node *node __free(device_node) = + of_get_child_by_name(parent, "ports"); + + if (node) + parent = node; + + return of_get_child_by_name(parent, "port"); + } + + do { + prev = of_get_next_child(parent, prev); + if (!prev) + break; + } while (!of_node_name_eq(prev, "port")); + + return prev; +} +EXPORT_SYMBOL(of_graph_get_next_port); + /** * of_graph_get_next_endpoint() - get next endpoint node * @parent: pointer to the parent device node @@ -823,6 +860,23 @@ unsigned int of_graph_get_endpoint_count(const struct device_node *np) } EXPORT_SYMBOL(of_graph_get_endpoint_count); +/** + * of_graph_get_port_count() - get the number of port in a device or ports node + * @np: pointer to the device or ports node + * + * Return: count of port of this device or ports node + */ +unsigned int of_graph_get_port_count(struct device_node *np) +{ + unsigned int num = 0; + + for_each_of_graph_port(np, port) + num++; + + return num; +} +EXPORT_SYMBOL(of_graph_get_port_count); + /** * of_graph_get_remote_node() - get remote parent device_node for given port/endpoint * @node: pointer to parent device_node containing graph port/endpoint diff --git a/include/linux/of_graph.h b/include/linux/of_graph.h index a4bea62bfa29..44518f3583a4 100644 --- a/include/linux/of_graph.h +++ b/include/linux/of_graph.h @@ -11,6 +11,7 @@ #ifndef __LINUX_OF_GRAPH_H #define __LINUX_OF_GRAPH_H +#include #include #include @@ -37,14 +38,29 @@ struct of_endpoint { for (child = of_graph_get_next_endpoint(parent, NULL); child != NULL; \ child = of_graph_get_next_endpoint(parent, child)) +/** + * for_each_of_graph_port - iterate over every port in a device or ports node + * @parent: parent device or ports node containing port + * @child: loop variable pointing to the current port node + * + * When breaking out of the loop, and continue to use the @child, you need to + * use return_ptr(@child) or no_free_ptr(@child) not to call __free() for it. + */ +#define for_each_of_graph_port(parent, child) \ + for (struct device_node *child __free(device_node) = of_graph_get_next_port(parent, NULL);\ + child != NULL; child = of_graph_get_next_port(parent, child)) + #ifdef CONFIG_OF bool of_graph_is_present(const struct device_node *node); int of_graph_parse_endpoint(const struct device_node *node, struct of_endpoint *endpoint); unsigned int of_graph_get_endpoint_count(const struct device_node *np); +unsigned int of_graph_get_port_count(struct device_node *np); struct device_node *of_graph_get_port_by_id(struct device_node *node, u32 id); struct device_node *of_graph_get_next_endpoint(const struct device_node *parent, struct device_node *previous); +struct device_node *of_graph_get_next_port(const struct device_node *parent, + struct device_node *port); struct device_node *of_graph_get_endpoint_by_regs( const struct device_node *parent, int port_reg, int reg); struct device_node *of_graph_get_remote_endpoint( @@ -73,6 +89,11 @@ static inline unsigned int of_graph_get_endpoint_count(const struct device_node return 0; } +static inline unsigned int of_graph_get_port_count(struct device_node *np) +{ + return 0; +} + static inline struct device_node *of_graph_get_port_by_id( struct device_node *node, u32 id) { @@ -86,6 +107,13 @@ static inline struct device_node *of_graph_get_next_endpoint( return NULL; } +static inline struct device_node *of_graph_get_next_port( + const struct device_node *parent, + struct device_node *previous) +{ + return NULL; +} + static inline struct device_node *of_graph_get_endpoint_by_regs( const struct device_node *parent, int port_reg, int reg) { From patchwork Wed Oct 9 01:44:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13827402 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 6674FCF042D for ; Wed, 9 Oct 2024 01:44:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E3A0310E625; Wed, 9 Oct 2024 01:44:58 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="K1PvEMFB"; dkim-atps=neutral Received: from TY3P286CU002.outbound.protection.outlook.com (mail-japaneastazon11010045.outbound.protection.outlook.com [52.101.229.45]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8905410E625 for ; Wed, 9 Oct 2024 01:44:57 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=LVJ4WsU6Ju/KPJy8UQL6g8L4k4UeIOFwwApjKYJ2/EjeMcWi3YWi0peUNWTwtjLNH4D9QEfCvRik3EDadCewWfCdxXaLSNU3UDJaBM2WcdhWHVF7G+867P6mu01saCZWjHqz2Fk70KDeXJXlHjlmkT/eCoocEWrnW29MtiVdWNinYa/1BW3XlysyBAySjGh1RNZcqHnBKRgHYmf2XXN5C6ypgIDs+OctAn67RnywFIkCPtZWhMPyYJ1zxICwXLj7cRndPrxMQUVGKIcRE8vvGV2qKJ5rQs54ExGBYVrfShsNEUCN+5u7OlLgRcu8K044BUxMT6bg5Guzh+LiuviXNg== 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=r2H04ql44TlbQ63U2+vx9o2liCe2iLnQ+O2w05ZYsG4=; b=AbiczoZ9TXLpczwimGYvDRvFRO2GSj5vHeb5wTLPp6WpEjsO3zZhs5GnBZD0gsUDxCFU3oUddfDqvH/ngtj3NuLt/xMkYivf8gxXOOaWWuo7fuTcs4COK2L1S+B6NFtj5L8Nf962RiMdxyWH2tqYSWxsoKDvdwkijfclA0SSkg+WlqQQ9j5e5zsgzT+ngoWiRHGwpmYrpcVoBKtiJvJ0GN6tGXDR1Wd5nnaHsamMhVvsJwfK/reES4xucOpj08n5xFrig/ieC1E0AEDmpSukPJeoABIFlUTXy2/0DsrbSeOl22FdTSiCn1Y16pqk+jmayBjfOYaCNIdOZN4tTWoYCw== 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=r2H04ql44TlbQ63U2+vx9o2liCe2iLnQ+O2w05ZYsG4=; b=K1PvEMFBCW37EqygtHNlQff0/nRfSusyN/ahzEpL98pulj7GT2UdNT1tHBjv1+XGsy2ByHf7aUm8dGUgxBGw3F1LKA5VTMZYUP9FfSO1CWXBuo+JIRMjtK7cp1kFWfBby+kI3TzW+woxZ+SqtXLJrQdcVuFP8Tr0qLLKcf1wwZ4= 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 TYCPR01MB11140.jpnprd01.prod.outlook.com (2603:1096:400:3df::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.16; Wed, 9 Oct 2024 01:44:54 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%4]) with mapi id 15.20.8026.020; Wed, 9 Oct 2024 01:44:54 +0000 Message-ID: <87ttdmrqw9.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v7 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: <87wmiirqwy.wl-kuninori.morimoto.gx@renesas.com> References: <87wmiirqwy.wl-kuninori.morimoto.gx@renesas.com> Date: Wed, 9 Oct 2024 01:44:54 +0000 X-ClientProxiedBy: TYCPR01CA0191.jpnprd01.prod.outlook.com (2603:1096:400:2b0::16) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|TYCPR01MB11140:EE_ X-MS-Office365-Filtering-Correlation-Id: 23ad3c82-380c-4eef-68f2-08dce803f970 X-LD-Processed: 53d82571-da19-47e4-9cb4-625a166a4a2a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|1800799024|52116014|7416014|376014|921020|38350700014; X-Microsoft-Antispam-Message-Info: v2sYrMhSnc75vpP6Ly7YY3gtJcqbK8qLZnn52T1A4uWM1uuSPqJqxU5Um6F/Xh8MWb/9iAOVwMNUBABwPztNXEEzLABjGK6AcXiE2tzUup2Ed/mxZ7kL5KVq+ufvnkSqhBpKklaS1iReEUsLvysmFtn7C9xE5/w06m1q5kM7skPyu4pO/yKWQuIEtcHt/eeMOmmWNqqG05aZs0z3wvEGDXmaWHDjSYWnwWCQgCvOwgDuP408XCPkok43X725kTG7D6LQe3LnDav+NJD/2/gBPwSG45+oeWUZ+QwDSTW85wchJSuEaltVuEUmQBoZIib20zgREzieMeoKub4EAjd8TkUuCdeqVd508TxPWbdxDTERglh3l8pdXkKgEZ/sRvS2E+4hoFLObFwMMO1u8qX75cE8aymKVwMtWn4hCEquDNLvyPBUiWI0IB79eZXyYbHr7M2bu+Lr/R0XR4EqrlgbhfkZbuA8ARp/ioJbPYT7ULvBrX48SmEjSUfGoSo1T0JgWjtbz7T3r8eyR1CCDE+iTCx5InT6HiSazWVbs+YL8mNLBGbtnz0VtL5Lyq10gbdJrnCrzmxX3mfkTCPfE3DP4iOzWUijifaLSfdiyBgJWjGCQZyQarVZytkVBDimsVOr+ygXejPkIUUDuPIFMwhGUXNkIiy9jlnB0Ca6tQYykNmmg8sQOaW+h2JAn+seg6i0mOoHfVDwNnlowgI9wlE8/VL2iV1v3SW50cBVxM7GtBVQygZCGgn4kY9Gh0nuTwwNtGIXAGufx2tUPSJsqktWGdlyysnTYS4bgUlQUxabUwr2FVNRA3zFPFFVAKHP7ZKcWH4ATRmHkkOIcYb8Cu1LaIkoCkgxzEHf+N4hOljDlComLg/IrT0o79MrxGDWnB/6R2ICCsI9oG9R4MJDuA3UXU4ikO0JnLl3FEJd1E0J86b+CzPFqwqaD3hEGh3s0J1jZa3FzQPpyzOFrcGVhm4sN+551ku185Vbq8VdCJsuekoeUZM9Xhp+ix025M6e0SYyOsnECIX/X0qZ5bCthWORpx/8VIRZr1ZAIX7ENxw6WrMr9OksNyPr5+fg8GjKKj9tIaN4Sa+U/U/mnoevnXXtkk19LMTaove6tRU2Fh/GjnhYuR4GaRDCUdplRUlUn9hr9F6DT5FKg1CPtwI9A1I4d4xuSDtDXG8Ene3H497IXkLHNT1FmIqlaWXUTeY7NljpwviN7HUSVGWv0jnYPI+stELGT/jilyTLbiQCVD0f5DHpPtKQKWRU6gz/jjH86TAxPSL6EEb7rQwS9alFRVxPogy7kxW92ylq6PsjfUVA2ODJSL3+Kn+JDuH/LyR4OiDQb59LXP+J3ZPNu9JN4oWvjUHCuEzXZNJ2UohqJ0UaBD0= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TYCPR01MB10914.jpnprd01.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(52116014)(7416014)(376014)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ccgerl7ngyJ/bRt1xtm5l1wO/V+MuuOjBNhFfc7kkptArAjtYZzdO6zfQEnVsqDfmdhWu+PgfHZA65XRWMD9DgMha69iFH3K0CpqCkRG5yeWnSKqWIsaciP9hPTAp/AwuHwTiIWEu6F+HSFLR4nbbthc+3DJFdEgpYH8qWOx7ZkJAtyJ5/xHw7sz7KRA+VHRxHLsmHPDWMrpb1lEG86tLYyFWvZ2uI8H9bxuKttlUd7hhvXPqgV1+iCB07q6D2ANDRY14e269wQvq1UK+cMeSMTGsRbJE0urf7KZm+gHzY7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1HIZyVjXD8RzIlkyGvyNKqjALJQ2Dsc/xb/6MxRRAON9u4XTKvyX7tWZqoykBtaS9P4xzxdG/ILi5aYb9N3C84dI232yZYqjCw2oPiALnJu6srXGwER98i5dxZk+5905V+dW3N95N3jSI/AoW35mi7xRam1jc/0LFDM8StKoHAiZb6QsWxXn6nVHz02xlLdBVZAS3/FqQytDhuxz+L99kOjWOasJ4b3m9p5+Qi/OGi3fECfSHrHq1qo2UIN8977A0gVivFeNg= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 23ad3c82-380c-4eef-68f2-08dce803f970 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Oct 2024 01:44:54.8495 (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: ovmUM+Ln5d/wwv6D2JYgc8H/0pW2suWsHe6skFN7b57g7Hxo/lEh9CzIxypWkejZGZMj16HSuwqhIPe9p5+jLbEFIzbqIYKbBi+Wxxh+ilndGiMJaqxKe9MxGmBn18IT X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYCPR01MB11140 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 6a5d27dd0c64..bf15bed69e6a 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -667,6 +667,33 @@ struct device_node *of_graph_get_next_port(const struct device_node *parent, } EXPORT_SYMBOL(of_graph_get_next_port); +/** + * of_graph_get_next_port_endpoint() - get next endpoint node in port. + * If it reached to end of the port, it will return NULL. + * @port: pointer to the target port node + * @prev: previous endpoint node, or NULL to get first + * + * Return: An 'endpoint' node pointer with refcount incremented. Refcount + * of the passed @prev node is decremented. + */ +struct device_node *of_graph_get_next_port_endpoint(const struct device_node *port, + struct device_node *prev) +{ + while (1) { + prev = of_get_next_child(port, prev); + if (!prev) + break; + if (WARN(!of_node_name_eq(prev, "endpoint"), + "non endpoint node is used (%pOF)", prev)) + continue; + + break; + } + + return prev; +} +EXPORT_SYMBOL(of_graph_get_next_port_endpoint); + /** * of_graph_get_next_endpoint() - get next endpoint node * @parent: pointer to the parent device node diff --git a/include/linux/of_graph.h b/include/linux/of_graph.h index 44518f3583a4..a692d9d979a6 100644 --- a/include/linux/of_graph.h +++ b/include/linux/of_graph.h @@ -50,6 +50,18 @@ struct of_endpoint { for (struct device_node *child __free(device_node) = of_graph_get_next_port(parent, NULL);\ child != NULL; child = of_graph_get_next_port(parent, child)) +/** + * for_each_of_graph_port_endpoint - iterate over every endpoint in a port node + * @parent: parent port node + * @child: loop variable pointing to the current endpoint node + * + * When breaking out of the loop, and continue to use the @child, you need to + * use return_ptr(@child) or no_free_ptr(@child) not to call __free() for it. + */ +#define for_each_of_graph_port_endpoint(parent, child) \ + for (struct device_node *child __free(device_node) = of_graph_get_next_port_endpoint(parent, NULL);\ + child != NULL; child = of_graph_get_next_port_endpoint(parent, child)) + #ifdef CONFIG_OF bool of_graph_is_present(const struct device_node *node); int of_graph_parse_endpoint(const struct device_node *node, @@ -61,6 +73,8 @@ struct device_node *of_graph_get_next_endpoint(const struct device_node *parent, struct device_node *previous); struct device_node *of_graph_get_next_port(const struct device_node *parent, struct device_node *port); +struct device_node *of_graph_get_next_port_endpoint(const struct device_node *port, + struct device_node *prev); struct device_node *of_graph_get_endpoint_by_regs( const struct device_node *parent, int port_reg, int reg); struct device_node *of_graph_get_remote_endpoint( @@ -114,6 +128,13 @@ static inline struct device_node *of_graph_get_next_port( return NULL; } +static inline struct device_node *of_graph_get_next_port_endpoint( + const struct device_node *parent, + struct device_node *previous) +{ + return NULL; +} + static inline struct device_node *of_graph_get_endpoint_by_regs( const struct device_node *parent, int port_reg, int reg) { From patchwork Wed Oct 9 01:45:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13827403 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 30BD9CF042B for ; Wed, 9 Oct 2024 01:45:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AAF7410E626; Wed, 9 Oct 2024 01:45:12 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="RnCCnrk1"; dkim-atps=neutral Received: from TY3P286CU002.outbound.protection.outlook.com (mail-japaneastazon11010062.outbound.protection.outlook.com [52.101.229.62]) by gabe.freedesktop.org (Postfix) with ESMTPS id B356310E626 for ; Wed, 9 Oct 2024 01:45:11 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=s91hgBe9Ja1fsry+HELBkDcfUxXmD0U2N5gnqSfd05+Cx+VQ97K5YuWbORZYAkMf+bC/77+HL6aDKKQi+xeYliG4cqz1AIrtJNXqsQlHy/7Foiefs8h2n13vRay96Ce8o8rV1qwVy9QF3KDg/Zzx0vGMOnvDxBqgDIg0G7imPzmhQXNnNQrinYoFFQdZmXL4NQ2j6UvZUImAOerllzNMbGRRyLEa/M8TT5++EdwVM99nZoHkqqkTFsXaxk/imRwPjjd+X2BItuQhdxTQMeidUWgCGJEF/PiNa5+uC5J2BurfUQbU0V/wZtYmUcaDT8zJ0g3fHfZw9HFkfO2zvn09vg== 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=xCQYjzRlD/dbDOC/L/E60JZMKdrk9KVawhDDbuptk7I=; b=JniGmn5xJfVccJ5GJK8PMVef3cDCKC4Y5CAvd1Y2NrEyuw8z4Q5Eot/Rm7GurKwYiZZ3KPoV0ElJY9BGD20e6z/t5DsnmRHLkSkXe/RCUishUsIacZWODdWY5HB8OW1TU0kVFduB1vevPigpKjMiWu5YCx3YfWcQ2NwDRPoiEOjjrL7+9Jj7NVR+P77T+dNzd0DSCRXxM+aQNp8aWveB6ci6R8ROxem3NsHhkSl/06+WRB/dgLA0ReN63amRoMJlfXwchLuTNTV67UVdDnswFuJlqSyL9ptJynMAc+e3/1u+nnbRpY5JJthME3o63rMiRvdVFqAiFakeW2FCZyRGXw== 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=xCQYjzRlD/dbDOC/L/E60JZMKdrk9KVawhDDbuptk7I=; b=RnCCnrk12Pmp7WnmZYQRBUoDjaMGsNJ0afm6imSoUQn/UQVkweedWybeoFG0+UF5wO5v4KZBUVSB/OhZAdul4i/aNsDPzdgtaKGtYaZ0mEXjYf51rUCxFMgB84W4VmbQ36nXQrI8G8aWbxor1TUJdk1qJ0X4Bat9/424MuERTlk= 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 TYCPR01MB11140.jpnprd01.prod.outlook.com (2603:1096:400:3df::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.16; Wed, 9 Oct 2024 01:45:06 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%4]) with mapi id 15.20.8026.020; Wed, 9 Oct 2024 01:45:06 +0000 Message-ID: <87set6rqvx.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v7 3/9] of: property: use new of_graph functions User-Agent: Wanderlust/2.15.9 Emacs/29.3 Mule/6.0 To: Daniel Vetter , David Airlie , Helge Deller , Jaroslav Kysela , Laurent Pinchart , Liam Girdwood , Maarten Lankhorst , Mark Brown , Mauro Carvalho Chehab , Maxime Ripard , Michal Simek , Rob Herring , Saravana Kannan , Takashi Iwai , Thomas Zimmermann , Tomi Valkeinen , devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-fbdev@vger.kernel.org, linux-media@vger.kernel.org, linux-omap@vger.kernel.org, linux-sound@vger.kernel.org, Sakari Ailus In-Reply-To: <87wmiirqwy.wl-kuninori.morimoto.gx@renesas.com> References: <87wmiirqwy.wl-kuninori.morimoto.gx@renesas.com> Date: Wed, 9 Oct 2024 01:45:06 +0000 X-ClientProxiedBy: TYCP301CA0021.JPNP301.PROD.OUTLOOK.COM (2603:1096:400:381::18) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|TYCPR01MB11140:EE_ X-MS-Office365-Filtering-Correlation-Id: 3d922865-a54c-4c59-6bc0-08dce804006f X-LD-Processed: 53d82571-da19-47e4-9cb4-625a166a4a2a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|1800799024|52116014|7416014|376014|921020|38350700014; X-Microsoft-Antispam-Message-Info: +3FhqUvMHxYXeQEYoMGBwp39L5a78xCwnvbFyHI9FuFi6Lcs/U+Vnchhibc/ypGwpm/QSzML+Acd3kheB1cqimBOnPeBmEVkgawnkNNGiVPUleQ606VqBtNDTz25Mn2RimYmndi68RxYISpWYC9AwiEPiPvlGru4Kzprlb+iMJQsS9cEgXq+u7+NhflA8LouCDebt9o4V1v1Lq0nqxhSZAI7jcTMI8PdwYa4s/jukGNl8gR6KOs0VyquqtDrUYuvvJHS6rh4IFQqc7B6omzliueVUgCox2Ag1QZbtqMKUnEvs9MRdajE2v9vfC97fB6G8dfNHcIxMeoD+I1piIJk3ij9NSjWQXy3LtMxaO13cSt1QiVA52YY2RAIRoyJjIeP/eScVTMuKFQgpyPFmi0qkKoQ8hvIhhWvrDfM+HvoY7QxejPh3rK5eIV7jVeLEKZMmRdB7pnxdhkVT6j6NNF61Vakh8LCR2oHana7ty3oEQBqitSX+fLNcoOCcM+2ENFSTNNdlHEIXZNcnFYJyTOkWVGDENPgbzQRiY17sJLb9Z//4/N/Ld8/aaB+6CkuYjKU83jbr0ZdG0X95fDMSSwyDkdK7Uij58aeRXd+wnd1U/L3nS6nVmlf1/FeVxQ8RNfsGtGFp5EO47/GzeBSwejydpm0m/8+5eAYex/35wFj1kF+nNuIpYkG1BH1bO4axe8o9VHTNRlBc2owQaSJaQHeLaP8606vryzta0UhSKQOX4yu+fxz9iM7dummJ3yrjglwOcebmBdypnzDRv7NkS+RRFLEUTp+Uq0IslrZIfLbQAcT5RzbDaH9t3iBLb//Y6G1MqfW+tpGEiqKUQHR+sojONYp4vn/ZBh349njF0yTL/D82C08ZihLpHIm8Sy4wq9amf7slZGpuXE79kH7LM6LNe78LTWcIejEFJSOkqGWqiVu+Fe7J+QtYvkdtBRN6UMWITVR0+qFVT+HBYwdKUNq0nlAIclSzUZsRBgfbkFgsG3+i3pil5MVFsa5mH5xvKT41KrlLVaLYRiCs/NsIgd0Da6ahjwV1FgZAfcXj2dF4KWDhQMx2/ztlWZ0SqemskpMtD5zpSVGaFNc0ir5KCgoq2frT6WJU0UIOAsnRRddPYLVxzx2JP3fzwKJ+PoVHh65lcdn2+UY/hG0oRuqDkrXhMLb0c/Gl8upsx7cEMYdSf12exBEUY4oGuOHV9aKsr8wedSGn9t7OopwhD3OMYTJFJGE8AgArVkf7/UAES33SnVflf3bRxtdYc7UHwU5dJ9itSjHkc8htaPldpP+R0lRmLg2L/K0XRr4GYg4s84C4ix5v5V3Dj7KzQpdBfvaAKj+PtfUwGN5euf1mOqxtq9tww== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TYCPR01MB10914.jpnprd01.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(52116014)(7416014)(376014)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: srOYJAy0XwBNEaYL8mOBAa0wcpwQKNVcmybX4HiA0nvNaD3lY9D/h0km/u/DBOdvWTjfld/hK2rf2euOhJV6FgNgjlKcrLzKBR3mfqDlLf6dJhfWiJ/VMu7gEtiFF8a+YQzPjovLTtKeCac5+BUgHiyHtdj9WJpFXPciIBWwA88tRQ3rhMlrvSRB73QkDtmduL8Fb+b1Wi6+KC8D4VKYa80IUDvb/TNh5oBGujrqgPBMOU8nFQazgmXGNOtK37mvAbanOjz1uqSx75Rjh+l2D3YxIyIDIFdUrzkTveZpAY57p+YiU7uTH9WVsXRSd8B7YJX8s0tYUahOcnm8xCOmkHegICR8Qyhb34hMaNNHnYDFKfzuc0/yuVqxs61IGI6X8LxR1JWniAC/Ne8X2Z9DkyL4Ieu+7+Lbg2DocEjlxd/jYDUCxGZRcb1GGPIaBXFvx13yVxedpS3Okrzd85xSLOAaGrWJbfMesvajhHzC/PECO0cZ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3Df+v39xEWVKHT1tIuTfhA7CJgJEvnKJI6FzapLMpPVAqXieOpyqpT+bxI= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3d922865-a54c-4c59-6bc0-08dce804006f X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Oct 2024 01:45:06.5464 (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: kAztUCgX2rMa4jlSXipgsH9xVxEXea6PbJHPCF3r8nn4G8y9mn0To1KJsFg7Y8NB0V6CSgZN1FnK0y74juBsU/kAFmopGP8zGOrqtUqSBk0++AVgCAeZ8Q6GC5ECpusE X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYCPR01MB11140 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Current of_graph_get_next_endpoint() can be replaced by using new of_graph_get_next_port(). Signed-off-by: Kuninori Morimoto --- drivers/of/property.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/drivers/of/property.c b/drivers/of/property.c index bf15bed69e6a..7c1a8f36e314 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -717,13 +717,7 @@ struct device_node *of_graph_get_next_endpoint(const struct device_node *parent, * parent port node. */ if (!prev) { - struct device_node *node __free(device_node) = - of_get_child_by_name(parent, "ports"); - - if (node) - parent = node; - - port = of_get_child_by_name(parent, "port"); + port = of_graph_get_next_port(parent, NULL); if (!port) { pr_debug("graph: no port node found in %pOF\n", parent); return NULL; @@ -741,7 +735,7 @@ struct device_node *of_graph_get_next_endpoint(const struct device_node *parent, * getting the next child. If the previous endpoint is NULL this * will return the first child. */ - endpoint = of_get_next_child(port, prev); + endpoint = of_graph_get_next_port_endpoint(port, prev); if (endpoint) { of_node_put(port); return endpoint; @@ -750,11 +744,9 @@ struct device_node *of_graph_get_next_endpoint(const struct device_node *parent, /* No more endpoints under this port, try the next one. */ prev = NULL; - do { - port = of_get_next_child(parent, port); - if (!port) - return NULL; - } while (!of_node_name_eq(port, "port")); + port = of_graph_get_next_port(parent, port); + if (!port) + return NULL; } } EXPORT_SYMBOL(of_graph_get_next_endpoint); From patchwork Wed Oct 9 01:45:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13827405 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 B6C11CF042D for ; Wed, 9 Oct 2024 01:45:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4477F10E62B; Wed, 9 Oct 2024 01:45:25 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="QzODufmT"; dkim-atps=neutral Received: from OS0P286CU010.outbound.protection.outlook.com (mail-japanwestazon11011067.outbound.protection.outlook.com [40.107.74.67]) by gabe.freedesktop.org (Postfix) with ESMTPS id 378FB10E628 for ; Wed, 9 Oct 2024 01:45:21 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KwjnEU89cZA/kwUer2uU7okbZVfS/siorfx7t47ISAwAPpwTif5WQwowaxvVRAYL9zSNCRhM885PKArM3FdkdGZ8amoHt1aSeSpmTB5Q8s91B973p/jIKpsZm6GXYQQOXYZgCJqshQLQhOAwo5C5HIZacLU8VcSaLfJiBs/I4UCbCwIT73EzypapL2OQVefnIfifp0yyuieo7kwRrMjoePWM4aLTU5n/YwtE9FJEzjmiUzhwIkZXwiNVfsXaYWSynzWd4aAlOANsF+UE2INanYdTkzzSCFw+1duGC1Kn85jFUOUU87CwcIrQpEAg578pEr+cDAkCMO2XVJYuYjRIvQ== 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=dmn5y9sJGI4V5IdSH3mR/GkeQTbPcQThFcwGQDjqfvo=; b=OqSS3krcMY272nWMtz4FoXg3zf+CcVIq5CleZ0uZULGSQk11PZIjDZDSsp5tCO3RGClwleofNCoJdlA9MlaYG3Sa+BkHh+6kWG7I20ECQ+UEm4peGgaTDHUolE9y/kezaQ0zlmBIMCAHgOcXqufol8aSVA1sJYmPJywHbc7T+gkdKHAItSLncmevU/xg8vBBRHveLpwfQRgIGlIwLQchowf5+8r9XBWiOhdkMn1sLSxc1CeYJqDF/M3hu9Qqy19bbTV5lcDarxGG1vu+Y6V5PW4C5128Lf2m+H6s42Txn9XJQ7BLxDKV4l7XbyVtcGzHTXukySIWjHlU5/r4oZUOuw== 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=dmn5y9sJGI4V5IdSH3mR/GkeQTbPcQThFcwGQDjqfvo=; b=QzODufmTl0m8TTvecBwvBYgNAGVNf11eHurfu7h3miscdfcxpGOXdjYA+F+R0tkpKqgrmH4kO7OB0bp+LtLo1Mrve0tIQSc91LHz5WckC3n0Sk9M9wdYdGqP0WNJzc82DihuxtqYqSFpOr8tdXwKAZFUa3FSEzAAIFYUmhlpTGE= 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 OSZPR01MB8765.jpnprd01.prod.outlook.com (2603:1096:604:15e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.22; Wed, 9 Oct 2024 01:45:13 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%4]) with mapi id 15.20.8026.020; Wed, 9 Oct 2024 01:45:13 +0000 Message-ID: <87r08qrqvr.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v7 4/9] ASoC: test-component: use new of_graph functions User-Agent: Wanderlust/2.15.9 Emacs/29.3 Mule/6.0 To: Daniel Vetter , David Airlie , Helge Deller , Jaroslav Kysela , Laurent Pinchart , Liam Girdwood , Maarten Lankhorst , Mark Brown , Mauro Carvalho Chehab , Maxime Ripard , Michal Simek , Rob Herring , Saravana Kannan , Takashi Iwai , Thomas Zimmermann , Tomi Valkeinen , devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-fbdev@vger.kernel.org, linux-media@vger.kernel.org, linux-omap@vger.kernel.org, linux-sound@vger.kernel.org, Sakari Ailus In-Reply-To: <87wmiirqwy.wl-kuninori.morimoto.gx@renesas.com> References: <87wmiirqwy.wl-kuninori.morimoto.gx@renesas.com> Date: Wed, 9 Oct 2024 01:45:13 +0000 X-ClientProxiedBy: TY2PR0101CA0022.apcprd01.prod.exchangelabs.com (2603:1096:404:92::34) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OSZPR01MB8765:EE_ X-MS-Office365-Filtering-Correlation-Id: bdfca982-2b6c-41db-5a82-08dce80404a0 X-LD-Processed: 53d82571-da19-47e4-9cb4-625a166a4a2a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|7416014|1800799024|52116014|376014|38350700014|921020; X-Microsoft-Antispam-Message-Info: PyFcZ2++Otan0D1exyK+9tBik3A2mS3PIaKCEeOTyUCd2xkNU7uQkbhlnFtGos/l6jewqCZi8pD1ysPSD2/lL5/aTVRWEbAXwu4jQQ1/yoPzwUgBwINibetICuvOuxLWrrbB0kVMzTneN9jP93DLPVvD1Ky1NfVPDukmE7JfWb1rJwYX6L/3KEqMlglfccMfApxozRpI5qg6eDCDkHaD50azZn1VnLtI/T9t7jLwlM1zXptNo7azSrZmV8+zhOTrluDfwN9huSYGWZrAd3g+JX7F/fobYPRJHa+n29V+NMMksivMY5vL0gpz8ZRn5LbFXJSRhl01uGtunKF6EwBSZ4wHAgJRdyW/7iJOzGIZ90JKbAKANPybHTkL/ciGE4N1sBYBcEBW5a1V4w3FgWyzOSqReMijTpVUWl9DYi5f1e9WHPt42Ipbrl7hZ5zpf3k9Fvm3/AyAnvorZ4MEvcBMDXMkwwQaurJDb9nuKz9qkRROl/2h64I8DTeONQ9bJkfjlcQDHchYYNmuyeal464eclheu4RYJVtvlUVgo+BFOBIAMHHcQ5+yrRNavbIGagqGNLEpqQd0dRq6rHe7aJgrFjG18ZiBlBuChNklHYRc8+c+TO/ZCbp0AlamYLeEAmbP6IvxKzUGT4O956tmynOZ7tw0NrR4AAU8vYo2DxoFypXTvAXL+np/JyiVBu368KYc+Hjih9m8NO7k7111psUKH2vOfyVhpMjaD+qR1C6fiwXTO4Pi8q6QLN8L2g+MSstF5rIJD3GVq/v9hdJkx4idv2ENaGUxtyzUGmOUzlaHdRKBTVLfOPbScTh1vyFiX/k7dRpLEY+8SBtR/w1sHmQoHxNc23/aDtCWeip2zV+jE7ccmvwOZce7bcUfKcDaCwu2PxfmYc8cHNjgU7mnNYREGCJE301yGl2Me8NriL6neFkRCMPDeB1+ZRaZYq2IHrGdg9jrjUpvud4TI4TDxSWiZL1ymw4N4WEcTaurFzExMIADCB/smjStCyHNugPWesPNX+g/Nsl0r2g0sL/ONuAjIjzpa/4px4x9I1+nmxbhQfokmY6c9nGYwcdAMoL4kuLqnqHwvbCNEBdIu2hCt7bo/2toZ0MJxZButGVVR5gr2mMaDHR3d34k2tHN0kmcrCHe/Aqr4J6xkoJK4SxteuLblfxs+P+Fkfgr3IEb4HtMnflc07oFb0zRd6bgNAhejkIPmiYpRqI1pypEi1OTwmIZp3Jq5VJTwLtEdXtlocwTFM/RaL362NplWvUlHUxwxECK5JdAX+bjplmuuosecL4S2f0U2L3iOiN8+YneZ29/Z+bbOaqfnS8VOFZ3tG1IOd1Cq8a+NDKf4Di60pbVaUc66A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TYCPR01MB10914.jpnprd01.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(7416014)(1800799024)(52116014)(376014)(38350700014)(921020); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ORXWYV92fJqbBGf15HXsbh2eAGho36WaZkUlx6e73XezIsNIUoxTJqJ63u5belN3a2YOVRQ2DcKeSpSakbr08uAbHFEiG6GJ0Ib5VMiOMreTJ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ekee1XdcQP5wThohF7JyY9RHhsshctIC7CmhOMe1pAI3YHYOW/gxl0WPeTI74F7cWJ6eMj2DmLmLNRGt+V0n2Y9sx1spAnaqQRzsQd52tRvpOCqHcMIv/5Mhfcmc3BdpX3cCrx+o9qUHMlHJ9AqgQ0BD3pAYpbKg8ZiMuQZi/u4qCVeBJwPuuPzGNIdDpmzz9C8pmOZGrqMGjqjTv5daO+JGkQrj63qpFlsKCJcG1j2w8VY0rDyOLXmo7pjqiF3T82SgxHc2rxkmDe4exoI8riqjhDzw0XDfbbcL+um5k8ahdg9XSL5cuYpHhDVaGoGzrJ+/5w12DzTNshwfiYUt6Wz9c+lXMHQaTiow7frmRtN4KqPE/UFzNvFsymaAotsjqF2/7ecfpdztGPc1a/4Hr5it3ha8E3lbnnutbacQdWs5rnmPkoB4JGM831JmkCjChqiQgXK+5ms91PgX99JY= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: bdfca982-2b6c-41db-5a82-08dce80404a0 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Oct 2024 01:45:13.5761 (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: WYdDqbeefUxVj9W7YVuSXaIcUbVH7e2O9sittXS+85Sto9tSN9aYvIE08r/F1s9+URU5JJ248ISn6XfLlmRvNKv0nYr0/P7dsCnZFoiGg88o0g7dhc5qaj2I11DcwmAu X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSZPR01MB8765 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 407288055741..85ce3ebeec05 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 Oct 9 01:45:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13827404 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 62DEECF042D for ; Wed, 9 Oct 2024 01:45:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D769910E628; Wed, 9 Oct 2024 01:45:22 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="gyZRSx/V"; dkim-atps=neutral Received: from OS0P286CU010.outbound.protection.outlook.com (mail-japanwestazon11011067.outbound.protection.outlook.com [40.107.74.67]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7223610E628 for ; Wed, 9 Oct 2024 01:45:21 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BKIN1x8OysUQ+q3k+AXWnGQGqXzlB0CMGR8gO/j7jcX263PZwOr7O9oYDPgi8B0NYHtwAIQtrPhqtgoB8PNTVSz+lZNDowiUL9LCFYW15SJwJqB4VwOjOgVedopVQ8sPVtyeRvuvhoNLsLWHAysbvJQ+07QxpijXedpGnDOf0fyiH2r3U+PfbOnPApeh+3mt/aLgHIe8HRplwyNE6h7pj0kWnc3sLQJNzRzOeWK6myMrQRs2vf4/mjhjWInQcmGFS0XwkfmdLmoSwH4GzhhE+1Riji4w7puCGoIN2mnvCKJ1TKhgOJISQ40xJZroYxBitgGiXtoQ6HmQIuiZaq0nBA== 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=FrlHo+pXgScml1gY+f5UpIPiHilFUDJNwvULtMoUnYc=; b=q48JLJzqwcFfUssTI5w/sT3xn1E6SDXM9MhmYhEEjg1mdGlKJG/HQKP7i2NGGFq4Cy0Me1AfIs7Ep4pDRFHoOCfVnZQayAmQncSOCyZUK5PpmE+W9agwcemkOrUW47kKxb4LiuqfD0wCs4eRGQo2/VHhBqCLY9GglOa0L0TcmHBO89vOu2pIB76GfI3gzKqrLjCK4HtzHTG5vCV02xQMFKOUyn5CDvjUzDyFB5p9rK8uu17fJh/B87b+LzLz0D10Hdmp5nJfzuPG63gFw9EYxPpceiPEJQcK0FX9BIQlABJ2AoDgmgETOfMjUSy8EUrETxbmxlX/3bitATj/uU694Q== 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=FrlHo+pXgScml1gY+f5UpIPiHilFUDJNwvULtMoUnYc=; b=gyZRSx/VR53Qe77EOjZZk4N+7bb+Cj+Dcqit91+3jhkQltwicaFyJkZ09Xn29agIB2HSE06re5ImKrUvggc9b172WiQc9ePigsZoHr/yow/LeROE1/8oxX1dLS1hGlHHVWg9855kGryaztYvhH8chRau8LLt+hU3VVbHDbi6GY0= 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 OSZPR01MB8765.jpnprd01.prod.outlook.com (2603:1096:604:15e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.22; Wed, 9 Oct 2024 01:45:18 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%4]) with mapi id 15.20.8026.020; Wed, 9 Oct 2024 01:45:18 +0000 Message-ID: <87ploarqvm.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v7 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: <87wmiirqwy.wl-kuninori.morimoto.gx@renesas.com> References: <87wmiirqwy.wl-kuninori.morimoto.gx@renesas.com> Date: Wed, 9 Oct 2024 01:45:18 +0000 X-ClientProxiedBy: TYCP301CA0017.JPNP301.PROD.OUTLOOK.COM (2603:1096:400:381::8) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OSZPR01MB8765:EE_ X-MS-Office365-Filtering-Correlation-Id: ac26946a-b06c-42e1-682b-08dce804077e X-LD-Processed: 53d82571-da19-47e4-9cb4-625a166a4a2a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|7416014|1800799024|52116014|376014|38350700014|921020; X-Microsoft-Antispam-Message-Info: d21757KqftFdzYyA9aqKijFr4zihwFHz8Hq8vBnIc17VMrh7G1ZWUYYrIQlnZ/qT5x1cdyUKW4Bs0E/qGEirOtmugK+eGRH1y2CKTbz2kGegXVFcnK9elCPGHI0iTVOuFvNzJwAirUelTzTPlDkwfh4tJgd71SCd1MGu0oZMi2BwOBJIqXEtr5nuUj2FiMYe8k0Ol/MOuQhULv2EfhyisCehR4FiWQmpDm0FTg7jrD5vdGnYPsGP7MWRUsa36iY81bm8b4gEiVGPIMfuADA1wyVBIZm1QJg/Svh0E4AmNCQLr4XfjmcmQsJbx51GCSNVOBgVQHXXfGB6uQ2CAdxFJd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; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TYCPR01MB10914.jpnprd01.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(7416014)(1800799024)(52116014)(376014)(38350700014)(921020); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: AdoGEEN0CcQ2PQhRmajscPYUOn0oqkBp7dsw7ajmRZyoYugj1JU31BWlLTQ+SSt44WW/iGQQj7HPaWOQaL+IZlv/9gZCKwZW26REfTNoQZ4rmyPsWvVOKUH88OmHQ3Sym74BtJgl9WeSP3rQswuzv6Zbo/H0WURpQl3RLu5Kc6DqpinO1qR3nwXtDQDhX5SDTthu+Ww5j1hnXeWcaJVzt1OC+J3ODCW8tmZm6lvC/sJc16Wv9Sz3rQIY7FzXYFJdECzZLMEiQoOC/cj7VS5CLNOADr1mM7qFesQJ1QVnP2fPiUyjUeZ0mL70xeCeSsnapO/R8+9ZL5pHwYmNPbXe6KNR+VHG/lmS1AHr0rBnt7BoBEuN11hvWgAKRRbW9YuL6KfO5dRm43GZTxQe+fXCxzK1yizphuJh5FeHP8LTg0w7Q3LOgVCcL8Pz6lDW2sJio8FgCZ5eODogbIgl/YvP9mtY3W/Ddbmuf44B/Fcb0P58VlYjOPXyyIG3nJa/KhdK9UOKR/xL9ce5JAnBJAmphiD7YckPa3g46nVOwhcqoqa0a0lqVkDMcs9ixHS/fVKX33eGNgmZ5Y6QLcMd1OoA2xwPgy+JrhOX/gZMB17fAIIDD6ObtPpYbXfpPQ/ve8J/9H5Cb9+2L0074d+4wSloHRM4/3qYgD8oDJ9aojk1GIj8CfS8OmH0oSa+vueSrSp0ej1Acgze9r/j/GwzHQ2eiLMgO0qIq16qRjFNP3B6M6gMb+QeIxOMyMbmDew/99xnk8z0eWDNiLFcWOkHyFgykJdcu2CH7fvPPgGYBblYf0ee8OAl0+O4oIzi6ZGvSv53ZT3pJ7L0V/hWJchOwYA27fCuxgTnR8Ddh5Q2X0F6qMAHQ8a2DLKBNDEEiBQz5pi8U6G0oSxtS5cGvqh44GrNZhh5Z3HtDvTh8ze8t5YX1sS3sw2lbPXKALtq0Xc+KQJ+KVlv4BQB47kJZuniRyNKvbparV0sN8FHqAEQnN0SgPZmmrDVmXUjhRamQ2wwu3s2kE7zPL2Dzr9k+rCbsN7XDebCp9of9g5GTh1KPlRZimnAJL0AYWh5P6L1dS4SoG5Dv3oedv2f21+sF7yXeLm/LMX/GaGfhhLoBAI4hktwA11MOTadV+Ki3skrIVwQgXWbhLgPo4laXmKw1nw3SsPYQyszyfzU/eX9ZnU5N0d5Q2OogFtZwVAjJsAhNLxkyFh58L8jUuDnoIbqS3zZcIHp52fuSrakQVvaUkIVc77Aodt8snBVpdezpTBboYyBXmFzEplVcudL0meA2nh3VeFtzzuYCkxQGbHuJVm3snzzkTBFGSY8fXPxJHgUXbPgzzpOehgyPHu0riVSfKDszjTEcWwv5cFQI9Qu3aDWoHjETgCQTiphMkmayZG5ed5Mg94IWFEqdqAdDaHRjT0sMudkXNsyxOeeqgK0KAYjTsnrm3EmU/fKSQtwI+h/qh0/ENY1+3HZcuLDL7AephJeXzLiMPJDVCEAJyLLutQIYwnPw7iqo7ygUyvJGb8DakmQxf0EkDu9K3hdSUzgRHTC9gOie+iZ077V6NYNR/JQPgqJZm5RicfpNgRkdZku692ivCSkD2UhB6ztkYVKBz82dDQKpwrsNKjUrG+MHavhORKtoWY= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: ac26946a-b06c-42e1-682b-08dce804077e X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Oct 2024 01:45:18.3893 (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: x0hUgRB8pXLcEp6XeoN0CHaxBWpDYJcptnH65sJFmWqDZDCumNXs1evcGCxbd8McJVZ5IE9XTN48KlesoxMX2D+UjOza+XcejfNKfdGWm9eO6npbNPX3/MHygdWGJ5pC X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSZPR01MB8765 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Now we can use new port related functions for port parsing. Use it. Signed-off-by: Kuninori Morimoto Acked-by: Mark Brown --- sound/soc/generic/audio-graph-card.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c index 4b384475b972..7655425a3deb 100644 --- a/sound/soc/generic/audio-graph-card.c +++ b/sound/soc/generic/audio-graph-card.c @@ -372,7 +372,7 @@ static int __graph_for_each_link(struct simple_util_priv *priv, cpu_port = it.node; /* loop for all CPU endpoint */ - for_each_child_of_node_scoped(cpu_port, cpu_ep) { + for_each_of_graph_port_endpoint(cpu_port, cpu_ep) { /* get codec */ codec_ep = of_graph_get_remote_endpoint(cpu_ep); codec_port = ep_to_port(codec_ep); From patchwork Wed Oct 9 01:45:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13827406 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 4F922CF042B for ; Wed, 9 Oct 2024 01:45:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C696210E62C; Wed, 9 Oct 2024 01:45:26 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="MEIKUg4/"; dkim-atps=neutral Received: from TY3P286CU002.outbound.protection.outlook.com (mail-japaneastazon11010049.outbound.protection.outlook.com [52.101.229.49]) by gabe.freedesktop.org (Postfix) with ESMTPS id DD2B910E62C for ; Wed, 9 Oct 2024 01:45:25 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=G528DAy89jWuHrrAvinlE9r/9E6bbwKW7KtJYEenxCRTsNxMBkbZOyv8Zq+HyslIwtPVsPi3cZq9d+4XB+LNSgUSu4LqeVm5yrQqqNUw9UVVDnSz95Oi+Teaf5YtYo2Pg142f5nxWM79SDlZP4GNwlShh3k84K5tbSVnyNhDhvFq4igDj2vEmr7iLTNC46snVjCYst1CBlhdlL/7DIm/pawfpBzKHefJlC4AkgJQwdn7vIuvT0JMD8VTiCq9t0ur72/xF1tqRxuQ73uTsJtzL9Zs3ioL3gpHM/tfgxgIKgtiVNGalF+3dcPDFKgGG0SyJoP2jIdIx5CDJ4Ay3vTSHA== 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=GbRbwom/HMdXU1UXcO/UYglLI/31EpApEkTdO2F4YXA=; b=Y/R0SFFWx3KzJqR7Nqwg6vjgu5+lX269AYT+VtHFWXzfWEPWgp2PRoFew28ryCSFk2LaFQTEvfP0xtb00gS1OdV7gtXnBypKtZb1+yueUS1KlQ6qEYuzLI0bbMgz/qsDACGIyDvNqe+iFtBvSA/+p8d2XbBVYwtquHw57ERGea1shtKBNa0AWmZXvJHEINMC7pagU4uTzdCphJ7c2c8zkkqlmA4RQPaUt3rILbzqCNrfIXuJ4650Var5uQwCfhuE6eoZBAHBfCWfT/ld+IHpZFDIHU3VXyFpopEAVuVTOi9hfyjgNUs9f4rII6lC2kc7Eh5zBWAY4vs/C3qx3vxOMQ== 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=GbRbwom/HMdXU1UXcO/UYglLI/31EpApEkTdO2F4YXA=; b=MEIKUg4/wpLFj+3zWfGKiipqy4mvguCwViN1CqHrW12ioTISZ0Yo+wfYkNrGKva+Lf0nPU5OEBTC1sdovQbXbmFmvIj3onLeWxl//Ll5Lju6e3Aj6yu6S87AvGgk8litY4TIKu2e2roXOhH/zd8ME6xhXVlW8hbWZn61qexVnQo= 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 OSZPR01MB8765.jpnprd01.prod.outlook.com (2603:1096:604:15e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.22; Wed, 9 Oct 2024 01:45:23 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%4]) with mapi id 15.20.8026.020; Wed, 9 Oct 2024 01:45:23 +0000 Message-ID: <87o73urqvh.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v7 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: <87wmiirqwy.wl-kuninori.morimoto.gx@renesas.com> References: <87wmiirqwy.wl-kuninori.morimoto.gx@renesas.com> Date: Wed, 9 Oct 2024 01:45:23 +0000 X-ClientProxiedBy: TYCP301CA0018.JPNP301.PROD.OUTLOOK.COM (2603:1096:400:381::19) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OSZPR01MB8765:EE_ X-MS-Office365-Filtering-Correlation-Id: 3b6c2a58-aa64-430b-1fec-08dce8040a82 X-LD-Processed: 53d82571-da19-47e4-9cb4-625a166a4a2a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|7416014|1800799024|52116014|376014|38350700014|921020; X-Microsoft-Antispam-Message-Info: rLPknhRBkf1jsaosoMM2f95g0U3eAKKcIsn8SRQ5XlvjR/fZJEHFFAw0HW1/Ka+t+XGUy1tbVHWlfE6XGuhGBCxQ+GD9+SltvVkUVJGWN/Gi0rh/M9E5B2/swVSMDAX7biNsCI3NlXTyMLjKCmVtW6A1udKMzucGt+glaeEh0Ks+/9J4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rQXWS8NvON79D5Ffj2JeEyYHBlWogsZnJ0ke9N8Z5r8pONATi5kvgpUkkT/UAgWXt1Uw8b+nxXbWTa/XdxoYy+t/jllW0JsksolO0IEA+YzQV2SghZG4pNY/XoDsQVwaGdyR5PzN7ZgYKAg= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TYCPR01MB10914.jpnprd01.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(7416014)(1800799024)(52116014)(376014)(38350700014)(921020); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +No7Tu7qgoKR3pwRKF7xgzum/u3CBpDITRN0aQPfM2VxWm7PI/zuC98mlGajm9OX9/yTHONzJ7lOldtFOvZ8sYsMRHAsN6glMu2MQ1E4vAeWYAd89kcJgi5t/vdTstG+n5XOFD4xNiLuEPn6MVVYLKwCXHLC4XaEVwKeKXT9/ylmXGD76LgN0aDcrMx1R/Kzu+pTotEef3Eap0o2MBeB2sye/KkgRg/kY9CFGbCwNEsCdFd5gaMoSof/l0Ot1bmbP+6Qk7gZboYM3tt+sm95DFF3daM1fN7Z0gB3axqaNMnRuSxXGLe6cDd8CI9GIqy6Yy6TCThFjIWNCKh2jK2OtwKcc54JbnYiqlQdqaRHC8f7fFvN/PpbT/jSH9hrn0Uw4lV64hCjoCMmKapyNRgS6vT2auRHYcuTR2nwJvDjrysgVDIyoEVi9SpqMNRnc1elVT/soY2DXpf+Ft1jg9MEbfo4c/Dip5gRxhp1JWdX1n9/KHpAum/hGSYm61IhrU1lSpr2PVXc1d0AcxgpWjp8rVPlca0+BGiqBb/R5eqhTqT4dVbKz6dG9LMj1XocIDpGGimDMwUwtmw2ZHyBVtoBadOqICy+bFp/Fj04806KaYCTzf4i+rMBsnlz+Raq3KMseoKn9M+sfBzv2F6tnj/0k54S8Xoljj76YT/Nmeo2qoZJnybwPzJdvgJKErDCMH5sdwBJiJ4X0mDR2Q9dfWcm1af15JgB4DIW3B/X6JOr2PWSHec3WGURr+ogTFm58kRJgXxUhpdUtb0S/GvcrebSFeG72GvYIvJsAOKvVK7AaX/jegYvOo1LEYeI8tcu9eFmcMqbilyiBrHtIomgagxDPIIxgnFdugeIFUlyqyS4MQicOJILLA1WudVhn8OsWcSd0gPnwu18lpv0Pzn+5kjbFFEyOebdOdPUbNGr3jYNVoEdswg5kPgRlZdHirKM7NBAjDLrsb6rhunOsWpUAOXMuGFxsnE9TWfTR5OyzGJuoHpnXl6g1M+ofg2Q2uBt6R/aQMbDb/9KT5KO155hzOQy8mPBlP4V7CV0+hC/CiAxuANDi+XdpRH7Ow6mZfMnYMfPwTqHe3ZH5edaOM6GPTqj692oMwkK1jxtpTfh2uvYtZNxFK/+9u0OTx6/u2xVggNtmQvfWBsYbKAiJxWPEvyNMnVxbhIYIcB//YN1qiOuNBQiZjhiL+LdL3mL8dCEY0mU7e2FXt5E9oLROQVhbNIv2Jo7TTzjhey8VyDHl1ZPR55J99ZynB1mxXQW2uxXFk+bqhVvIi0V4BpTZc2IXYu6L17Lu4DXC3F2nbHa4U6NFWJJ4CLSjGf0iKg5OtH+ZiKWX1BX75bEWe54cGURK2nT+9dHJmN7XyO7GJQq2ozpqanzCwCkBE4U9V9nArfJP09BI1+Tpam7gmA0fJMoHiWj9lEJIq+iwWE35F7zSd6uocN3M2z5hzqJA6/5C83skcby8gXxk3zYicMfqgXHJYHl82NtUhMhdN4ZEztfs0YVM8fIbko0bHIlmkrvpiXL8jDogypn4Hlc31ZluJDMu697k+d+ST2n1+P1JtY5C6vQRUHP3WFAdgjBiTIXbaUujkFYNSOSEE8tndSSjnuNw87FoUgFWbFYii9+3962reDhRyg= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3b6c2a58-aa64-430b-1fec-08dce8040a82 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Oct 2024 01:45:23.4621 (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: qLBvKi7aRgw03w3ouQYNKeoiTL297j3fM7CLv5wWa4JY7FzPgrPuTlk8jxFdSBU+wCBYHikICN/wCaQoOXh02UJu1pjWK/23X6BHVf8UujP/FtUTqc4DqvloVqgW8+eY X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSZPR01MB8765 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Now we can use new port related functions for port parsing. Use it. Signed-off-by: Kuninori Morimoto Acked-by: Mark Brown --- sound/soc/generic/audio-graph-card2.c | 104 ++++++++++++-------------- 1 file changed, 48 insertions(+), 56 deletions(-) diff --git a/sound/soc/generic/audio-graph-card2.c b/sound/soc/generic/audio-graph-card2.c index 4ad3d1b0714f..3605a6b2c782 100644 --- a/sound/soc/generic/audio-graph-card2.c +++ b/sound/soc/generic/audio-graph-card2.c @@ -234,8 +234,6 @@ enum graph_type { #define GRAPH_NODENAME_DPCM "dpcm" #define GRAPH_NODENAME_C2C "codec2codec" -#define port_to_endpoint(port) of_get_child_by_name(port, "endpoint") - #define ep_to_port(ep) of_get_parent(ep) static struct device_node *port_to_ports(struct device_node *port) { @@ -351,14 +349,9 @@ static struct device_node *graph_get_next_multi_ep(struct device_node **port) * port@1 { rep1 }; * }; */ - do { - *port = of_get_next_child(ports, *port); - if (!*port) - break; - } while (!of_node_name_eq(*port, "port")); - + *port = of_graph_get_next_port(ports, *port); if (*port) { - ep = port_to_endpoint(*port); + ep = of_graph_get_next_port_endpoint(*port, NULL); rep = of_graph_get_remote_endpoint(ep); } @@ -530,67 +523,66 @@ static int graph_parse_node_multi_nm(struct snd_soc_dai_link *dai_link, * }; * }; */ - struct device_node *mcpu_ep = port_to_endpoint(mcpu_port); - struct device_node *mcpu_ep_n = mcpu_ep; - struct device_node *mcpu_port_top = of_get_next_child(port_to_ports(mcpu_port), NULL); - struct device_node *mcpu_ep_top = port_to_endpoint(mcpu_port_top); + struct device_node *mcpu_ep = of_graph_get_next_port_endpoint(mcpu_port, NULL); + struct device_node *mcpu_ports = port_to_ports(mcpu_port); + struct device_node *mcpu_port_top = of_graph_get_next_port(mcpu_ports, NULL); + struct device_node *mcpu_ep_top = of_graph_get_next_port_endpoint(mcpu_port_top, NULL); struct device_node *mcodec_ep_top = of_graph_get_remote_endpoint(mcpu_ep_top); struct device_node *mcodec_port_top = ep_to_port(mcodec_ep_top); struct device_node *mcodec_ports = port_to_ports(mcodec_port_top); int nm_max = max(dai_link->num_cpus, dai_link->num_codecs); - int ret = -EINVAL; + int ret = 0; - if (cpu_idx > dai_link->num_cpus) + if (cpu_idx > dai_link->num_cpus) { + ret = -EINVAL; goto mcpu_err; + } - while (1) { + for_each_of_graph_port_endpoint(mcpu_port, mcpu_ep_n) { struct device_node *mcodec_ep_n; - struct device_node *mcodec_port_i; struct device_node *mcodec_port; int codec_idx; + /* ignore 1st ep which is for element */ + if (mcpu_ep_n == mcpu_ep) + continue; + if (*nm_idx > nm_max) break; - mcpu_ep_n = of_get_next_child(mcpu_port, mcpu_ep_n); - if (!mcpu_ep_n) { - ret = 0; - break; - } - mcodec_ep_n = of_graph_get_remote_endpoint(mcpu_ep_n); mcodec_port = ep_to_port(mcodec_ep_n); - if (mcodec_ports != port_to_ports(mcodec_port)) + if (mcodec_ports != port_to_ports(mcodec_port)) { + ret = -EINVAL; goto mcpu_err; + } codec_idx = 0; - mcodec_port_i = of_get_next_child(mcodec_ports, NULL); - while (1) { - if (codec_idx > dai_link->num_codecs) - goto mcodec_err; - - mcodec_port_i = of_get_next_child(mcodec_ports, mcodec_port_i); + ret = -EINVAL; + for_each_of_graph_port(mcodec_ports, mcodec_port_i) { - if (!mcodec_port_i) - goto mcodec_err; + /* ignore 1st port which is for pair connection */ + if (mcodec_port_top == mcodec_port_i) + continue; - if (mcodec_port_i == mcodec_port) + if (codec_idx > dai_link->num_codecs) break; + if (mcodec_port_i == mcodec_port) { + dai_link->ch_maps[*nm_idx].cpu = cpu_idx; + dai_link->ch_maps[*nm_idx].codec = codec_idx; + + (*nm_idx)++; + ret = 0; + break; + } codec_idx++; } - - dai_link->ch_maps[*nm_idx].cpu = cpu_idx; - dai_link->ch_maps[*nm_idx].codec = codec_idx; - - (*nm_idx)++; - - of_node_put(mcodec_port_i); -mcodec_err: of_node_put(mcodec_port); - of_node_put(mcpu_ep_n); of_node_put(mcodec_ep_n); + if (ret < 0) + break; } mcpu_err: of_node_put(mcpu_ep); @@ -674,7 +666,7 @@ static int graph_parse_node_single(struct simple_util_priv *priv, struct device_node *port, struct link_info *li, int is_cpu) { - struct device_node *ep = port_to_endpoint(port); + struct device_node *ep = of_graph_get_next_port_endpoint(port, NULL); int ret = __graph_parse_node(priv, gtype, ep, li, is_cpu, 0); of_node_put(ep); @@ -769,7 +761,7 @@ static void graph_link_init(struct simple_util_priv *priv, of_node_put(port_cpu); port_cpu = ep_to_port(ep_cpu); } else { - ep_cpu = port_to_endpoint(port_cpu); + ep_cpu = of_graph_get_next_port_endpoint(port_cpu, NULL); } ports_cpu = port_to_ports(port_cpu); @@ -779,7 +771,7 @@ static void graph_link_init(struct simple_util_priv *priv, of_node_put(port_cpu); port_codec = ep_to_port(ep_codec); } else { - ep_codec = port_to_endpoint(port_codec); + ep_codec = of_graph_get_next_port_endpoint(port_codec, NULL); } ports_codec = port_to_ports(port_codec); @@ -850,7 +842,7 @@ int audio_graph2_link_normal(struct simple_util_priv *priv, struct link_info *li) { struct device_node *cpu_port = lnk; - struct device_node *cpu_ep = port_to_endpoint(cpu_port); + struct device_node *cpu_ep = of_graph_get_next_port_endpoint(cpu_port, NULL); struct device_node *codec_port = of_graph_get_remote_port(cpu_ep); int ret; @@ -883,7 +875,7 @@ int audio_graph2_link_dpcm(struct simple_util_priv *priv, struct device_node *lnk, struct link_info *li) { - struct device_node *ep = port_to_endpoint(lnk); + struct device_node *ep = of_graph_get_next_port_endpoint(lnk, NULL); struct device_node *rep = of_graph_get_remote_endpoint(ep); struct device_node *cpu_port = NULL; struct device_node *codec_port = NULL; @@ -1007,7 +999,7 @@ int audio_graph2_link_c2c(struct simple_util_priv *priv, of_node_get(lnk); port0 = lnk; ports = port_to_ports(port0); - port1 = of_get_next_child(ports, lnk); + port1 = of_graph_get_next_port(ports, port0); /* * Card2 can use original Codec2Codec settings if DT has. @@ -1037,8 +1029,8 @@ int audio_graph2_link_c2c(struct simple_util_priv *priv, dai_link->num_c2c_params = 1; } - ep0 = port_to_endpoint(port0); - ep1 = port_to_endpoint(port1); + ep0 = of_graph_get_next_port_endpoint(port0, NULL); + ep1 = of_graph_get_next_port_endpoint(port1, NULL); codec0_port = of_graph_get_remote_port(ep0); codec1_port = of_graph_get_remote_port(ep1); @@ -1144,7 +1136,7 @@ static int graph_counter(struct device_node *lnk) * CPU/Codec = N:M case has many endpoints. * We can't use of_graph_get_endpoint_count() here */ - return of_get_child_count(ports) - 1; + return of_graph_get_port_count(ports) - 1; } /* * Single CPU / Codec @@ -1158,7 +1150,7 @@ static int graph_count_normal(struct simple_util_priv *priv, struct link_info *li) { struct device_node *cpu_port = lnk; - struct device_node *cpu_ep = port_to_endpoint(cpu_port); + struct device_node *cpu_ep = of_graph_get_next_port_endpoint(cpu_port, NULL); struct device_node *codec_port = of_graph_get_remote_port(cpu_ep); /* @@ -1186,7 +1178,7 @@ static int graph_count_dpcm(struct simple_util_priv *priv, struct device_node *lnk, struct link_info *li) { - struct device_node *ep = port_to_endpoint(lnk); + struct device_node *ep = of_graph_get_next_port_endpoint(lnk, NULL); struct device_node *rport = of_graph_get_remote_port(ep); /* @@ -1228,9 +1220,9 @@ static int graph_count_c2c(struct simple_util_priv *priv, { struct device_node *ports = port_to_ports(lnk); struct device_node *port0 = lnk; - struct device_node *port1 = of_get_next_child(ports, of_node_get(lnk)); - struct device_node *ep0 = port_to_endpoint(port0); - struct device_node *ep1 = port_to_endpoint(port1); + struct device_node *port1 = of_graph_get_next_port(ports, of_node_get(port0)); + struct device_node *ep0 = of_graph_get_next_port_endpoint(port0, NULL); + struct device_node *ep1 = of_graph_get_next_port_endpoint(port1, NULL); struct device_node *codec0 = of_graph_get_remote_port(ep0); struct device_node *codec1 = of_graph_get_remote_port(ep1); From patchwork Wed Oct 9 01:45:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13827407 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 DF9B7CF042B for ; Wed, 9 Oct 2024 01:45:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6530710E629; Wed, 9 Oct 2024 01:45:34 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="VupuG6YU"; dkim-atps=neutral Received: from TY3P286CU002.outbound.protection.outlook.com (mail-japaneastazon11010047.outbound.protection.outlook.com [52.101.229.47]) by gabe.freedesktop.org (Postfix) with ESMTPS id 43EC710E62F for ; Wed, 9 Oct 2024 01:45:33 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Nf3Zi6gBIOyAoOMDBqxVITaFBG/7PKS/i1xRsyQByll91g53PMpVISNKKAli40syjClzMWGJR9U/eX5E6We1YlZ7pFRD4D+IJquJXSf/GK553de4DsQZVFmnTeC7MeKsw9U6VDz/DHmMP0IUaxXbfia+I41HfK8/CNUFfk0mNF2hUtl3704hZTsnJGbdlzjy18mY6y5RCekKsCY7L4amNcpPLQMUIDaJ7MBUbO2ln5p9EkPBTWLYXejshJhhX/Bp0/Ng7n8E0qa7b7eEwwUcAqMttDvge3Ovr6hvmLOSIkvYI8ET+qMjWlEU9EIGwtHExA1KhSIaKhaTF8rI3V6/+A== 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=OJTI3fVU7PXFX1tjVUU8Ye9r4QnjQGrtjmmqI2Oz+XU=; b=lQdHoPFXZ6eNTEnhMh7DHRzUoZkuANdHnIV2mv9GmrWaFpmfHdIH3l+mLXlfit6cN31S90RPQFpf44XEG2MmfbVqb7W+oCB56R0LjqfHaNaIbTcJbnwZPalgTwxVgoTe+CvHMfu7ZJjbDE1wm99mIMXiuT4MyzOX9V0GHlQmLhHglRm10+HbxNMZHyF+68qn0n0gv/AMqmy0x6wSVO4XN5lOJmprefERvAq5arwMxFY4vG5mKTNqdUYG8UfxG+ya+ZOO+Xdx7HOPHurjnusY+qKWn+rT6T3fjeF8WX73ji26RN/bemGLLvxM+sdwct1lyxgyvDvxmKuGYcKzQv2cAA== 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=OJTI3fVU7PXFX1tjVUU8Ye9r4QnjQGrtjmmqI2Oz+XU=; b=VupuG6YUiYKU/vXypv8a4TgGGfSOpoemAPNj1TqBvlbknYvDX1peadoA8z2HHkhlK/Ql5eAGnTDkoadW2U7XfkHsb7/yDiakd2z+dn3MCTHEXnh40W7m35l9nOVMvSlN2jMvXkdS1jh0U9TDjKBOF4Sg0H4zO3jHiFrXjkc9hcg= 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 OSZPR01MB8765.jpnprd01.prod.outlook.com (2603:1096:604:15e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.22; Wed, 9 Oct 2024 01:45:28 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%4]) with mapi id 15.20.8026.020; Wed, 9 Oct 2024 01:45:28 +0000 Message-ID: <87msjerqvc.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v7 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: <87wmiirqwy.wl-kuninori.morimoto.gx@renesas.com> References: <87wmiirqwy.wl-kuninori.morimoto.gx@renesas.com> Date: Wed, 9 Oct 2024 01:45:27 +0000 X-ClientProxiedBy: TYCP286CA0099.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:2b4::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_|OSZPR01MB8765:EE_ X-MS-Office365-Filtering-Correlation-Id: a3f106ab-af44-49a8-af0b-08dce8040d4a X-LD-Processed: 53d82571-da19-47e4-9cb4-625a166a4a2a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|7416014|1800799024|52116014|376014|38350700014|921020; X-Microsoft-Antispam-Message-Info: DvyQpDL8h2yJ5v8bWtpAabZtiFOssUg123VkANMZl6GHyCwuHTN3cgmCo0RB91sNe5GsHV5KroC2pTHca4A4odHxZVa5YM9TznuWd3skHzKfdSyeTSBMdji8V9QpjwztC2qhEqEneD6WFqYd8SErvc3PSXvc0qGUd90/f4TB2UASpFGsiCu7TLKJmfz/vu6+W5pTXaBlC0BEQQmo7rygQZhnbTwUpszLkrzva0JM/SGXZakG59EnFL4z+4nTluPHD8QJPMercSi43P8Isc5mah0Rc8pLM8sNFAUbbUhVnwTZqQnKxMhqEtVn8nXo5wjTUkpYdg1x9AzoJx6nqpTvfZajIj0aXRDDc/eAdweKKSyIBBWCFD2r+8wDl3AZmEyLZRSv9G97an1KQ9QkYFo+rn6vhzFx2c5A0HVeowQOHF8jVY9DPVy2epjYHqJp/a2dPCyO55+vcisCqHcfmOzbp0e2NRL9YeQyB80vfPvpJlPJRv2dtF9xpJaotpmEAxLKRWBi3m+kVdZLRXvEsKwFdBhQ5wydXPmlPykK/QUXfhyQ8Cao34Kviwr0lsLxRyL+Tz9h72teXoxQRc2QBOKKivVZEXItTKGCjn+FUJ2bOpV4dgeW3kGVt+2xJtGlmbAmsH3zNzdN9KZfYRz5Owh9TTQ3jiIz3pjKUbKFWdD+XrSyGZJgbcrBtbJr93TTNe5Xc9T/MtuWywxKly8kE44O9W/BlA01l0ow73PmyoYkgEnaTcVzPld7B/4Vs4VjZlfMS7KG7MMExbql77IKR54TvVqdPqQrW90uJTDIxtTHGl4vVO6/OLYJcRQcZxkNo/3BgY3Xp+2kuuSYxfc37WyAi2fJVrtGYFj3h6nG7m+SEA43EIdhLjo1Wgy/BktmMf8mmHdiUshg+1MmEeLCRI8n4nvTMM5kAcF1IeoO/OkSDsC5CM4D9DbLQGmAddUklH56A605401WgxnwmmK61Ug5xdgATMAJZ0aC8zxx5mbscTKPTsi9NuqN8NGQCjc79pYjcckzJN7WsxYRU8NtVK8DUfkPaTHN/EiMZYilzk7919vXkJHiIP/+2+xTbPKtegsn9eRC+/ZfDTKJ4kv4StxkkNxKs5Hnq5l3/gtQ5dcyoSYsJ0EeQSE0PlFn456HNagk0oPT1Cq9R/5uNx9LBN8eCgS2FllbWtzUvdQoxW59ApF7IFUef9+hbfANxVNtD+4cjWwHa23dytKQQngOTbRYXMf8j1DJuO9m6tlSp/Xv/tnxebWTR10dbSme5wusOUvhdMNVrJg5EWf1GYP+hGh7P7T7VyZhcjfx75xhu5JLDAsHD+mD8BE5d9HYFWU9fPt49l2xB1PbmxLIfE9gZO3s7A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TYCPR01MB10914.jpnprd01.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(7416014)(1800799024)(52116014)(376014)(38350700014)(921020); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: m4kW0iXR59GUOoOQy9/upV87YwF0vZu8Xu+mArDHHTMLRxc30fEF8ztYle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8QI66SxGuoYYgbEc7/RF884+qu6Qs7lovBmN3dK7CdV8H/AlHXMKUmml5tpP8CkyWKTYDusECRe4SgbBn1ra8rjNPAGyIbzbCZ+4EoZUuYq5O+z6dLEt2mXTcTxcF1sxDvTnflDsbudB4kx0ZE8LBalCoBaDE42At5qBDUfsX2MGS6LFImp/hHOQGCnOVntUnGN1Q6JZMxiYlvqbw20DjYZ0OtJQv+xabrb+no0/L1b97ovBXMjS87mzh7Owk3SgxF8vONoMQpZp5aX9nuHfuoN+x10sDlin1DSIvDU0OZZylILX+6DQYi5hjxhUBZqQ06YzR0WWQXy9z69PO1JznQJcJXmhkZ5NL6MZ1hGwfjAJItv9MhVpJ0R8zX4XMyQ9naaLeULT89bIiE74DjgOseapjTIaJ28JDuqWnLI/zZTtj/sjW77gQDKx9lFpPYt4iSay1+NamakufZBNTpLv+XXqapYJzPNdT+vKHQDVGGPmI= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: a3f106ab-af44-49a8-af0b-08dce8040d4a X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Oct 2024 01:45:28.1370 (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: hy9SQO3T0+JX2uoiio0rs5dO2kBy6XjG4wQyzUKDWNO8hrD1XhSdw6VGy/pQAscv4Vi+Ng7smsr2LkvOBsgQATy/GqUGyKHywEFwRjsMEzBQrPnllQnjfYX3G6wHvKVf X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSZPR01MB8765 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Now we can use new port related functions for port parsing. Use it. Signed-off-by: Kuninori Morimoto Reviewed-by: Tomi Valkeinen Acked-by: Helge Deller --- drivers/gpu/drm/omapdrm/dss/dpi.c | 3 ++- drivers/gpu/drm/omapdrm/dss/sdi.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/dpi.c b/drivers/gpu/drm/omapdrm/dss/dpi.c index 030f997eccd0..b17e77f700dd 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 91eaae3b9481..f9ae358e8e52 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 Oct 9 01:45:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13827408 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 E3BADCF042E for ; Wed, 9 Oct 2024 01:45:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7098C10E62D; Wed, 9 Oct 2024 01:45:36 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=renesas.com header.i=@renesas.com header.b="LzVW7tCv"; dkim-atps=neutral Received: from TY3P286CU002.outbound.protection.outlook.com (mail-japaneastazon11010064.outbound.protection.outlook.com [52.101.229.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id 49B9710E62D for ; Wed, 9 Oct 2024 01:45:35 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DTLXkZdjdYvvEyt06KSvtTHAmXY/j6V2PAnAEfQyZKtalM3+/lznVMLP5sILtJUOGxCvRBkPQLCRAWN/xcIKioY7tNfP5ljEgq5LNVJFYiYKxQUdyB0B6M/wSithsXbsyfnkqm71dPWGy+B5tvK9pF4iL9x8yiOHZKW/nFoXPl6NP1XUdaRKslzgQal/E0gnuR0r1PaOoC0QVbJJ2/7RaqsF1LbfedoD3h5DA3K3CE/9URAXBRt3BcM1GP1hHDpzMJ57cOuysiUQNvyn8DRv7kK7dRsGA6V5EgRqPpaX7Z9UjCw9tg9FBiYkNUouwCaQ+y+KAMEvPoD+TZLnsCV7WQ== 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=CXWBJqDryy5jJ+dyPpSIAG7B59YzHlinFtD0x32QSEU=; b=A4SZkSmMFKp9jsiNmQW8MKcOGcUmTXOphrAIVhgWQAERQ8uOsNL7VJfFAK0AP44uEiqrGG2/Wy8ji9ALJlZ7MKdYTuEr6GekgIUcifXTubL6B+WiMyRAGdvCXFnqIE1r7hBrOrDwtdpAISyfCxsp7+IsYkXCE0/wGyB5PDSWTePhz973NudG8za9Z/wk72RSm6n2ZkIaLNKVjLp8Bk9gL4PAlXxnBmoNJcQxtksUsIeRNkBottyy66GVdaUYtdW1h8xOt7TS31JgF6aS6r9oQDtvxy5VvZb07iMPOyTsU1y77+GJxYUqyzAWkr54XU4cNhpTvcqMOWjWYK1/QSf0xg== 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=CXWBJqDryy5jJ+dyPpSIAG7B59YzHlinFtD0x32QSEU=; b=LzVW7tCv52gxebTGpQ6Whfyya8oQcDevccPWsJY/WCmH2JsLUPCqFqiboqZkiDGDBOm5lvAUVg58hg9Ppxo+8rzsphHOWGx/UovMcj1pxavxtYOughbCfmzULM/wrEfePGH0z4hhDxY/RpgqalWCvp1VpBqzmk8J+bO2jgOf7Sw= 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 OS3PR01MB8318.jpnprd01.prod.outlook.com (2603:1096:604:1a1::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.23; Wed, 9 Oct 2024 01:45:32 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%4]) with mapi id 15.20.8026.020; Wed, 9 Oct 2024 01:45:32 +0000 Message-ID: <87ldyyrqv7.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v7 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: <87wmiirqwy.wl-kuninori.morimoto.gx@renesas.com> References: <87wmiirqwy.wl-kuninori.morimoto.gx@renesas.com> Date: Wed, 9 Oct 2024 01:45:32 +0000 X-ClientProxiedBy: TYCP286CA0025.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:263::16) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OS3PR01MB8318:EE_ X-MS-Office365-Filtering-Correlation-Id: 86eafc32-62cd-4019-fb37-08dce8040ff3 X-LD-Processed: 53d82571-da19-47e4-9cb4-625a166a4a2a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|52116014|376014|7416014|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: dX6EDVRJsPTAb8hJmeiiAgOQY5iUI+AhzvpQBvn1y5ZdTvMVpklW7WkJ70XgB5CPegE+Oau/xz/RV5ElFQcoaRzmCBV4kTvKTE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rMEa3j3Y0HGdN+Rpmjvvj4CD2Ic2zR343U8YZLe0fpe/9S8dLGWS8uQkEhrozns5OfXmWg1HYml1es/KkvfI+vGeAaqHCyfCmcvueb5glJ+k1Q+N/DmlmnSRfacO3j8j7douzhO4REvzTA19gfvFRebjxaoIL43gUDC+FR0McQStKKrzu3tSenn09IOBd0KBataAw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TYCPR01MB10914.jpnprd01.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(52116014)(376014)(7416014)(366016)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 354X6dHTsppytV0Z3g9EzUigu+za+UU8Jry2sld+8CEzkg2I6oKN6rFIG+gPsC9hdqgpOUb49QlW1axIrDJiUebwuJqoeTicL6/lUrw9SmRTNjzS3CPotjED2h3Lw30bZOuBwVTvXyggkAODraU9eLYr9BtCTK7w0FRA+CkyZ3cAASmvRiEnWyj9obcVGzvvpF6NMZgapSxUzc2K3lxevMjfcmaFpzGg+L7RxuXOeEtOMXUSUX+aiG9rsxwFBCFkqMsGeGwdvJ1Fbj1EVhi+duBe2ccSIHi75IergE5QZbuf10opWiJAd7Wd6VF6+bQPZAtwdt4KS9lVj7wqaW+kuvnLyjHyDCeDF5OEguxaKWpI9PQ8LUO2NzdM0aOlv7c4xL7MCtaanXaa0F+AMvANFAZ++givIP5UNAfH/wmth2BUOGjeDSekdDmLVkAghppCW2xHU8PFhNPxY8XDGJTC6gQYAjz6Go/E1BGARxFAjUM5AZPu1twy6ZA2XXAQLXmLYPPDpEjjriR03nkaFqsJSmInyeZ5dNr49nlrlVuU8r6/hDXmHNie69VLkfhKNiWsgs28ld3fDF8ApSGxncTtF7yBqFvCGUnVVotL6dAOZv3bVfWC/UqA7SpxKSF3LA5Y7IErOOuSTMHTqwIkRoYTQbWJxpcdomMvMeRceKUS//5h5vIf+eaDAwAblSfYROZvVdkNTy/np7O6FOb+bLb+tF3vZXdaMtzcfzZeNDNLocfsTknqHWmXRB/pevVbo+dVkCNi+aXNi52vBBqqE0i7HnQFiyTVNd14spDa48urvi+44IMDbW6As1Jz1fO/OO1jN3M5hARG+KyheoFm6NKKMnXTleGaJIMVwXqVrlDVg2Ksi5qlV9En3+kF0dQ/7c7n317OMye0GuW6AxyMbmlHa55H8X79pSpOnZZeoTkIY+FdNpea3in6s6w2aO9YMFKFH/Pd22RASuw4zs7B8/xx1IWts4xy9fk92+5fSwWnXG3awwzNCDUxUxciSBMlB6l6fNC10UFJR3G0TEPYFM3rvVLpsNpbiw94zwBjdR9AG1R4DVKteYNeDI9dkWDF/QPudsSQAxbGnwf8Bz6z39n24UFdnEyh4XtCDW7/ruiW0WQfC2l9tIEZOjIpG3w/d6+MKs5zGivpoTY/fqBSLCcU+W3Jj7WH5IaMGiqT5bklFdcvMn84YsM0zNLHFLEvkEFVmqS0E5gflSt9qnwiPycLf8aaZCGwQfqndksQfTBKdtm/uOzmDqwdnTwsC892MLna3KODsvpZnOnhK39H0Z+UijPLzg29BrFXP13jTvWLCdFy5Mh2bFeXCuLiVT7h1FFA7TToLw1FMPyaH6Tp8Zi91IdYBWZ88ByK7h3JdsjuJkP+of/tjO1wbvqmsLLZvhwmhln8E4GGwBr0PBqe2chNpVUlQYd27AZJv+8uu3Wo4NTmCkCvx9Xt2ZG+OCMe7CRwOVWBhXHnHslOfiFwdYPqamofvPApATgyvF6kqdAoRdaPdB1hB+VzfmPuizbbO5LZeNtIlWjggorOPcCZKYkxviWwdnWsNMBz6bfSjQG4lAKgNBgO6SIRUa4SGtae7xatnxm+tyK4SmqVoiyi7GKq0Fz1lypk45AjQvr2YD/0TO0= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 86eafc32-62cd-4019-fb37-08dce8040ff3 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Oct 2024 01:45:32.5775 (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: ZZtLOi07fjPrpd0Bk/nbmOVx2ciuBpWTSd4qkf2pJUxAl6x+/dd0E4a83RN1zqaMvKIoXnzcXPb1Xl+ooBfJhkCkv9A0h2pImHlbJb7TAPQtokrJMDlRPtfCcDQieXAm X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS3PR01MB8318 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Now we can use new port related functions for port parsing. Use it. Signed-off-by: Kuninori Morimoto Acked-by: Helge Deller --- drivers/video/fbdev/omap2/omapfb/dss/dpi.c | 3 +- drivers/video/fbdev/omap2/omapfb/dss/dss-of.c | 66 ------------------- drivers/video/fbdev/omap2/omapfb/dss/dss.c | 20 +++--- drivers/video/fbdev/omap2/omapfb/dss/sdi.c | 3 +- include/video/omapfb_dss.h | 8 --- 5 files changed, 13 insertions(+), 87 deletions(-) diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dpi.c b/drivers/video/fbdev/omap2/omapfb/dss/dpi.c index 7c1b7d89389a..395b1139a5ae 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 d5a43b3bf45e..c04cbe0ef173 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 d814e4baa4b3..70bb35ef48b5 100644 --- a/drivers/video/fbdev/omap2/omapfb/dss/dss.c +++ b/drivers/video/fbdev/omap2/omapfb/dss/dss.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -919,10 +920,7 @@ static int dss_init_ports(struct platform_device *pdev) struct device_node *port; int r, ret = 0; - if (parent == NULL) - return 0; - - port = omapdss_of_get_next_port(parent, NULL); + port = of_graph_get_next_port(parent, NULL); if (!port) return 0; @@ -952,8 +950,9 @@ static int dss_init_ports(struct platform_device *pdev) default: break; } - } while (!ret && - (port = omapdss_of_get_next_port(parent, port)) != NULL); + + port = of_graph_get_next_port(parent, port); + } while (!ret && port); if (ret) dss_uninit_ports(pdev); @@ -966,10 +965,7 @@ static void dss_uninit_ports(struct platform_device *pdev) struct device_node *parent = pdev->dev.of_node; struct device_node *port; - if (parent == NULL) - return; - - port = omapdss_of_get_next_port(parent, NULL); + port = of_graph_get_next_port(parent, NULL); if (!port) return; @@ -1000,7 +996,9 @@ static void dss_uninit_ports(struct platform_device *pdev) default: break; } - } while ((port = omapdss_of_get_next_port(parent, port)) != NULL); + + port = of_graph_get_next_port(parent, port); + } while (port); } static int dss_video_pll_probe(struct platform_device *pdev) diff --git a/drivers/video/fbdev/omap2/omapfb/dss/sdi.c b/drivers/video/fbdev/omap2/omapfb/dss/sdi.c index d527931b2b16..22a6243d7abf 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