From patchwork Fri Aug 9 04:22: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: 818498 Received: from TYVP286CU001.outbound.protection.outlook.com (mail-japaneastazon11011056.outbound.protection.outlook.com [52.101.125.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF30D2208E; Fri, 9 Aug 2024 04:22:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.125.56 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723177354; cv=fail; b=SToosoPzliUqoNGoKr//1Sc73/d6fZb8qBUC+FCdgMOtVDJDBHxTC3FU3UiTcgqqiMeQtxt2xGwMV9BBJOHZ3z+l3ziylH9IlzKZBh0CdjSHTEST+o1+yk6eLT9428lUYphe7lHrPqM8H596ntnVNUgB7pdAzaJtmiCwmMPWfrY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723177354; c=relaxed/simple; bh=xyPaHuFRun3Xmf2wgoQ0eIf+MvotrG6RJJv/kFQczx0=; h=Message-ID:From:Subject:To:In-Reply-To:References:Content-Type: Date:MIME-Version; b=rQIGJhNa9NRvI+TTFa5l8TJsjZzcH36P51Tc+cF4eN2OMuByO2rvlIXuy3ZUp51DfFFTqTxYfI4b4E4ySEXTAATh+G0WxEyonUMozcCwEJtEFBk8RAs7tX8BADen0mSOgM+8j37qcOB/Dybi3EAUzyaC1+fpbslhIVvnNNT84SQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com; spf=pass smtp.mailfrom=renesas.com; dkim=pass (1024-bit key) header.d=renesas.com header.i=@renesas.com header.b=Vde10mO9; arc=fail smtp.client-ip=52.101.125.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=renesas.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=renesas.com header.i=@renesas.com header.b="Vde10mO9" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cDEsoSkWM6EeQXu2R7v0b52Q3aUMlE5yemlH8gXt+yJuHZrwyH6e65/+Avhl826z/gTIBfR+TL/Ws5zZj/Cz8AAIHClupK4pM9ep/xczIOoKslEUPbpYhFuEDtsr31AnJsFwE2v5PZsBksMiivcM5tnnLkeWmZOzALsVl3XVm5rKWlVmn1JZolsQpcYp2iyFrbJGQKWOD8cjsErL53GziEpg7E9jMXmZh4hYDk2YPVBi8zpxSwmkGeIpd/2RLwY1/pTmEJKiW3D+l2r04BfntbpFdKy52xE/hJ1bbwfHyQEOF9Z/Wh1aXjWAu/UG3vAXXEzrL7hA1daliTeN7KiK1w== 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=yXQQqmUo51ENL/MH4ndFN6momsYZa5Od/gAnQOEoSJ0=; b=WezevS9QeuTSY4AHGOG1aGi9BTeoswJnXrzodQSgvqksijq6fNMy4lG/KUlx99SCLpFKlwvco//ztDCz2FCeSIU3xg6xvW8/Hk4zAXXp0cf+irAXWrbCJ1qNrV68pYakPq6fjlKsaTMA/Ceh4fU5RMohYkq5bM+hvkf8sk1ikjTDQ7qruXLOMJlJGpZnGXs6jMb0PHd9tY4iTT7gnNzgJGwPEdi4EPGmX8raY3ugI0d+2GsWvIi7J103aprFTd+bBNyinLW3YxSri2+yGIARsf7EyImFdox2JP8eybXA3pQ54ZrzHoyAsJE0TH+Rc3dTLypS9/1d07KYR9JWweb3FQ== 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=yXQQqmUo51ENL/MH4ndFN6momsYZa5Od/gAnQOEoSJ0=; b=Vde10mO9qDIm4E3AI1CP0hfg7cA1ESR8lkSqFPtX3Fs5/AYKWiWSUwZMVelQIhyskKBunE5bR+1p/jfR79jWW1yieW3d6u4WdVTO6Hw4Qzunfz6owMtwqENvLQpDTn7PveMbx8FlUioOSVdrObl1pydOhruZX5B5y8SkcsUVKMk= 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 OS3PR01MB9639.jpnprd01.prod.outlook.com (2603:1096:604:1cf::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.15; Fri, 9 Aug 2024 04:22:28 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%5]) with mapi id 15.20.7849.014; Fri, 9 Aug 2024 04:22:28 +0000 Message-ID: <8734ne8gvw.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v2 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 In-Reply-To: <875xsa8gws.wl-kuninori.morimoto.gx@renesas.com> References: <875xsa8gws.wl-kuninori.morimoto.gx@renesas.com> Date: Fri, 9 Aug 2024 04:22:27 +0000 X-ClientProxiedBy: TYCP286CA0031.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:29d::6) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) Precedence: bulk X-Mailing-List: linux-omap@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OS3PR01MB9639:EE_ X-MS-Office365-Filtering-Correlation-Id: a7cba215-7dd6-461b-2e32-08dcb82ae0e9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|7416014|1800799024|376014|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: uxpLa0DdYjOGnptlybFHH/hraRbdwgpDST3trQWyV8kzA7nYR5WVpH677jMTxBTInprIL4TtMQsxqreaR4xC8+FctMpmpo8+BPGuWccq7VgZFCy4RLEVY+vX7DQBVGw8Rmu2AdjssYSseUIab5D+QYExiIUKjQOCHpMsQox3O6W+JZ6AE0UAjEfxZjdsOkOS0Kp95aEXUGkRFHo1YS+8osb5eVIy+jp64cE/mOeu5CxwcWobqF31EcBoFq3BX/uIOkNc00fU4/KZHT5hTlP48XKoEm0czcZoGD8X3lIeWZWW/Tg5C0flqhUBNO8v9Jv9PGNjE3AVjKbEGytlVI1fphmgyvv1RKS4mIdAY84K8cKc307OeBE5y+4TPJwJLDemDWsbxaFnDrg1RCBh0qv87gi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L:1; SRV:; IPV:NLI; SFV:NSPM; H:TYCPR01MB10914.jpnprd01.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(52116014)(7416014)(1800799024)(376014)(366016)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: z5nL6jOSJo9tbLnkhLuD9oPfB/sXeEFR18q7g+NamYP2VMmh/BH0XC7va3SStM3NYYEmsN7lODisA4mHNI4VPfM/f1B0ixUv3h+BgaNS0ip4XW5c70WN74v4gfeQrSlMZgTvwBTqfBUFF7MOH5bC+JmmSkoDpFB0Qq59qszTw2EllG+872sxX7TojswEQfWdJcF9xTWix3fNFZXpNqW+dxj6UuL/RJj6HUEz0jN+1VuQH/oy5DodxAwySxdHBoz3f5DeIMWfPcLr4ahEw09RMaozkXTDlsqMFjyxsUPsr9XCB8x9EBvg5zMjE1gk0BmQ9t3KOe0tiFjfebk3fiPa2bqSQEmDyTy1jPL4Y6Vi43iEy3feUYujweK/QdqRYWTgf2jj2R+cSdfjZE2ginxEDwUU4StIZKr5kt36zaJmqCpoM4R/41CJcI/uqwE6o2fpIihf1GrRomSbHNOM8VYfmq/Dg5og7TIa6E98E3ZC40gjLM+91FXhMYizXBxmRlzf/24In29MInacBw+R4bXYzisCXDRG9g2lUZbHY4x665ppYeqUzKVku1xA/sm39OTAYLKkTKlwNJ4sY18FZEtaYH9teF/nq4Xkkso26/+DUrQkgFG0Qy1JTTdCNhPCcruJWaOBqjYmX2DOtO6DlNWdJCTFKhfnQjAnHtm6Ddx7KNxTQGROC6eoL0sy9/dA2SOwNRHVgY80++s5xn6rB2CyLD/vAUxf3dqj4lXpCW1mcgS+xbAiU/PtJwmxow1LGytdZgxbAbj3GWzCeNzc6ISvPTjKMn/QTWn8PXM5O3A5bSiPuK7KorP+i4WHU9GofwxWgFujFK9rAJdeI+gEu2hqmhoRTzb7+dyqDfS0/Nai9UCA7yhGeDMQg/aTyfjfG04quC3OTYhJJDWLClP7U3wCe7lHzLMb6z5pmBbwagKBikyzlNG9ItpV0XR+rzJAbWkof3wtT9G0aXNVH3HFugdsot1f8T5FZM4NxjJQeZwa7hLElK6l8hRcY2xMpR3QovZVvBLv4ZU+jDBWTEW6WdMVwZE2ps2Sr6r+OI1P5+4okzUIWYj9aH6f/dtqpW5m7Ky88R/O9jWIdrtYiitw/LNKvVg23hjwjA2FU+MdD+5asexWj5H7Dv4vkankOdqTU6P8H+6ijAMOITVFAiypl7pLWDChIILKBu1/GJq1EtXJATveNCcN4lSZiIOhBittipOYo5NMjO7GB669fOLnIHmsH8AoZ9hurGlwKoO9j8cnc0O1gVwNca//TDCtJADkDAivNwktoORLdgRpyt/lSkJzstOiMQ+VCvHK2b2e1Ub2dYTYpvht6XeWoKJeoXjrUHWW4TqPVcZX4AjoyUSkn7A9bgrm2wjjRAcw8Cnz1DU7ah0QxqzBlWIwGvFGqmOL7Pa+p5ww8rnTt8gePtHn+kUgrwTytG3DtW9SujDk9lP2Vmu3qF3hwDwXxeQZ4NzWiamho5zDRFMSpDNPr69WcHElnEeGRPuEqoMCT6JUoEMBjBAjZV6LFW8S3blRWJBLAoENusJdtj3LmDOb9smY5lQRbouJeq99Z3Pj0f64M/6OXhYZsyeeOsIKqZC/lC8Hrbu8RvEjm2RWkY3RO9LqUb62H8LRRCEfSfedrJfj8oqDKm4= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: a7cba215-7dd6-461b-2e32-08dcb82ae0e9 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2024 04:22:28.2171 (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: xbjS2+x0pO6KD/s+viEUWso2XAtgCFfIUHu97ORmGfpTmSc8IM1m71k7cV8mA7SuCLyn++IY0xWrOPy0se3go4JbRV1/ugTk7kmhF+xvqndc0Ajtqy1pTklQoZKlUvui X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS3PR01MB9639 We already have of_graph_get_next_endpoint(), but it is not intuitive to use. (X) node { (Y) ports { port@0 { endpoint { remote-endpoint = ...; };}; (A1) port@1 { endpoint { remote-endpoint = ...; }; (A2) endpoint { remote-endpoint = ...; };}; (B) port@2 { endpoint { remote-endpoint = ...; };}; }; }; For example, if I want to handle port@1's 2 endpoints (= A1, A2), I want to use like below A1 = of_graph_get_next_endpoint(port1, NULL); A2 = of_graph_get_next_endpoint(port1, A1); But 1st one will be error, because of_graph_get_next_endpoint() requested "parent" means "node" (X) or "ports" (Y), not "port". Below are OK /* These will be node/ports/port@0/endpoint */ of_graph_get_next_endpoint(node, NULL); of_graph_get_next_endpoint(ports, NULL); In other words, we can't handle A1/A2 directly via of_graph_get_next_endpoint() so far. There is another non intuitive behavior on of_graph_get_next_endpoint(). In case of if I could get A1 pointer for some way, and if I want to handle port@1 things, I would like use it like below /* * "ep" is now A1, and handle port1 things here, * but we don't know how many endpoints port1 has. * * Because "ep" is non NULL, 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 A1 -> A2 -> NULL, but it will be A1 -> A2 -> B, because of_graph_get_next_endpoint() will fetch "endpoint" beyond the "port". It is not useful on generic driver like Generic Sound Card. It uses of_get_next_child() instead for now, but it is not intuitive. And it doesn't check node name (= "endpoint"). To handle endpoint more intuitive, create of_graph_get_next_port_endpoint() of_graph_get_next_port_endpoint(port1, NULL); // A1 of_graph_get_next_port_endpoint(port1, A1); // A2 of_graph_get_next_port_endpoint(port1, A2); // NULL Signed-off-by: Kuninori Morimoto --- drivers/of/property.c | 22 ++++++++++++++++++++++ include/linux/of_graph.h | 20 ++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/drivers/of/property.c b/drivers/of/property.c index e4d5dfe70104..dace154baaab 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -695,6 +695,28 @@ struct device_node *of_graph_get_next_port(struct device_node *parent, } EXPORT_SYMBOL(of_graph_get_next_port); +/** + * of_graph_get_next_port_endpoint() - get next endpoint node in port. + * If it reached to end of the port, it will return NULL. + * @port: pointer to the target port node + * @prev: previous endpoint node, or NULL to get first + * + * Return: An 'endpoint' node pointer with refcount incremented. Refcount + * of the passed @prev node is decremented. + */ +struct device_node *of_graph_get_next_port_endpoint(const struct device_node *port, + struct device_node *prev) +{ + do { + prev = of_get_next_child(port, prev); + if (!prev) + break; + } while (!of_node_name_eq(prev, "endpoint")); + + return prev; +} +EXPORT_SYMBOL(of_graph_get_next_port_endpoint); + /** * of_graph_get_next_endpoint() - get next endpoint node * @parent: pointer to the parent device node diff --git a/include/linux/of_graph.h b/include/linux/of_graph.h index a6b91577700a..967ee14a1ff3 100644 --- a/include/linux/of_graph.h +++ b/include/linux/of_graph.h @@ -59,6 +59,17 @@ struct of_endpoint { for (child = of_graph_get_next_port(parent, NULL); child != NULL; \ child = of_graph_get_next_port(parent, child)) +/** + * for_each_of_graph_port_endpoint - iterate over every endpoint in a port node + * @parent: parent port node + * @child: loop variable pointing to the current endpoint node + * + * When breaking out of the loop, of_node_put(child) has to be called manually. + */ +#define for_each_of_graph_port_endpoint(parent, child) \ + for (child = of_graph_get_next_port_endpoint(parent, NULL); child != NULL; \ + child = of_graph_get_next_port_endpoint(parent, child)) + #ifdef CONFIG_OF bool of_graph_is_present(const struct device_node *node); int of_graph_parse_endpoint(const struct device_node *node, @@ -72,6 +83,8 @@ struct device_node *of_graph_get_next_ports(struct device_node *parent, struct device_node *ports); struct device_node *of_graph_get_next_port(struct device_node *parent, struct device_node *port); +struct device_node *of_graph_get_next_port_endpoint(const struct device_node *port, + struct device_node *prev); struct device_node *of_graph_get_endpoint_by_regs( const struct device_node *parent, int port_reg, int reg); struct device_node *of_graph_get_remote_endpoint( @@ -132,6 +145,13 @@ static inline struct device_node *of_graph_get_next_port( return NULL; } +static inline struct device_node *of_graph_get_next_port_endpoint( + const struct device_node *parent, + struct device_node *previous) +{ + return NULL; +} + static inline struct device_node *of_graph_get_endpoint_by_regs( const struct device_node *parent, int port_reg, int reg) { From patchwork Fri Aug 9 04:22:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 818497 Received: from TY3P286CU002.outbound.protection.outlook.com (mail-japaneastazon11010037.outbound.protection.outlook.com [52.101.229.37]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C33D12208E; Fri, 9 Aug 2024 04:22:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.229.37 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723177368; cv=fail; b=h+iVp8HnSm9vaFbM65pJWXb9Lb9dr15e7ZbxZuauV5kP6G5lvT1o9lHjr49UqwAh8eoNEs7EFe1LKkY2qLpJOLtKlrCQnHW4A7/wg0euLr+eX1QCBxafqh2FzWmRG5/IQBo1UJc11mEi6TjzlFUEMhHvXwiMnZKbhaJCouu9d4o= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723177368; c=relaxed/simple; bh=ujqNsJe/qHMVOn6/LwqKnNHq0H6XnyCb97UUoyhNh0o=; h=Message-ID:From:Subject:To:In-Reply-To:References:Content-Type: Date:MIME-Version; b=WiXhSmOMEaaAU2yzvHZmi0IkNFeBpxshbs8AmeGeZSbrglTSCzNInNoI+6P12uEC29UWvaHlreQWJjHsgDKXa5rU6jQ/CeQK/sI+a5nTGwKgGNiK913Y3YSBJkrvVCvT01vl1Km4XvTTeda3u+EzM3dTnl9u7pTDMVa30AN9RyI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com; spf=pass smtp.mailfrom=renesas.com; dkim=pass (1024-bit key) header.d=renesas.com header.i=@renesas.com header.b=EXIzGHr8; arc=fail smtp.client-ip=52.101.229.37 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=renesas.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=renesas.com header.i=@renesas.com header.b="EXIzGHr8" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yFNTxjH8BvVeB5wOylXfoOvwrc0qw504jAN32+68x/HQ8IPgZg5TEKmNmC+NkdDopEdnPpNIHFeUXce6q/A7bYp8CyEoKsNT5n+OFxLmnlgNJMC+O7CiIl8HQ2/58Z7oom8bTsRcxHJOI67K6KeK14D/oiFMyedxPQvKK35ChX4AfJczQjCEmRIcJGtRFy5P2cOTTNFvkZF1ugPDkE6hjdtQITmrt2y24EcWtWpHiVwE5vebdtPDPqrbkqbh9kv8U7B8bywptHOcxAHmvd4mCxvsxqQDDukaYji4GqSryzAi0lVt9ImuC0iSi6P0I7a7dWUCPssMSXRAYouGCs6Beg== 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=nnM/bVJH/7MwtVBHhQABMeeqNeBOZIi/dXjU+gs2Who=; b=qb5UCQxmJSPrhGO1MoFFcfaSGbmvfkulgg3CKRRrHyvk1lui7bdReQxqrYSRCaKCEwmIgn+O8XcIW34lRg8ADLSx4JLIq4g/FFaAVZ6SSu4vgEH/mJykrAPe7MRwqPgswUZ6/C64Ut5alxlmfGkkwnKtz09Ivw7PEMOFTbWKvHKMvexVgoD4d0EHNZlkh8k8TlhA3l7+Sl1U6Nr06HOkBcMtN8npdKGBgs060Is+9zWMdPFnV7agMagePZaI+YELwdxMgfx+7U5VTr1iZoiNIZ75wnZW645E445h9Hug1B4ZAX/2TUxeDOL0vmHlxxcBZuVFsFeexOojlUqmaGZ/gQ== 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=nnM/bVJH/7MwtVBHhQABMeeqNeBOZIi/dXjU+gs2Who=; b=EXIzGHr8pHvYZ9XPkdRHXTDbKpJnn4dpwjLEqcqG5zRT0fteSQ4HuZBIjxSDA9VZ1OmjpdXTb9RrlvwKy3QHTKHF3f+vP1FN04SIgI/SWCzq8mnrXEt0NRHwotCzNSIuXFAQNUkHOmpelEysQgwYRG08n6wyyC+n35rBgJiHWKI= 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 OS3PR01MB9639.jpnprd01.prod.outlook.com (2603:1096:604:1cf::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.15; Fri, 9 Aug 2024 04:22:44 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%5]) with mapi id 15.20.7849.014; Fri, 9 Aug 2024 04:22:44 +0000 Message-ID: <87zfpm72b0.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v2 4/9] ASoC: rcar_snd: use new of_graph functions User-Agent: Wanderlust/2.15.9 Emacs/29.3 Mule/6.0 To: Daniel Vetter , David Airlie , Helge Deller , Jaroslav Kysela , Laurent Pinchart , Liam Girdwood , Maarten Lankhorst , Mark Brown , Mauro Carvalho Chehab , Maxime Ripard , Michal Simek , Rob Herring , Saravana Kannan , Takashi Iwai , Thomas Zimmermann , Tomi Valkeinen , devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-fbdev@vger.kernel.org, linux-media@vger.kernel.org, linux-omap@vger.kernel.org, linux-sound@vger.kernel.org In-Reply-To: <875xsa8gws.wl-kuninori.morimoto.gx@renesas.com> References: <875xsa8gws.wl-kuninori.morimoto.gx@renesas.com> Date: Fri, 9 Aug 2024 04:22:44 +0000 X-ClientProxiedBy: TYCP286CA0358.JPNP286.PROD.OUTLOOK.COM (2603:1096:405:7c::9) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) Precedence: bulk X-Mailing-List: linux-omap@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OS3PR01MB9639:EE_ X-MS-Office365-Filtering-Correlation-Id: dea819a0-5db5-487e-cef5-08dcb82aea92 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|7416014|1800799024|376014|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: eewj0mtYeuLtDRUo7bnrr9dK5KW3YVnD8byggA6S2ogbfXs4Mu9/skOGI3IwWWp/umoWllPbRlysckZQOTm6k3Z7+BscZsW3pZOp7F9ztZLDLHaes0bAbb4WWhqRDm5IS/yAsAQa9fLz/7PmjSOZNBD8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b6rylwDboPDkJCRDg+HVleySGC9pstIzua6NLieoXUrfzMRZ1pNXf5iSi7qKTHPK6MIf1RhezWJ4DjJTUe2VZkp2d/zkNdT817I+jxphajxL0rPDqPUTlyTxrnejBTzPv6cn5VzKtUAJtQV5yKjbQVmZrO3czndTOh9kfHakh6w7X9A78ToCEQ8gxTIw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TYCPR01MB10914.jpnprd01.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(52116014)(7416014)(1800799024)(376014)(366016)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: C/LqmRyN727eznM5oRi0lLp1SEvynAm/xmp5H5Niw8K4vL2R5T61WwL0gpRY33BMam5X9Hvbw6/854D8D8/TtRXw0d6NKOEEUdsnxwfCTyoJgjL2Z9Ql+j/QNfnkyQ46EXL8tUYqU+cbqK5VdfXuow4iLxXqL5jSLU7yFXnMwms+bnTNNZrm8VjB95T5jLhjz1ENsnggbTGeTzSaCn5bEyua+Zn/P5eU0xNgz5hCvzuRVcF4BSlSQuEOJEmR1gxcRjwIh+RjvBr9NwVtJ5SHvML2dLRcEyAtj0FGB8Z/Dv3Ayig4BGZ2jOyX9IwSBXGsKC0hK88IKvtrmgNGSgEGFQVPnTpnDrXwWZBnogagEWxk091iHsNnsX6apFJm/Scz6p+FophMJogPV5BBrcUngKeeBVEbxegg07epE05oV0v3OkPbsbv+rvzf8MGjjj/aLvfheUWvAdQRdqSwj3Z0cR4DkMhtFnb3CQ3E/SPnSMmKIqGp/uPJ/3L1zJCMmLS9M9sOEfpf3yfNExvxM8Ret2D7qenjNIi3erX9Mcf047nCByrc7BOR3EpBsAOlUfahnj3J1gfGA++AjHspueWdujRKy19ZEXVwEkUBIgdA8/gPrNM7NBWkouBzD4QcniKDMIEEF4ogUleP0Qy4V3V5qcRzO8r9J+WCwRHbYvlVjSGTRwF8bkDPQyxw9tFo5xpGwD4edm+FJ0gH0/7OraU/FE3F5TyX+xuL0o/01x9ChjISCRO4p0dH9MhwO8n2UiY9ydsf+qGqmLNogus92ypSkg34lf31/zFtMVbfyZruSKsm8eeLm3lNFcLdyHwW9T7CillfGUem6+NeB5cyAVQRwejXLkpxOJ54agQ/WnsDlSLLz7aHZPziqRt1jiX066AznQom3zCAlqxbBO4s12QjzKm9jmRPqBsuc8qnA1WF+0Hh9WmdMp7jRqkwOHa5rwDN/NMzYUUYR/jjDLzZSzJunECErQMl0S+B8O8AF39q48MIxe94pMfNEO0039QpVtac1msObhVUhhQsAPkdhak8M5VLn8wGFRYLVG6MjkDEW5DFXBwSDNn/7IJOpW3CWtdZmip659yGXfNOR40O/WadJ22pO7yHE7/1n2gcyW61ALCjwvK4OBR83nzrxjqyX8m7aCTIGmd9kWb0MzeQaz0drFy4n/WW+7IvXplJDzDjGleUCyhnjFCvYOkJsQ5kptLiFjFtm/zfPtaeqNKyUZzubmjTtTIdcf+MEjwWpwIE517gaZVuqwQSE4l8DtfznI9D8nTG32vHaKDKRxo2eFrNbWRdMffMVoatgINNaTSwPFbXm9IOSJuLZxy6Wb26aS+lBI/yoKO8YivHe30pY3ap6e9kbnQ8J+9UJZp3jaUaCg0YyrskXs83w8fGuJRvo9twWyE6mWwlgrlaFDIMmbxtfpiobcvEGy6GhtwwGOPeUv5kTGRkY8YWeOADG/dyiga4QbK+KeGyegsHGvFhEfWD2qT3d69+64OiA1bICYYnRPO/vy6XZcENttI1ZBID0MEgxmq/UOi9AXzgA6bm9UoWOtS0kcf92RX2FHZiZ/rmn6V5XIFGda99LxmKiD8qqdxH3CLUhfE3VbX7lJfNHY4yb1K4tw2g7jSs2lChvVTDcS0= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: dea819a0-5db5-487e-cef5-08dcb82aea92 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2024 04:22:44.4304 (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: nWJFQs5Nh9J6iUbroDZAGjfBkNgtaXdJKGpcEKyWGmDDG8RgFPVl7V1M/3S9wvNOW+a498op2jDT+9JL3eIfQ9TKPyewNgmhfFpoFxhyRGBVsAhIYfMCBat/ZUZ27LYQ X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS3PR01MB9639 Now we can use new port related functions for port parsing. Use it. Signed-off-by: Kuninori Morimoto Acked-by: Mark Brown --- sound/soc/sh/rcar/core.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 63b3c8bf0fde..eb146cf836eb 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -1294,11 +1294,8 @@ static int rsnd_dai_of_node(struct rsnd_priv *priv, int *is_graph) /* * Audio-Graph-Card */ - for_each_child_of_node(np, ports) { - if (!of_node_name_eq(ports, "ports") && - !of_node_name_eq(ports, "port")) - continue; - priv->component_dais[i] = of_graph_get_endpoint_count(ports); + for_each_of_graph_ports(np, ports) { + priv->component_dais[i] = of_graph_get_port_count(ports); nr += priv->component_dais[i]; i++; if (i >= RSND_MAX_COMPONENT) { @@ -1506,10 +1503,7 @@ static int rsnd_dai_probe(struct rsnd_priv *priv) struct device_node *ports; struct device_node *dai_np; - for_each_child_of_node(np, ports) { - if (!of_node_name_eq(ports, "ports") && - !of_node_name_eq(ports, "port")) - continue; + for_each_of_graph_ports(np, ports) { for_each_endpoint_of_node(ports, dai_np) { __rsnd_dai_probe(priv, dai_np, dai_np, 0, dai_i); if (!rsnd_is_gen1(priv) && !rsnd_is_gen2(priv)) { From patchwork Fri Aug 9 04:23:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 818496 Received: from TYVP286CU001.outbound.protection.outlook.com (mail-japaneastazon11011003.outbound.protection.outlook.com [52.101.125.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AC5A52208E; Fri, 9 Aug 2024 04:23:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.125.3 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723177393; cv=fail; b=YSlMZH5mnjTy1uqrl5z8KdUXUSItVClSaESYjAcGbk+pQWKGbtT55mH1vAr8kaNLCTBAzkdx6e0zJpu3knt3aK1CXdQPBvAJ0cMtY9EQId9MWFKecw09gV3+KhPCmC7veCBN9RvCwELdJAfedA+4ycTqWwsLSvACtDGUJrpdlik= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723177393; c=relaxed/simple; bh=hAWmi70wmlFyCOsgDMXKcQvOnNw7SvNPxdsHnTj354c=; h=Message-ID:From:Subject:To:In-Reply-To:References:Content-Type: Date:MIME-Version; b=NHE8vUfQCdbeLd+bAtEPuUA1Uwby1hnHh0E2wROollAOv/ts9zQajEyos6eT/ZRZgSGhVkSk54DfH9nzxeGdaLhN1DYjAqdPd1mlhMHCWEB21/jmSHlfgkcOkPKuphzmirbjMrczbOMNCAr9wd2D9q32D1TPZ6+oOfS4XzLmIIs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com; spf=pass smtp.mailfrom=renesas.com; dkim=pass (1024-bit key) header.d=renesas.com header.i=@renesas.com header.b=aM/i3Fe2; arc=fail smtp.client-ip=52.101.125.3 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=renesas.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=renesas.com header.i=@renesas.com header.b="aM/i3Fe2" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vNUqjQ9ALjiRpeEmGCrm7djqHfqgkdrMOFB1V/AZk6y/0uE7s9SHw0n7OS7JgfnpfKldMxLzj8A/Lw/uq0IxTpu0/4v6o7ueB+/M7/3afmo2Z+0Qk/vSFPOhLzmQUb0A/6GaCLzhPpy/EVZR50ImKqyQkc4reDviMLExuweLIavTk1auRwdsgE8RQasTEv8jxWXVxrLdEl36ExrHETWmlLgJbDdvh/CPqSnTv8hmVvmweOYgo0EaZcY3DHkpdDk8BhC+Mgvtxk5nQLF6mQHxlIND3siMz0ZyORUVZG3GaERO/aeUFS5jAPiTK4ZXa3TjyrIydXtiQzgN2l1Q0JED5Q== 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=VN/zDdElcg66hXRY23ZSlUflCqrXtLJl6SysRvMczBA=; b=Ojb+v5bAgxTLguVf2MzPskjCoD/f3R/FR8Cxr7Be6gNCIdulMkaK/KNIYYxLdQwwbmndWGkVxz7zfdZpIcusX8ZLz58AXFa8z0JIYRNP0+azr0NMVTfJoNTCmL8d1kxWnBX9Ag2+DMjsfmCYJndaUhWcXwRM22SiNFuR99pzvHbRKBCxmKy/rotyn8MYzizpxbT4o4XQ3+R1mWLGE/3T1iFqMblcMzqR7U13lHnAMyY3EV96jIL/dPriiCs8B2POr91F2Q9hwL4qUFCEnhcVANmnaVqcuvDLIKmp+XDd2BGSITWn3BLz5PxIcGLn/2IwergajT/MzzejpdmvDVX0pQ== 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=VN/zDdElcg66hXRY23ZSlUflCqrXtLJl6SysRvMczBA=; b=aM/i3Fe2X1Uqmm+gl+z6Dt74FGERh5LX0qA2TjP5RXdcWww3Qqcc5HZxoRUdU6cC111hZGcEdTcjbzEa9kvvFHXg2rhGEvlEteIirjJ8jKzQ4asXJIE2qwWr3pEzmba1grJQKbkOQIaauL3qdKKnR3KBce0uav0tkkGt3aUJWrw= 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 TYCPR01MB6400.jpnprd01.prod.outlook.com (2603:1096:400:98::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.15; Fri, 9 Aug 2024 04:23:08 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%5]) with mapi id 15.20.7849.014; Fri, 9 Aug 2024 04:23:08 +0000 Message-ID: <87wmkq72ac.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v2 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 In-Reply-To: <875xsa8gws.wl-kuninori.morimoto.gx@renesas.com> References: <875xsa8gws.wl-kuninori.morimoto.gx@renesas.com> Date: Fri, 9 Aug 2024 04:23:08 +0000 X-ClientProxiedBy: TYCP286CA0188.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:382::17) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) Precedence: bulk X-Mailing-List: linux-omap@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|TYCPR01MB6400:EE_ X-MS-Office365-Filtering-Correlation-Id: 1816faee-edc7-459c-276b-08dcb82af8d4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|7416014|376014|1800799024|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: 2CjRCk2tM5k2aBUNP6TElcHAHAhX4kCjPWfRcvnodtkh5ypoodp2cVUtWTTuxOHDw6Ei/RzXmMdM1/GFFveV5CV6kOqn92vF6yd/2i4M19v6eyBvqFkTfCDc8+5iH8AgkzSQ61z9lqGzBeQfN3PxpaGJiHqGBZUoKYiXVMSyZ7BOvW0bPdhlDUzp1F/+hxHPR3vWJ99DYsTVL1w4pddv6KKLpHwiN3+LAlriDxSubBQxZmEjHB6LKH8SgfVJrYQeg8dpU1sfzXmG1fbx6RGN0gCTzsQ1W2qT4kzgD1/0LNWassdMDMsnkKjM/7GjAeb4b3Tq/EQg0yd612mzXxd6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vl/k7TAS+60PJl0OzDQtySu0cc= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TYCPR01MB10914.jpnprd01.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(52116014)(7416014)(376014)(1800799024)(366016)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2eLg1VjNyJVj3oWFLgT4TfVKgsvXXjTOmUPvfGfc6ocZev2TafX8A4Zd2eTo/51+sUGn6wrAcGL0ucL/I/EHrMTA/tyAxsSP1bRbwCAtneWaqD/bInQobDholXc0GhCprN/BpVhNT1U74MQ7G28gzEtpsX106kdGd+hDYt1jQ2QxMJdMCot0Ulk0aEYaNYMKkyVhDLhRDnRpu7mONZDVJVrDo3TSiREv+QxRQxD2k94JutqUpw4AAOQENa/Tv0NOb8/w2ESBmkJj32KMVakbSOgykvLt/zTjNMwznifwaFQI7HDulLiXK+SLdEnlNaXHoykQiEUDbpIblFz0DP7/VxeiYOxKL5YXROLJj8U9B2EvIvW3mk/9NxKg5ddk9Kbe/1h2nDZWxE3Prab7TMy3juG+6k6CD72YDgqXaEo+WGDAdkpvVdeVCCgz3kL7Ey86135R5mHWWTl37UczsqdXxuUZFfaOUYqKNsu2VQhyO70TX0/NGiqSzluJytcToDMoKfUMKYEY9ki7Cq+ByzLWhlSY5gDIxhoRUDGSrlgy3ocjX9uuxHBPwLe7uUSfs8yA24l+AmGI1lovkl26eSZyhf8BYiRFwg/mXBcBw74h7ebU67dYRYIOZdByXoqoHt/sot2L0Wt8d2Cs4XJRpHvrbkmI5mDyD2Yvuphm8oGxVKpleEDiV7wYltFcrjj+9wFtXWWSZmZSOb7U0j/AtptYlgUWwIS4mqPZeteYbcE9yeSSLIgc+KOf3myAoAujOkKpMX4SZeEtQf3z4Fz4PRRE5kw2SctrW4BjGdz9woYTBscrKqHflMSqGG8TI6+ZlNTjaLZnMYvbaYpdCEuGyGNGzQKgHANW6r9AgYq6fQiGQhk8/O054NPPiLzOwGKVhLqWLSrDDwPwU2HXGUhg6kJ6NZOUfbcK1xucovPm1qxXzz9zEv9UKHR9suj8NrROtMRBPiG9h/pprJ8ZulYSL6SPUmQnvw+kkNyqjRmGdFaEsMqT5wLMR6jRvAWI94Weh5HHPSEGgK4DADHYrUW2YkccCSSx+GB9t0LjfB5gu2Rg6AKw1NAQNnSo5/A372M/KA1KPf0R5lwcngbAfz4L4SAhIMTe5eUAQ2nluNa9gAEhlXd4mOAx79WHzHAnyurJWbV5m7iudrQpxkKDcOz5bY6JqqLSI4B35gZZo0o3wRHHmTXfo0L3jqZP0g8zZZXjUw8v9MubQdjiQGkloupMyZcF8szRIEDvkVHUsHJu4jmX/PTuWCOY6ga1iO0qPRVuEDiw70bBcnXdme2j5ao/oG3T8TF3ESXJ2n0b71uxF9M42JIadwXNw06PdztrGYvctdiKxXZpPFmb7j7iW/GvsH/SwvabqtpV7JXY8KG8imfLcPn061K6x9CVWP33zqi6a6n+itqNj52ScNRUuXWEbqFurZ7jrqE/CokXEyAj+teH/OBDEc6Mjz+3eTJmrgmcGRskY1pZFfI60GybHSh1GfM9dME29M5h5M2Jhe/Fnk7TPjFojXCQZzwnC3Z5dEUu3AzuCsKN4ZrFaYlyeXwJdKQIaI0UCXpoy8fXqivwdv3bkOe8VTf8z1jxerXpY9ZjShnb2pH0skBFS/9HAyCEK9cxWFYHFBS1Jukq3eCB+cRmVrU= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1816faee-edc7-459c-276b-08dcb82af8d4 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2024 04:23:08.3334 (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: ahY8rT2Kwp9f4aVinm3WE+TXTmWX+l+llBBocY08G3AXA1fHn4EUUvdgNPO1bMibPGhuwc3wq6zLrQxUaF5FIuqEIj9YZk+ICX4HTYasaM1A7w4mlwMkQLG3O0HIJG14 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYCPR01MB6400 Now we can use new port related functions for port parsing. Use it. Signed-off-by: Kuninori Morimoto Acked-by: Mark Brown --- sound/soc/generic/audio-graph-card2.c | 111 ++++++++++++-------------- 1 file changed, 49 insertions(+), 62 deletions(-) diff --git a/sound/soc/generic/audio-graph-card2.c b/sound/soc/generic/audio-graph-card2.c index 56f7f946882e..e8ea201dbca3 100644 --- a/sound/soc/generic/audio-graph-card2.c +++ b/sound/soc/generic/audio-graph-card2.c @@ -234,8 +234,6 @@ enum graph_type { #define GRAPH_NODENAME_DPCM "dpcm" #define GRAPH_NODENAME_C2C "codec2codec" -#define port_to_endpoint(port) of_get_child_by_name(port, "endpoint") - #define ep_to_port(ep) of_get_parent(ep) static struct device_node *port_to_ports(struct device_node *port) { @@ -351,14 +349,9 @@ static struct device_node *graph_get_next_multi_ep(struct device_node **port) * port@1 { rep1 }; * }; */ - do { - *port = of_get_next_child(ports, *port); - if (!*port) - break; - } while (!of_node_name_eq(*port, "port")); - + *port = of_graph_get_next_port(ports, *port); if (*port) { - ep = port_to_endpoint(*port); + ep = of_graph_get_next_port_endpoint(*port, NULL); rep = of_graph_get_remote_endpoint(ep); } @@ -530,67 +523,70 @@ static int graph_parse_node_multi_nm(struct snd_soc_dai_link *dai_link, * }; * }; */ - struct device_node *mcpu_ep = port_to_endpoint(mcpu_port); - struct device_node *mcpu_ep_n = mcpu_ep; - struct device_node *mcpu_port_top = of_get_next_child(port_to_ports(mcpu_port), NULL); - struct device_node *mcpu_ep_top = port_to_endpoint(mcpu_port_top); + struct device_node *mcpu_ep_n; + struct device_node *mcpu_ep = of_graph_get_next_port_endpoint(mcpu_port, NULL); + struct device_node *mcpu_ports = port_to_ports(mcpu_port); + struct device_node *mcpu_port_top = of_graph_get_next_port(mcpu_ports, NULL); + struct device_node *mcpu_ep_top = of_graph_get_next_port_endpoint(mcpu_port_top, NULL); struct device_node *mcodec_ep_top = of_graph_get_remote_endpoint(mcpu_ep_top); struct device_node *mcodec_port_top = ep_to_port(mcodec_ep_top); struct device_node *mcodec_ports = port_to_ports(mcodec_port_top); int nm_max = max(dai_link->num_cpus, dai_link->num_codecs); - int ret = -EINVAL; + int ret = 0; - if (cpu_idx > dai_link->num_cpus) + if (cpu_idx > dai_link->num_cpus) { + ret = -EINVAL; goto mcpu_err; + } - while (1) { + for_each_of_graph_port_endpoint(mcpu_port, mcpu_ep_n) { struct device_node *mcodec_ep_n; struct device_node *mcodec_port_i; struct device_node *mcodec_port; int codec_idx; - if (*nm_idx > nm_max) - break; + /* ignore 1st ep which is for element */ + if (mcpu_ep_n == mcpu_ep) + continue; - mcpu_ep_n = of_get_next_child(mcpu_port, mcpu_ep_n); - if (!mcpu_ep_n) { - ret = 0; + if (*nm_idx > nm_max) break; - } mcodec_ep_n = of_graph_get_remote_endpoint(mcpu_ep_n); mcodec_port = ep_to_port(mcodec_ep_n); - if (mcodec_ports != port_to_ports(mcodec_port)) + if (mcodec_ports != port_to_ports(mcodec_port)) { + ret = -EINVAL; goto mcpu_err; + } codec_idx = 0; - mcodec_port_i = of_get_next_child(mcodec_ports, NULL); - while (1) { - if (codec_idx > dai_link->num_codecs) - goto mcodec_err; - - mcodec_port_i = of_get_next_child(mcodec_ports, mcodec_port_i); + ret = -EINVAL; + for_each_of_graph_port(mcodec_ports, mcodec_port_i) { - if (!mcodec_port_i) - goto mcodec_err; + /* ignore 1st port which is for pair connection */ + if (mcodec_port_top == mcodec_port_i) + continue; - if (mcodec_port_i == mcodec_port) + if (codec_idx > dai_link->num_codecs) break; + if (mcodec_port_i == mcodec_port) { + dai_link->ch_maps[*nm_idx].cpu = cpu_idx; + dai_link->ch_maps[*nm_idx].codec = codec_idx; + + (*nm_idx)++; + ret = 0; + break; + } codec_idx++; } - - dai_link->ch_maps[*nm_idx].cpu = cpu_idx; - dai_link->ch_maps[*nm_idx].codec = codec_idx; - - (*nm_idx)++; - of_node_put(mcodec_port_i); -mcodec_err: of_node_put(mcodec_port); of_node_put(mcpu_ep_n); of_node_put(mcodec_ep_n); + if (ret < 0) + break; } mcpu_err: of_node_put(mcpu_ep); @@ -674,7 +670,7 @@ static int graph_parse_node_single(struct simple_util_priv *priv, struct device_node *port, struct link_info *li, int is_cpu) { - struct device_node *ep = port_to_endpoint(port); + struct device_node *ep = of_graph_get_next_port_endpoint(port, NULL); int ret = __graph_parse_node(priv, gtype, ep, li, is_cpu, 0); of_node_put(ep); @@ -769,7 +765,7 @@ static void graph_link_init(struct simple_util_priv *priv, of_node_put(port_cpu); port_cpu = ep_to_port(ep_cpu); } else { - ep_cpu = port_to_endpoint(port_cpu); + ep_cpu = of_graph_get_next_port_endpoint(port_cpu, NULL); } ports_cpu = port_to_ports(port_cpu); @@ -779,7 +775,7 @@ static void graph_link_init(struct simple_util_priv *priv, of_node_put(port_cpu); port_codec = ep_to_port(ep_codec); } else { - ep_codec = port_to_endpoint(port_codec); + ep_codec = of_graph_get_next_port_endpoint(port_codec, NULL); } ports_codec = port_to_ports(port_codec); @@ -850,7 +846,7 @@ int audio_graph2_link_normal(struct simple_util_priv *priv, struct link_info *li) { struct device_node *cpu_port = lnk; - struct device_node *cpu_ep = port_to_endpoint(cpu_port); + struct device_node *cpu_ep = of_graph_get_next_port_endpoint(cpu_port, NULL); struct device_node *codec_port = of_graph_get_remote_port(cpu_ep); int ret; @@ -883,7 +879,7 @@ int audio_graph2_link_dpcm(struct simple_util_priv *priv, struct device_node *lnk, struct link_info *li) { - struct device_node *ep = port_to_endpoint(lnk); + struct device_node *ep = of_graph_get_next_port_endpoint(lnk, NULL); struct device_node *rep = of_graph_get_remote_endpoint(ep); struct device_node *cpu_port = NULL; struct device_node *codec_port = NULL; @@ -1009,7 +1005,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. @@ -1039,8 +1035,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); @@ -1141,21 +1137,12 @@ static int graph_counter(struct device_node *lnk) */ if (graph_lnk_is_multi(lnk)) { struct device_node *ports = port_to_ports(lnk); - struct device_node *port = NULL; - int cnt = 0; /* * CPU/Codec = N:M case has many endpoints. * We can't use of_graph_get_endpoint_count() here */ - while(1) { - port = of_get_next_child(ports, port); - if (!port) - break; - cnt++; - } - - return cnt - 1; + return of_graph_get_port_count(ports) - 1; } /* * Single CPU / Codec @@ -1169,7 +1156,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); /* @@ -1197,7 +1184,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); /* @@ -1239,9 +1226,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 Fri Aug 9 04:23:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 818495 Received: from OS0P286CU011.outbound.protection.outlook.com (mail-japanwestazon11010030.outbound.protection.outlook.com [52.101.228.30]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5CB5F1649CC; Fri, 9 Aug 2024 04:23:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.228.30 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723177410; cv=fail; b=sbcQ2nPQ3195FcoGExT6adAwZYJc0LFIRcg3GqgONEpuzGkaQNhl6yg0G+M+Dgd1KlMi/W4kAJ6HDixX+S4ZDaBeDHHG7brvoYPuCHyrMkFrPZnHnVbUeN9JdMnf28nE/PYSPk6L/03Tg7POhFyomZdLzt0gTejHLnJ0w+duqAk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723177410; c=relaxed/simple; bh=mg8aPdjfj8RwMfSnBel27b47brMcpDU/JeJn8rTtrvc=; h=Message-ID:From:Subject:To:In-Reply-To:References:Content-Type: Date:MIME-Version; b=JoW1kjXjzpmqVmL/LCtZ/YurAZ5kDlj7r5a8iIuTDzh+bNn5x5jGFPuSuaUPoV09o/RWF65DsciSD4AX0VkjdWK1h5BqU1w9AmcC4U6yBo2ZkUbxtcQbkVgJSUJpp9YM/00/yoK2T3vj+DWEwdvEmNIVSdqTcFyuums5m3IumyI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com; spf=pass smtp.mailfrom=renesas.com; dkim=pass (1024-bit key) header.d=renesas.com header.i=@renesas.com header.b=IZnOBqz0; arc=fail smtp.client-ip=52.101.228.30 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=renesas.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=renesas.com header.i=@renesas.com header.b="IZnOBqz0" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CL8gjZl+zPsZQ+sUjHufG4dvGKnlzDHjQheyqAYBFZ2sZiqxOsMv/hs7c4F+3leB+uQDGD7q4I9cB72QLjXvI9AayUqfunvgQsBJ7IiACXz1on+ppV4jnnV5j7wp5vO8Zy1/vgAU6Uru2aZ8JKk8FugGlhS9gB1tjlxhu9g+s1tOjf9LRxjq0uVb03y9SjD0ir/DIRPpHko7kupjO0eA9dwOtYWMv5HdsUnG6dnr3+FfT5k8NJ+v+UPJeo4wVRBacOnqwPRTcMEaCCdfbNJgKINQWs0wxnfWtLqt+LdMLh1AYdDoAygshNq4wFMJlgpSWOC+puJwmpwv3bdVzCSpWw== 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=bqpCLsY1CmrUuWtVZbk0ujoYsWif8tltOD/VUVSoA/Y=; b=O8ow9SgcKWeykHmjxh2nH8EyCgp+VBRj5c3PWL1/aCiZzDO/SGlhHqSP/oJNkTMsqgfOBeCvLyQaUUwV/tTsKwKpH+x3dJkthzJ15LUramH8L8zgPkURuQVeWxPGDxxB44e+n2LIb80McSnYd0pwREz7oHWbwbIiPQQzlehgezt+TracGIuuZ+srIq4kVqcI+f8Y4hHwkW+oj0yJJhh06csFavgnnJB7tl6+EHYkBVsuolEyiFEM5gNSi2g920vTvpkg4XncFNwrcYeuP5abppRDddhW1kmF08RG3mY6GoOucoLYXoiESYM903NYDRttkWxfHrsOHkafjJxSSk4hLw== 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=bqpCLsY1CmrUuWtVZbk0ujoYsWif8tltOD/VUVSoA/Y=; b=IZnOBqz00GKPu18D1MG8FMHpC3NTysmmE1y2BB4VwiIh+TEtn+iMIuqINcqBDY3vMx/1bdbha8NApJnxwbIt1t8kQ7aFDTTLMqf2oGA9KCTF482HvBZursQE2mav25jQ4drhffrUHRV39U7pr6lOnBKdnScpb2PUPoFP/ZhyDT0= 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 OS3PR01MB9639.jpnprd01.prod.outlook.com (2603:1096:604:1cf::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.15; Fri, 9 Aug 2024 04:23:25 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%5]) with mapi id 15.20.7849.014; Fri, 9 Aug 2024 04:23:25 +0000 Message-ID: <87ttfu729u.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v2 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 In-Reply-To: <875xsa8gws.wl-kuninori.morimoto.gx@renesas.com> References: <875xsa8gws.wl-kuninori.morimoto.gx@renesas.com> Date: Fri, 9 Aug 2024 04:23:25 +0000 X-ClientProxiedBy: TYCP286CA0099.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:2b4::17) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) Precedence: bulk X-Mailing-List: linux-omap@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OS3PR01MB9639:EE_ X-MS-Office365-Filtering-Correlation-Id: a6d344b1-1e6e-4100-12a4-08dcb82b0349 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|7416014|1800799024|376014|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: hO3TwniK2jtjd4K1zlz2D0jq88l+/Qnuo9M+mJDWf9k1klKJr5f0lAn36r1YzMAQMD8EYeUaB6TT97ZhxWBQIYfpQGiQuItoMEKEoG3eK99R+kBY1Rj39Uh8QRJNZ3Aszm6xymSwurRf7ByJJ/vYbgWvB0W1W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z+z4aKwgID2/idsrltyxz8lP+gIEgJd4JHx4pvaYFEIE0WfTq60nuytLuq6D+8A7qr4/kOWv6W1S6Pf5pkxJeljqvAnBcFmtYZy9XSe9eGgFzaAVTlgXjwVoreaRANdRsn2scNx+PzbJIqOMAnQV0PBsJ/tyHXfN7ey925Zi8Pb1X4L7x95BUPjoi+UHuo1u5cZ/HdUhErj+bTA9FyJOQDCCsa/k= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TYCPR01MB10914.jpnprd01.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(52116014)(7416014)(1800799024)(376014)(366016)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: a1nDOUIozb4HP8H4qpodupMG8Cz81wXtg61yXq4ti5ZZjgdzF278aWw0aLkBxNSpVxLgbRE4wE430VKgg7cuQgfhMsHl1Hkk+gxvzjmRd+OU4kAwzdzlp2JGUJFfqjoHWOQcg/rYKdIH8afNjSV6yhKD0c5nXxmhblFyed2KXZrxnL4FQpCbjQpz4WwynUWWfLnBmqPgLF/qHK1OjUyaknbq6LvxKamVkR79+lN0MkQ1cqiyGpsSUc8esKS25H06rz3HBbfpaOBzrbMIrNrf/jg7fFDuEWN+P4c7hwzr/CCaHHWqITTi6u8t0vsAdAHC7ADXEEHBZ8WQA21en+tweJJGpNxJIsutRVBhmtG2fgSG4HBRE4dKl/1FVQP60fLYXw+qAOPZ1zJigVrIMl64x36G1AnuXr6IEsPU4+8TewCQI01Ko9Zk07eXpavWb05H/Lhq0V1J3nHtU1oJWAO3L3n3BwoeUoX4yaqkWUZnsWPBEPO9J5Q5M1K4MNTisKDXoWj0JqzfDaxeUZ8SMRuqmenQIRPp8wnlE6kCUaAxLPewfCtOj8nCAn6PdXOgKSg/T47DKZ21q6Nn30aWwttzuiTND+3+boS8S7nD6gRdS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b1-1e6e-4100-12a4-08dcb82b0349 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2024 04:23:25.9005 (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: FPxlLvGOmbq9AhV4dbWxotOYBoaeQSdkVc6WxERNvqzY6M3lBnP8ch3Zj+TQGgRDgYR4KI0RadKeX8IvvAieOFrWbxQK33qKLrTtc1VjaJDJHG/cHwyRERobtOibDoSE X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS3PR01MB9639 Now we can use new port related functions for port parsing. Use it. Signed-off-by: Kuninori Morimoto --- drivers/video/fbdev/omap2/omapfb/dss/dpi.c | 3 +- drivers/video/fbdev/omap2/omapfb/dss/dss-of.c | 66 ------------------- drivers/video/fbdev/omap2/omapfb/dss/dss.c | 9 +-- drivers/video/fbdev/omap2/omapfb/dss/sdi.c | 3 +- include/video/omapfb_dss.h | 8 --- 5 files changed, 9 insertions(+), 80 deletions(-) diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dpi.c b/drivers/video/fbdev/omap2/omapfb/dss/dpi.c index 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 4040e247e026..efb7d2e4ce85 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..5cab317011ee 100644 --- a/drivers/video/fbdev/omap2/omapfb/dss/dss.c +++ b/drivers/video/fbdev/omap2/omapfb/dss/dss.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -922,7 +923,7 @@ static int dss_init_ports(struct platform_device *pdev) if (parent == NULL) return 0; - port = omapdss_of_get_next_port(parent, NULL); + port = of_graph_get_next_port(parent, NULL); if (!port) return 0; @@ -953,7 +954,7 @@ static int dss_init_ports(struct platform_device *pdev) break; } } while (!ret && - (port = omapdss_of_get_next_port(parent, port)) != NULL); + (port = of_graph_get_next_port(parent, port)) != NULL); if (ret) dss_uninit_ports(pdev); @@ -969,7 +970,7 @@ static void dss_uninit_ports(struct platform_device *pdev) if (parent == NULL) return; - port = omapdss_of_get_next_port(parent, NULL); + port = of_graph_get_next_port(parent, NULL); if (!port) return; @@ -1000,7 +1001,7 @@ static void dss_uninit_ports(struct platform_device *pdev) default: break; } - } while ((port = omapdss_of_get_next_port(parent, port)) != NULL); + } while ((port = of_graph_get_next_port(parent, port)) != NULL); } static int dss_video_pll_probe(struct platform_device *pdev) diff --git a/drivers/video/fbdev/omap2/omapfb/dss/sdi.c b/drivers/video/fbdev/omap2/omapfb/dss/sdi.c index 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