From patchwork Thu Sep 26 00:00:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 832184 Received: from TY3P286CU002.outbound.protection.outlook.com (mail-japaneastazon11010025.outbound.protection.outlook.com [52.101.229.25]) (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 B331526281; Thu, 26 Sep 2024 00:00:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.229.25 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727308835; cv=fail; b=FGef4i0MKvoeyeFhcBHHlHAoP61JuSc+819u9guA5ilI2AcPcOwvTSOK/I1b60jeZIKv9eh9fntO0NIA2KKrANBrs8LR8db8w26mSKtX4ZEl7gwEpjrNA5ugzDARDc9EOTPPB1nSC18i2ySSSKazJuWsnZ4Cj24xV7Ip7A9hqNY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727308835; c=relaxed/simple; bh=bwQlr6xI0FIZE8QWdAzWP/sRIgrw0iK5iiuFibxw5JM=; h=Message-ID:From:Subject:To:In-Reply-To:References:Content-Type: Date:MIME-Version; b=nRNKODSYVcLafFeyxh5lWKB6nP46fCEQEicrMRQ0cSS/hhIzSCBopXFFyUCrhZKNozPyCZGay/WiBUq5cGP2a/UXXtzjOFbnU6pAsM/WxXKsEhgzbHOhssVho61l3KojWk/oWgMFpyIrmZ8S6KrXzv8svRUCxbc8FXBcDahHS6w= 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=Ri2NY8r2; arc=fail smtp.client-ip=52.101.229.25 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="Ri2NY8r2" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kBE0MfhDbQGM6K9rrZL2dUuUzuaa7tIN0A1evLcnSwFKfwNQSGK5vMq5kXlXsyoeEPZte0NS8tqpClJas81DwDcdwkZOKN5EinfBX2d3MLBD9u9FgjvuyEp/ZoONaYSUXTCwTubdq/2Cz8LMMZQcnssSc29jZ6+PL9zEC2LEKvz09JJ0NlJVT+bUgjmQseEfwAqNogoVuzV2JeVUYbjjqgJzdm4j2Un74CCJEWHAxnnQbLXcOuHCcVRfnz1tN/EaITuQ19mommHsoauujK1lUwWvh0pksldMxgbDCeLsHsbvLHlIPTn6mor+3U48XVVzZveDWRxpH3Z6GGMJMU9QQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=koVj8ffD+8N6zaVVjRYsPwOdg2G8Pn8Jmxpzw7JecKU=; b=zFeUY5lfetFm6E86a4cmcL6QncVWRLr5efRmDKmNbQWP4tCtFRINqpKCGG8/6LF9ZCrhk0s1RlGpVduv/OE2j7SnJeiX0VFVDbEyoPPZClqdC1w11rmGSVik15VhroZuzCdGTUkU3qx0SX7H5t8D20bb6hGymLWTgXfFlf5BXLOkBDoFCCDAS8ueHGsPx5xa6ofPAzV/SFx7/MmXQgwTtBKtErXUlVCc5MYkaMvaWbMXc2viCJLGW1dHpW1QfRsabqxvcS2fcwGReCBJkA0OFM7prsNpUFUrEERs7Ir+Trc0BqjpNm6Yy4EW5QfzYaHpiR52kILlHjemwuIgbY62Aw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=renesas.com; dmarc=pass action=none header.from=renesas.com; dkim=pass header.d=renesas.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=koVj8ffD+8N6zaVVjRYsPwOdg2G8Pn8Jmxpzw7JecKU=; b=Ri2NY8r2UqtShR3PWwhF/2TpUgA/qOyDHvJzt/wEpJ8POhHaX62aXtI87E5JU1N2dCslVeYUZf7UFuQ2u41AdWXM+Y1k6tJ8lgFD0xy3Tyg16rTe9IJaVJIxqCnkpgaN+nv/mQeqDr6USJ4g8mZJB43O1TxYB6mn6M6eQmZyclo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) by TYWPR01MB7353.jpnprd01.prod.outlook.com (2603:1096:400:c6::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.20; Thu, 26 Sep 2024 00:00:31 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%5]) with mapi id 15.20.8005.017; Thu, 26 Sep 2024 00:00:31 +0000 Message-ID: <871q179tcx.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v6 4/9] ASoC: rcar_snd: use new of_graph functions User-Agent: Wanderlust/2.15.9 Emacs/29.3 Mule/6.0 To: Daniel Vetter , David Airlie , Helge Deller , Jaroslav Kysela , Laurent Pinchart , Liam Girdwood , Maarten Lankhorst , Mark Brown , Mauro Carvalho Chehab , Maxime Ripard , Michal Simek , Rob Herring , Saravana Kannan , Takashi Iwai , Thomas Zimmermann , Tomi Valkeinen , devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-fbdev@vger.kernel.org, linux-media@vger.kernel.org, linux-omap@vger.kernel.org, linux-sound@vger.kernel.org, Sakari Ailus In-Reply-To: <877caz9tdw.wl-kuninori.morimoto.gx@renesas.com> References: <877caz9tdw.wl-kuninori.morimoto.gx@renesas.com> Date: Thu, 26 Sep 2024 00:00:30 +0000 X-ClientProxiedBy: TYCP301CA0089.JPNP301.PROD.OUTLOOK.COM (2603:1096:405:7b::11) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) 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_|TYWPR01MB7353:EE_ X-MS-Office365-Filtering-Correlation-Id: d9b3d3d0-0c40-46fe-9e32-08dcddbe3c9b X-LD-Processed: 53d82571-da19-47e4-9cb4-625a166a4a2a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|7416014|52116014|376014|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: ZSJ3lUff9gN7uceio5zBIjRtqFdJUw6RKv7qkv7Wi7HoKEN26O0khECLAZcAGDSA/rUFCGwkjkUGjU1W+d1hQEJhu0sHNiYSW1a+3UNUfPgiXuIbQrF/jrvETXs031FkIqSJ9G5ydmJNAk5BZQheVsaaFJXps6z2CC+xnTi9CympRjZQQa1DhK4ur0Ptcz/rQNXenyXZhVFwyruZIeESAYOqvSzuaJ/rVMkJ6GGjuoK+hxVsYRb3HeT2mZGNSo+a5/vxGF2YrsxkjjgItVvka3PHGZuunNfYeHjo5oWRc5zWJjqF13FrAjGq2XrXOLJBTawxzaAY4ECySylH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7bkyaaKg/zmSaWLw9LcUQu8E/vj82WIMe0J9k33lOPmSs= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TYCPR01MB10914.jpnprd01.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(7416014)(52116014)(376014)(366016)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +6+1ulBT/dI8Lm/6ZAkxYSRvfk74xQWPdmFVh8Peoblz7APHmtsRUXsgISrCG7vZ++yTFWbfU7VJRDqsyOgSBas8Nn0gd8QHWeDjZePkamko3jzD/MHFmKC189KmpeX1JKXz21ZR71XkdDXM02L/7y0Uuv3XxYhRy/OcScNok8ZHOwtqtAX3zKkv1I3BI17cKfkpmUNfv7O1CgItZ1kMaCN7/+WnqfzGBg6Y+qU26jX/je2a9jGED4zcc/n3oTvqJEff9/qKmH+88xNk8FSwm0pslilZVG8q3N0kvW2W71f2BNLJ6pl6lFWLHbybo3LqpaDZl95P4pNyojugJYJKchl7BWeg19VW7LXSHXfjcz/SB0esMyPkF2VRQ86xeAnchDN9s4hf1W0kQ6xTkN1F+8TbCqA3DSSVOAoZshOPlQM9w/XIwGb6GEBvfKs+9mn9UgLxY4Z6Ffr8QzPGUZLXlME8+yLQfT2w8LJ0gciZkFF6eTMTQ7iFSOjoCU/SFO2SwC/1Poz1v9dTg/TF2SEEdLeZBHhWeA9HFKLosXO+wtFAKt8HngjO75UGkBvQ1IcYPrHBlu3JvbIfC/tF51XAuAFfgUwqyRpLwLMygRi3Nnu0T6iP02P5e6jZ4FGq+9KIytS0FAyYGC2YLG7Zc8+sbT0giXRkHke3mbVRd8YvvNZPbeHeAW0rlHs0HwbDNoep/7idq/kPNI1CBszVtLSL792B47iTWC+SDIgfYrUKyHXrtyIq8zLNv9f4Rh9cVYjARM4DKKVIy795J4J+70J7HQc1epHvZTW3slDFsWDxWKe50OlR34CWhIpcx8iNoRjl5HaMnzZQISPLvvaP7o0CUzRQI4N+E6CNnddL4IaE89Nh/v3Z716AzjrLniYFCEMspaI4YiNhIq1iPEXcorUT/6m6gkCF7izzp1PnR2WwjhDrtrLVhEvd5TLnYYSx9WglGttVz+TncbH/4fDTSYnTr3oAUt+16XhxxprXImA9zAWEIk7gxrYUR4oMcqdOdgVAMUfZ1ALGVjt3pPV8loGY/2oBX3E4DdDt+/iEWRKgYgKLHirUxCguhpPyII6e/MXzJhyI7zgsf3sfYzhHzj5GTbnyWeGR3pJR18+g1eMqca141HyvnObu2XpD7g1/Xopokuh8OH+08swecAj1hDN09LZEtO/rClqEHR34Uv72FOy8tBRVFk3Oo+RtpcHksgXkelrR2Vyqp1epf71AoEyw5r0+TZSuW5LG23AKCM09+TXEFrn28coeaAC9PsBW7yZwsX9f7wjAUba4diKnifOa/k5lzohKRlbWIh3OwpmikHfnj/0cCnFs6TkTYX8llr3/EBy9uKzEhTUp0wxqXNEVedqAEhc8qhvQZGcXzTletkKCbaTpbBLYeALPHzM1dUKmvfl9PRv8Ay89OmBvOv9ny+sY9uJxb2y5Nwdu9nfRG8iVAA/wSNXcEIHQ9jWTFXpRfTvgU1kMXspEHRpU4rLRkQboHkhXCSe3KPiXYtM4mNnwWqYWCx6HerLEOiE5e/GKYfg98N1g+yZ1YLzHtWrIcfBxUUTaEFCT+pXINpM0FK2mufB+B/GO7nmuGyBRIKwfesbAG5AMC+QOH9lHdsSd0DKQBEU40gjtjRDE/J/RMwc= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: d9b3d3d0-0c40-46fe-9e32-08dcddbe3c9b X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2024 00:00:31.2250 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ig8VZ/yeawlEm9DAmhkisyHvTyf85/O+JLb2hKdUnHI7Mm8PI2JWZ5uBl9ZMtQwgfcLEF9D2xsbA0QAT21UPX/QzUGkdW+1IaiqstcBbA/ONnx7xlvoozbUSb3MuUuMC X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYWPR01MB7353 Now we can use new port related functions for port parsing. Use it. Signed-off-by: Kuninori Morimoto Acked-by: Mark Brown --- sound/soc/sh/rcar/core.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 9784718a2b6f5..a263e50cccd4d 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -1237,7 +1237,7 @@ static int rsnd_dai_of_node(struct rsnd_priv *priv, int *is_graph) { struct device *dev = rsnd_priv_to_dev(priv); struct device_node *np = dev->of_node; - struct device_node *ports, *node; + struct device_node *node; int nr = 0; int i = 0; @@ -1277,16 +1277,12 @@ static int rsnd_dai_of_node(struct rsnd_priv *priv, int *is_graph) /* * Audio-Graph-Card */ - for_each_child_of_node(np, ports) { - if (!of_node_name_eq(ports, "ports") && - !of_node_name_eq(ports, "port")) - continue; - priv->component_dais[i] = of_graph_get_endpoint_count(ports); + for_each_of_graph_ports(np, ports) { + priv->component_dais[i] = of_graph_get_port_count(ports); nr += priv->component_dais[i]; i++; if (i >= RSND_MAX_COMPONENT) { dev_info(dev, "reach to max component\n"); - of_node_put(ports); break; } } @@ -1486,14 +1482,10 @@ static int rsnd_dai_probe(struct rsnd_priv *priv) */ dai_i = 0; if (is_graph) { - struct device_node *ports; - struct device_node *dai_np; + for_each_of_graph_ports(np, ports) { + for_each_of_graph_port(ports, port) { + struct device_node *dai_np = of_graph_get_next_port_endpoint(port, NULL); - for_each_child_of_node(np, ports) { - if (!of_node_name_eq(ports, "ports") && - !of_node_name_eq(ports, "port")) - continue; - for_each_endpoint_of_node(ports, dai_np) { __rsnd_dai_probe(priv, dai_np, dai_np, 0, dai_i); if (!rsnd_is_gen1(priv) && !rsnd_is_gen2(priv)) { rdai = rsnd_rdai_get(priv, dai_i); @@ -1502,6 +1494,7 @@ static int rsnd_dai_probe(struct rsnd_priv *priv) rsnd_parse_connect_graph(priv, &rdai->capture, dai_np); } dai_i++; + of_node_put(dai_np); } } } else {