From patchwork Wed Sep 4 06:11:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13789792 Received: from TYVP286CU001.outbound.protection.outlook.com (mail-japaneastazon11011026.outbound.protection.outlook.com [52.101.125.26]) (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 E5F9184E11; Wed, 4 Sep 2024 06:11:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.125.26 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725430287; cv=fail; b=fVGGkKIr6MSnShiOPOkCc26UyQQwnxZL45X5b2+Yba6A0LcHWJYpgZqQaUKm0zJA7Ggt5ro5Rhxr2awxDjS+/2LV08MoJ/6E1EGkPqFhT5lvfsy3l7gjNwZstRbhSzgVV0+UHbBJ60C5T+jAL1iPrEwN3NUWkOs8xRc+wIDf6uU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725430287; c=relaxed/simple; bh=YB8XCD7I59nO2My6IatxQAxPg327eZSrPCEDvR9/s2U=; h=Message-ID:To:In-Reply-To:References:From:Subject:Content-Type: Date:MIME-Version; b=NFEa1yi7Nxk2mU2noIe7Q/95zQb+hQo0NHp/G4K1WSxPOh/EohTmiYKiRauVyU1JV7fWxyDwsChH9ZQR5pLxcBYnsq3fH2A7aZaO8/rkWda3Ppi+zJTsn2pqbWnQ0XOb9nMJfw2roqpgYwnM/S30xQdWp9YcSe6ZExedI10RXYc= 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=ikdMW80P; arc=fail smtp.client-ip=52.101.125.26 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="ikdMW80P" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fLVkT9KSaaE63nTlVLqEAoA7FMvf5DSZOR+uTRBjX+QV6CyeTFtXPUu0WY4Ju9eUWZsyrIgFzjR1kIwDjHyw+bihzFj/zCkWeaRPfE1EupZz8g51UZUKGZ/qKB8WgK6l47afvOr1uSeH1WwleYCglD0qYZjpy108tXSq+BH02lwZHnNo7z2cbosvJfUSo7RW3lnHfr1/eOaOa1/gAc9uXtG1O/1wJFNj6W0gpdC9l/4AQEjfuXTzlfTvBL7pjVS2plfy9jtXzkVbfP0x7iE19FhC5CGg/D1gDBRvwXEkgQR85a0K4xLVgwC2PBGKhQIhcGL2y+Qt15+rk8WUCqifhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zSTy3OP81bOUWiIaiLJlHM2sjNqpFXTV3MWJ/ljI3OM=; b=L4+bWvArbX1XSx1oBp+OEijQbEfk2yT06Iy+bfbMUq9nr9VlLV2VwYuOuN80UzY4iSjp/VGx3ZOM8a5ZkJ4HTI/THZ4DJ1ZdsZxdsv6yujSKdFoGRQ85PCdxsqJkoUd+GrcixTx5PTSPUpwbZ7aIRM3MK4bz14imWVd6VaV5QmX8iy05S7qnKV1uWUbyNygy1Emmr7KHC6BVOmJgqWEUWfwSHWFq/zmWPJH/iRrIjObxAeJUTGRijL0ODE1F90j10/vuRnLneBjPDF/FlILuJiEGuGizQJSr6o3acXy7oT84NYXUqVFZRtaXHuprRfFnzY4QLVjTOMZ0MADb0GRZcQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=renesas.com; dmarc=pass action=none header.from=renesas.com; dkim=pass header.d=renesas.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zSTy3OP81bOUWiIaiLJlHM2sjNqpFXTV3MWJ/ljI3OM=; b=ikdMW80PXzqZKHNSunUbDoTI+l597U34//NP1f4fNqdUn1aJshRSwIPuJuETwON2DlF4l8oz4QoCFDH/G7P/5zVqoJzZUpEmqOH3yHq0+TkblifP4jcsfzHZUW2uDbe8fJGwSJDbZp7hntU1iJmA4SOHWO2be977/S340JlN+Vo= 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 OS3PR01MB7309.jpnprd01.prod.outlook.com (2603:1096:604:11e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.27; Wed, 4 Sep 2024 06:11:22 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%5]) with mapi id 15.20.7918.024; Wed, 4 Sep 2024 06:11:22 +0000 Message-ID: <87le086j91.wl-kuninori.morimoto.gx@renesas.com> 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: <87r0a06ja1.wl-kuninori.morimoto.gx@renesas.com> References: <87r0a06ja1.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v5 4/9] ASoC: rcar_snd: use new of_graph functions User-Agent: Wanderlust/2.15.9 Emacs/29.3 Mule/6.0 Date: Wed, 4 Sep 2024 06:11:22 +0000 X-ClientProxiedBy: TY2PR06CA0008.apcprd06.prod.outlook.com (2603:1096:404:42::20) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OS3PR01MB7309:EE_ X-MS-Office365-Filtering-Correlation-Id: 530330e4-4eb4-4219-052f-08dccca86677 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|52116014|7416014|921020|38350700014; X-Microsoft-Antispam-Message-Info: pi41HNq0ioHBEUdMYKUQfHHe+nChDg/xdHOFroxDB46Xm6Ar5D0Ff657SL1E82AYumMUjNyeK60ZWvcMH6JT7p5xeGtl/UY2voOg9LzlZJV6w4vfXp4SpPlLI3XJCvh+5g9H0eR9WiDNp2XcYWqrBXe+UzqOw9JByb1xCXZ7l1WJCa96lI0MiiOcJiZhfKI9E1l8CAYxDL1RPl/Di/E4x8eipZkoUUNEFuheuTDkqzs2z9A39P9eWDL3Z3r1zeyRaEAFymlTC/9huSlXg9w62yraw3CwjFaar7N3XWq3TKSoszpjeq92fJkewaucajNQEZULfecZNgC0U/IGGNhFuAmlY/722zG8GFFzX5PNfsLckBXSgCqD9GoxHiqiLtXx8iZsu52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.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)(376014)(52116014)(7416014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UJsnxcIx8eBGeNOtLMfAwo/q6RxMjl37Z/pWWkGfZiwQN725W8h65UwQ+8+7ItGbpdIH3uYHjT+PswLgLjjLS/arSuyc2ENarRnGPl9sk6vnqST2UC4c17MvNfSiYEyqNdwxEf+lZBusk60JtZjzv141iviEqdg0+lvGKLMnxr+1qkY+sCcfQpQuScsjZQJ4p92f5YGB4lWYt+f5hSqfGN8o4h1ofgZh1AbnxWjlTuTFGECaIPDC/p28lH2zuf4s++GZDp46TXtiqPxS23L1idwfnzLDdwa6Dzrl6SEXceHQD+TlFMVOc6tNwWTTSHQxqi9cH+V/4nkCTqkSVvFd8Yxi4vO9ZGOcqY0xGUtDo1ZT4tQURtuMMyeIEm07AF0I+OwlCyq0jGWBnc6gpf3z6o1c2dfHRVPbMjWqlJd+ZnPXR/+Ij/aaD3oN6lFZ+PT4yHoPq9ybtAhvxus8k8PmIoAvCRhpC+iXMt+Tm5U35wHokQADt0gkW5F8BrWbX9eNKgdKjXa1zANE8T7aqoW+YK1jVEewVSKchCAZoja6o2J95G0eX2erYJt5oiOmjeT2vJh22MEeIGZmRDjM8q9jgHPOpjdzMLBRsD2kTHFL+u78h9ieHBDFWuiu294MKKuS1TYQCOam2F+c/56DYo7M53HpEJK3bAtEAFq+qeyRC/t74iskyhOGOT8exTYH3pyUxGIHrAHin0T+SafM3xEPUUkAxfVgHHA2fMKWFq6JkZRE562qpSe9yXffmkCZCvlmd/K+rObiTzf32o8UJU/U0AxuxOTcrhevSh150XT0bsfLNscBwZtuan9KEKvYKDBMBqroLVyqV+gGuFJTQtOOqqRLqjw0gSTM21ve20ljIYq2hxERg29qgOn6eSB6OVKAdJr5Iw7GAF3p5ww6r4ZWUQUbcvcyxCtczbN2AqJCfSYvIO+FRow2KsT25/Ut9Gp5PIFVvKpJITSrEOJv0NOSQN3Aoe+Otyek+PGEEIiYeOAQPETfifW6PxqWiJUMVcZ44v9H/fNPrLK+REW0z2WzmgMtC6xBCiTTEYWHtCG6ScWHUwYrhsrxzc+FDrNAWPu3ameXrXt3k/0yjMh9T6X8SQ+CWxYDE31WavUKrTHentp4SEQZ+um+pIU3pRvJOLncDeXvjgag1NAvcZRYsh2mjZkKOxN0pe8qSAjtDZTO+hPv21bvRvw2DAiRRX7Uohdt8IQGwTkc/onnOlGTb9sOrnZZ48b7pB+ewMsPtCQ2VkWlOuSHBnxGtquxjwQG2XG2RS3obaXDK856EZ//yEpyHfa/AKKbqhS/yKS1eUSvorXBDLO1xCvNnj6A9E6NJc5E1D5IBKc6GIXh+ukZMyDWk6nZxC/CLy/ALH5v8xAH7nasLGgIF/2pysamb4W+7iiY0sOl3noZEME4f/Vt/aj9sYcCQad3G693UigKxo8GqNtyN2EDFS8mp0vNpWvESRdMPOfPk0/YEm3lne0Jgm95hamwxPXmCsihDKI9Qlqs88P6lVJ/eo9FhrO6waJo/Q6eToFxDnzl84Hl1UEyL1eUSAv1csy9aLvDHFoX8QZGHTyA3LC+ZNMwgPYHkjY1n/NodH9mVNSASXU3PxHxpNJNjAE056h85zirq1PbZi5O70g= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 530330e4-4eb4-4219-052f-08dccca86677 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2024 06:11:22.6637 (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: VljoUuItcn9EV0nVVS884AP9ZhYX1MLu2J+BqI0FwVBgSXjDC9Qpe+i9w3D6HHjeFg4FppdT+hKk+LqhAj5+dFJN0y2aAqryFddVTbQJTLlcxAMDF/BlbnX6IeczyrLJ X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS3PR01MB7309 Now we can use new port related functions for port parsing. Use it. Signed-off-by: Kuninori Morimoto Acked-by: Mark Brown --- sound/soc/sh/rcar/core.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 15cb5e7008f9f..281936ece760b 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -1237,7 +1237,7 @@ static int rsnd_dai_of_node(struct rsnd_priv *priv, int *is_graph) { struct device *dev = rsnd_priv_to_dev(priv); struct device_node *np = dev->of_node; - struct device_node *ports, *node; + struct device_node *node; int nr = 0; int i = 0; @@ -1277,16 +1277,12 @@ static int rsnd_dai_of_node(struct rsnd_priv *priv, int *is_graph) /* * Audio-Graph-Card */ - for_each_child_of_node(np, ports) { - if (!of_node_name_eq(ports, "ports") && - !of_node_name_eq(ports, "port")) - continue; - priv->component_dais[i] = of_graph_get_endpoint_count(ports); + for_each_of_graph_ports(np, ports) { + priv->component_dais[i] = of_graph_get_port_count(ports); nr += priv->component_dais[i]; i++; if (i >= RSND_MAX_COMPONENT) { dev_info(dev, "reach to max component\n"); - of_node_put(ports); break; } } @@ -1486,14 +1482,10 @@ static int rsnd_dai_probe(struct rsnd_priv *priv) */ dai_i = 0; if (is_graph) { - struct device_node *ports; - struct device_node *dai_np; + for_each_of_graph_ports(np, ports) { + for_each_of_graph_port(ports, port) { + struct device_node *dai_np = of_graph_get_next_port_endpoint(port, NULL); - for_each_child_of_node(np, ports) { - if (!of_node_name_eq(ports, "ports") && - !of_node_name_eq(ports, "port")) - continue; - for_each_endpoint_of_node(ports, dai_np) { __rsnd_dai_probe(priv, dai_np, dai_np, 0, dai_i); if (!rsnd_is_gen1(priv) && !rsnd_is_gen2(priv)) { rdai = rsnd_rdai_get(priv, dai_i); @@ -1502,6 +1494,7 @@ static int rsnd_dai_probe(struct rsnd_priv *priv) rsnd_parse_connect_graph(priv, &rdai->capture, dai_np); } dai_i++; + of_node_put(dai_np); } } } else {