From patchwork Tue Dec 3 02:10: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: 13891638 Received: from TY3P286CU002.outbound.protection.outlook.com (mail-japaneastazon11010004.outbound.protection.outlook.com [52.101.229.4]) (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 3422B219E4 for ; Tue, 3 Dec 2024 02:10:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.229.4 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733191830; cv=fail; b=Vkh4D1H252INtoWw+JQy7nlEzut1oswTOaEBx11QgJCTNZhpKlXqE7Qqs6cv4PA00IvtkmIhKju1/rsnZ2TDBp/KG0WduNLHUAjjrovL8NIAX9HOHp8olxprZwo5mM1hcusmK8KxQeySX8jyMmLBw54kND+V4JV9Y5Ti1bwP2mE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733191830; c=relaxed/simple; bh=oQ2RHPbt7j77K7Q9wMi8A9SOVGwL+U60HHpwsCxOjOg=; h=Message-ID:From:Subject:To:Cc:In-Reply-To:References:Content-Type: Date:MIME-Version; b=WIlZHbeXP7jtK6jkAf10XaqjxlpL7Z2mNMyln3RpMiKJmUlIqNTk8uuevCCNpkprQ0b601GrO1Bnl60l1Cpxvr0r76kLRgVHr+YhsmXvYfoIpO0RN+/6Cv+fiNgqRaxMdRCC3bKCu4ABHFnMmJgAZW5IJMvieQNHEUS0Tvu9nCs= 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=hXWz0Ml8; arc=fail smtp.client-ip=52.101.229.4 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="hXWz0Ml8" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=y4/tPneCtYboCDt42D/voQJWPPowqOpppeor7R/2JX5D34ieEKRAjkISIuchnVon492ZeeCE/joMOLosWq35T3M5EeldpkWISPcASgW3rZ4nE3Z/knbN+crDtVnrTcxUroTTNHOmdfKCTerQEGJ+7pEf5dn9nFocOmCIhuasjg9O6kbKKOwciqtx9DVZHnYQvJlJP4nWJe/RVXDqoHAqgISoM3h5CbHP4pnnYdSi1rHB5PXUN2wort/uiqWje5BfEvqDLxNtTTGEMKvT+G7yfa0K2hcblEbwSG3Q/19AhDBed626nmDH0puGypgWe5sgvSintpJaukn/mPCm2i1uoQ== 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=cFTOYPQUG2ih0Jx/XZtiyIqAMPGdn72wIFl6Gn02lsc=; b=hBkHSbzB3/z2UvPmyJcBFtbruHYb4Xq/owojJda5BYzTGHbAq/IgFmIa9ONxGLS5htd7B6hHs2VFULShfTPXr2LaN+ixli5tkPpop4uakBQYyiJ/tGBYFdCXFMT3hVAkTRNwTAMGYSxCNKvg78UZ09SBbz8lVqYlv8vYUGwvJAB/KKHcAU1AU3tD01OXAJWbwpLbtSFaL0ed31zcEpCZrRA5tHkVSdpczylxuzPzYm1eA3e1/UekjjDN/HcXFeWHOYddkVlpETks2Tm+kVQls+Z1n/PGjhFpOFbITL1JG6XsSPVFitAS22IOYGd94uY+wxv6aYhjlmKBjJ7w9V2YgA== 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=cFTOYPQUG2ih0Jx/XZtiyIqAMPGdn72wIFl6Gn02lsc=; b=hXWz0Ml84nLqQCmi1LBtMtwwIWSRUSEZbeTg69Vqqi05JN40eV7pJQ8Y6m6kEgyZb7IosAjxltah2VKTDvZsRPpY2XWZkiHcnoc5+8T0GbyJOh7xjgtHZ1NIntJKmPFQZVPAWcFzXEAGphK6xowuCyXI9rQfEI2KtNoydSKjFsY= 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 OS3PR01MB10407.jpnprd01.prod.outlook.com (2603:1096:604:1ff::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.14; Tue, 3 Dec 2024 02:10: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.8207.017; Tue, 3 Dec 2024 02:10:23 +0000 Message-ID: <87r06pfre8.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 1/3] ASoC: simple-card-utils: use __free(device_node) for device node User-Agent: Wanderlust/2.15.9 Emacs/29.3 Mule/6.0 To: Mark Brown Cc: linux-sound@vger.kernel.org In-Reply-To: <87ser5frep.wl-kuninori.morimoto.gx@renesas.com> References: <87ser5frep.wl-kuninori.morimoto.gx@renesas.com> Date: Tue, 3 Dec 2024 02:10:23 +0000 X-ClientProxiedBy: TYCP286CA0041.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:29d::16) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OS3PR01MB10407:EE_ X-MS-Office365-Filtering-Correlation-Id: 403e26d8-9068-4398-c2e9-08dd133fa582 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|52116014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: eUuOlnsmMurmGGSOtVej8l/Ui4MdZrHvjnadp5vJH7hTn9XckMkgIrKUpfaRroiiHuNO/AmVPN+pAjQYeo6LHv+yklD2hFuvrmAp7OcOMD+w/jhAQiynZEeiQuPY63jDnz+7D6VNKisPMXNBuSo0TXMR99y1RXkAanF+tFQaZccUookFPgeLMkfNpmk/8ov2nmDcjt9grgQ0slV4xHmD+Sgv0PRpy2W+K7VM6LvJPTbPbrXbzzNkhwE0CWRXUBWB7ZdrrmtIu+uzM4wgXUr3k3qHhco4T6DuYINRvzjC86J6vp1hIv6hUh7m3rkyFT3q4GDtoGKNpvO4vDLEsWH0iv2w/OYzIxAGTHeCrmpWXbsIh0lR5529xbjVQFmm+XnkcZ7+QH7S0zPz9rsU+8Zyr7lZOeZIWG6PTX04JinFb8QYD1E96JWa+wJsv4fGNeODZs7ZMLs1pJqQs7AqsR9wwPffSZh84RsoWovO/kTsv5M4gSgEj91Sk51VaAcVaOiVE0HMyZLuihGNIfh8gYTjhL2WAKJEDjajXhayMqJHwTJZtCcHl/JBVeLGsQUiblj1OtwPe4MMDGBR779erm3nP5n/x1uljqRDcBgkRZ7a8LJkCVpzRLSoCg56lHRUGOMouAbhnZJWnA3DehuMg2aR8VwEP8OswSMWHMLJ4N42IqdyyU+S4JLbdtCInQKnON/qeuKh9e/VNNURN6nr8J/fyEU8q64haqSJR4GGkAQr1hVzUk4984Gu4k6wAqBweziX2bctF+7rqt4n29DQ6Ej25p2p21CgdXEPkg5t60YGGVNowOH1hfwvkmnBhpOugJEupum9brr/K7bqUuMPEvURzK07XULXv0fQdzA0f8XQQ/09M2Jx1SlPGxFEsnPoRXYRLdcFH+hvh1bae1fy1iB84HEcBFlN/97G5jU+EpPNFYNCGLlfvRP8nqh7gXjl+pOKTu4djZwdkR3qtAT/iX3V9+VMoLxaXq7hbF0jlO0ZkoKPsW2UMeJzJewpsOC6oa4+468oGtsWmyLAOqX8m7byWVSnAlbfKbx5W/zj6L1+FbAr2Qrs9WLihFjwwNErU0AwKaq9HXFi5F2BZLVFBg56+MbmOdHk32Xbw6eYpeO33bGJ1rgxG/XQwQsUwc/FgD0NKkIJ8AMl3/Z2OG/0VZM0EZaQny/kIZ+qLAkUZjVh1ORFrY5pGVjI5p0IHuBy+AkxWfNb3HSHAqsK53RjgcPQDanpvsCnvpfkRVzhu5dXNytzTdp1yhaJgA1hz4nXm6H00vY/YKpXQlHtS5QVIhZZ8u4syLy3pzTGjmOuO2nHKtQ5hd77+Hpt6VcJSzo/SLD2SO4Zg4oboWVDjpqlhkRJ/Icqxz+AYrwcjNGynX77MX7gKrWiHUSqoZvErVzxOdYAWfoLgifL9Ky6L2ggXTxWew== 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)(376014)(52116014)(366016)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YkdvIn2RkEc1DEltn8gRveb6xE7dMmAaMNuxbHXPSilU7xhGGQmu2XBqytu5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hgPjb02TVnZzTuQekUmQR8okfloN1BCvluOK3+SocpwgwHLCMZdOHpuFBLMIFF3LFpoRpA099BeFv6EQJ+N11Iqym4o9COIgSGyVIelRIRcxMIUZrFsAmribF2cBt057e81kogQcST+ygYfON9HayzQRCD0wdQkvzqYFBr40PTV1kPAP9Ztrk1TdFkVfkM4o/6Q+TK7iFQFTnU2GOdM8hFw/Y4FMFJYAtYd1jcc5if/52EQqUhB8ksbbQXMQkEIeIAVX7mKS8dJlVJB00rsSCu32fRXCtt5DwnOxOYBhvSS8AXVUMwY+8GkTcNAxiya5G6qgA+P3pjW5wMV8fKP7McF67l7UKzCnk/Olwrw1maBZlbDdX9kZqVRkUTbPCdM/qhYzWZNr714jlPT3WdBKLCYwUpLKPs9IQUAIY5uIQYD7qlP4A1vqUi/Vlnk82OCDuLt7zBqLqfwnCSxIhESOJnLeOt3zAu0rb6mx6EPTKAyDMay2bpv9DWx4Dg= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 403e26d8-9068-4398-c2e9-08dd133fa582 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2024 02:10:23.8437 (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: oAJ5aD5zO4+XEs5anSGgbVMH+Q3CErainaiZLrL3ZJP5/8GSm2KnSrB9gg4jpkq9JifiO5YH+9A8rKcFegSZ+q0xlySgCZCgZxU0LnV67rqm3JIFlAZwx77ATVcn+qzk X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS3PR01MB10407 simple-card-utils handles many type of device_node, thus need to use of_node_put() in many place. Let's use __free(device_node) and avoid it. Signed-off-by: Kuninori Morimoto --- sound/soc/generic/simple-card-utils.c | 44 +++++++++------------------ 1 file changed, 14 insertions(+), 30 deletions(-) diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index 24b371f320663..d2307d135931b 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -1005,35 +1005,27 @@ EXPORT_SYMBOL_GPL(graph_util_card_probe); int graph_util_is_ports0(struct device_node *np) { - struct device_node *port, *ports, *ports0, *top; - int ret; + struct device_node *parent __free(device_node) = of_get_parent(np); + struct device_node *port; /* np is "endpoint" or "port" */ - if (of_node_name_eq(np, "endpoint")) { - port = of_get_parent(np); - } else { + if (of_node_name_eq(np, "endpoint")) + port = parent; + else port = np; - of_node_get(port); - } - - ports = of_get_parent(port); - top = of_get_parent(ports); - ports0 = of_get_child_by_name(top, "ports"); - - ret = ports0 == ports; - of_node_put(port); - of_node_put(ports); - of_node_put(ports0); - of_node_put(top); + struct device_node *ports __free(device_node) = of_get_parent(port); + struct device_node *top __free(device_node) = of_get_parent(ports); + struct device_node *ports0 __free(device_node) = of_get_child_by_name(top, "ports"); - return ret; + return ports0 == ports; } EXPORT_SYMBOL_GPL(graph_util_is_ports0); static int graph_get_dai_id(struct device_node *ep) { - struct device_node *node; + struct device_node *node __free(device_node) = of_graph_get_port_parent(ep); + struct device_node *port __free(device_node) = of_get_parent(ep); struct device_node *endpoint; struct of_endpoint info; int i, id; @@ -1056,13 +1048,10 @@ static int graph_get_dai_id(struct device_node *ep) if (of_property_present(ep, "reg")) return info.id; - node = of_get_parent(ep); - ret = of_property_present(node, "reg"); - of_node_put(node); + ret = of_property_present(port, "reg"); if (ret) return info.port; } - node = of_graph_get_port_parent(ep); /* * Non HDMI sound case, counting port/endpoint on its DT @@ -1076,8 +1065,6 @@ static int graph_get_dai_id(struct device_node *ep) i++; } - of_node_put(node); - if (id < 0) return -ENODEV; @@ -1087,7 +1074,6 @@ static int graph_get_dai_id(struct device_node *ep) int graph_util_parse_dai(struct device *dev, struct device_node *ep, struct snd_soc_dai_link_component *dlc, int *is_single_link) { - struct device_node *node; struct of_phandle_args args = {}; struct snd_soc_dai *dai; int ret; @@ -1095,7 +1081,7 @@ int graph_util_parse_dai(struct device *dev, struct device_node *ep, if (!ep) return 0; - node = of_graph_get_port_parent(ep); + struct device_node *node __free(device_node) = of_graph_get_port_parent(ep); /* * Try to find from DAI node @@ -1136,10 +1122,8 @@ int graph_util_parse_dai(struct device *dev, struct device_node *ep, * if he unbinded CPU or Codec. */ ret = snd_soc_get_dlc(&args, dlc); - if (ret < 0) { - of_node_put(node); + if (ret < 0) return ret; - } parse_dai_end: if (is_single_link) From patchwork Tue Dec 3 02:10:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13891639 Received: from TY3P286CU002.outbound.protection.outlook.com (mail-japaneastazon11010046.outbound.protection.outlook.com [52.101.229.46]) (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 190BD219E4 for ; Tue, 3 Dec 2024 02:10:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.229.46 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733191836; cv=fail; b=CJjIc1S9eZ8I5s02fN6kTE1XjkBo5y6fNPVIF8IZ4j8SFchTYjq+5AuqyJP6i1xMM7fq9Jzv/2VCDP6w3Pnmm7bmYeHNNr7qzSuKQxqiJmU9aUpRz6pn/aND5VGDpCnPyeCSmR+IdQRFFpD7GEH2C1nB/cg+0tU6//drN9VciFY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733191836; c=relaxed/simple; bh=rhgGdOwpYnXtHSjgCcIv/krgL6IM3SZdS1aQ+wo8c18=; h=Message-ID:From:Subject:To:Cc:In-Reply-To:References:Content-Type: Date:MIME-Version; b=iZyyCeRn+KvLTvlVP6iiTRv/u2I5+IvmY1c8rIR9mdRlQP80pHIcNp0SeUqrHJ1rZPNGDQxl8qyZFzxVVpfHSCu6ZyL4VLGoFZCvs7w1paftuTtukOJEBdTRLBbroRjy7bnjl/jrvErYRF5TyAhgrBL4WJZshmJA4EBsD/hkLkg= 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=RduDpzEi; arc=fail smtp.client-ip=52.101.229.46 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="RduDpzEi" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JQts+bOoyaTbxw9gwiDe4TV3b82nYR0vg5G/IBCxj+8qt9eQCEayGsDIokXeq/Usvfej7gb0hx3MCEAADph8+q16TJkVr73g3AP01hmID93TRWRrq6Q36b9DQHVu2G4U8Ahh8gbGj7HvVatGtoLSeEEf8oYja3CUuqGiyOmdbtD120Y/FUtlSOHQ2P7WyemxOl4HyZQDkfGtIPXuNY6jxZfrF/R+sHGMghgWxPYqUh0Tfq585JvJhyWoCS2dpyIiMqWFI6PvLuB2NUT0upAv7Ft4yBnIHIp1uw/UKWmSiLCXK9fVKThRfQ9TYs0DUOCNaXzI5hqE+KU0f+gR8+xsVg== 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=u/jJ/9ZqEbkCZzFLoIOvC3rXGBbT0V3nj8xSGJfemyE=; b=tvk70BLd5w3xNsZb4wnK5BT7ttgkKj83xIYEBnatrAO/YROyTI5y1fSd9Ssblv6rxVZKx6ocPoeMLgcedjInh2RYDNJKUB22lnskPuwfyWvyGpE+YuCC6UMazG4ZSFuayF7ffuVi0mW21ojfzLped5+4B1d3phmI+RlDnnsMQWv7cz84+Y9MOge3b4j1lmHqPMbX3DxGH+wJRe8uamLav41M6OrZJosVrCTvBG2JsyXtB/fecxDaUPBabzj7VVOrJYft+5R49V9FFvS/F0TvXyDQaREC0NMhit6P5aakApsR4OuK2NROSSmSI3Tt1BHjYiizbdYYdr7bYxhtJp2XSw== 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=u/jJ/9ZqEbkCZzFLoIOvC3rXGBbT0V3nj8xSGJfemyE=; b=RduDpzEiDhfV7VdmWMCC/op03EiBPg24+oQk5HeLkFkyJIeDobFl9qMiyXWDCDfsnVlUOZEDw4q68DI7TOTv70itQkIjYl8Zl732hkZmNX63rzGqiZbchMA5J0GMetNOmyiPHc220/E6L5YVdQqkKzHYco7d7Un1c+dkGo1Qkks= 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 OS3PR01MB10407.jpnprd01.prod.outlook.com (2603:1096:604:1ff::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.14; Tue, 3 Dec 2024 02:10: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.8207.017; Tue, 3 Dec 2024 02:10:28 +0000 Message-ID: <87plm9fre3.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 2/3] ASoC: simple-card-utils: check port reg first on graph_get_dai_id() User-Agent: Wanderlust/2.15.9 Emacs/29.3 Mule/6.0 To: Mark Brown Cc: linux-sound@vger.kernel.org In-Reply-To: <87ser5frep.wl-kuninori.morimoto.gx@renesas.com> References: <87ser5frep.wl-kuninori.morimoto.gx@renesas.com> Date: Tue, 3 Dec 2024 02:10:28 +0000 X-ClientProxiedBy: TYCP286CA0037.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:29d::12) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OS3PR01MB10407:EE_ X-MS-Office365-Filtering-Correlation-Id: f4d095eb-8450-42ff-c860-08dd133fa839 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|52116014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: 5fRf/ksKIl1KzYq9usFkrkqoKWcNxHaXc5JSehi6aXAdgOuzRwCnXl5tLHr49D8AZ0xFZz7AE4mCKgTqVLJOlMJ2MzvaVxUGx1P69/APH7i4giBEC07RkFzoAmDwj53nmDs8iZMUUvlBCGGVz2ozDWwaJ397USt504EVeyzosDcIwM+serQyxIQcKppMiYvdhqfokK8JvsGkcbQ6I4V8NJNolyBKwj/MFELS9pQCCsGq+bckSeC45Xw0fnyZ4W5uyjAD9Vcb6mP2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EHjEuX0iD+Zlarrf0rfCuUyWOKTyOyaKM8Nn4NBgNhMVKlAb44mlI3FtyA1DFu426hcXnjgey4kYP98Q== 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)(376014)(52116014)(366016)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cs4hUVBBU7hoNTvLZ13f+ESaFVUaVVqtUgvToBb7/7kPnqzli2fGQ26c/9TIlN8seqlP31rhS6eaY7RxNo75NDpcSLaALuhDuAlrhSmu/tPBrUyRfgzFXIb+tfsOY3FM2hlJOprL28y1lDPcFZiQQSD7eK1A0dO2ZaSosw9+vb1HXnJEgYIzkfdMfMbtLDmpbc2DHEBA2pv2zykurwaK2cvQrMqYEyhiHmKZkZB1lfWPalwGzSaqrJ/HrPJzb/zeDyEc7yc4RUDhTLcGibFnHUsejR/3oOuoFVi1pVFQAvBTriFN2G5CebKEbMilnt5UxhzZhNsjjvv+wau5PIxRacOqiyrQaD85ryIM17EioasBn+7JEBoq+/+o14X5/tpj0STj3B+0fv+CBfrz6jlNwUScB7+zWhC2BWJ6Pv6oGiOj7+TkTcX0sAraeJaEwUJwYfrQz6LUjfJDYuMt1G2by4vBq6PmVuUisWBxByR1qK+TtktOPi33li0Hbn1i84RkonESPzIhuCNSPU/IcbPOsJfZa7Emm4+30oGM/vgRa6KK0dy4Q/p3C6dk8egMGcwynznV0qwaqXZKboUdr9WWaMgQBTx/6jIWV9kSQcIVPu1gQohKAiMB13Z5eX3ch3tnEw2hKEmNaOEB9ZyAUMlZkXpnQ9JZR6kL6ofxfIKnJQ/94XlGZBR3dCls8Za3OyX8vS+yEsa7T/kVlCiAHJwiRnqijA7Q1/7fFM9pstpaY9zcNC2U7ErXmFRpQHOWdWchLjiwt0KRbiNoJgf7na10xruF9J4kiBUwN3A0R80NRpMy7qUQvnVvUYb6aPFiwUEFk/WcQe7+U/nr8L0SW6p4XqBlCeTy0XHKw2BjqC1CWPQ/sZ9Nzj+ITNj+2RpHH7DDvxH2J4rnMhswah2ZuVrMK3ZHvIxjhlZlWD+qor5dgRnfhDgFbM82z7s6SO8ItHLhVD/jCEiu9UyxepPPHsS6t995jbukC2zvKqF7zr8PQwF6snqBjcI+Rnws5xA2sc2zeewBErtYVMcwhC4CUNdud5whX6YQKeB0Hd0T9h7/TwUG/xQKXtBv5IIIiA5kENFJZrzj4Au1gwC5Y+SQGiayLYH1cukOWXFXNWKx7PzmyehY9Cu4hnapH39zcToWcM2wAMHYH9tNlNT6WUNHZr0yw9gfDGdlZEFeDY6pS2wfeCDKKrf4/dRsP26arlYF2C0z5ZxDFzCJQN5JC5iFPBGe3osb47fAC5Zmwdq/6Ti+dYaPY3LX1A/S49H3p9WGFDkqGwb0R9IzigdQABqAHFqzLxb3Wdu4kbCNFcxvmOW+hIHQwdIp0FDjZLEA3UkJAYBDh3reSMuKwzfVxql3p+Y9G+SjoHEIBQrdA4aF2P5eWaDVMqmWkZCzCKW8UJc3VuuUucdBHxZy00mODG7QyId9j6s/sIWaFXAbYTMdBJXy/oVUkkRJ45wdUVf3Hkt6mnJS6eEYcU2DjQKorjr/bPUxdabmK7hk63O3Dnq8vPB+1XpX/MZapV6jtJiZICWVlJ/JWEVV5IJg75GmmJUgKktSjR3QkiBd5+4TIQ1rQts8GgLNeJRkw8ChtYAFC9mTcw2AqWSBFoF1Tf/ri6syjhhif+fMMgOSnlWBwqAQP8lHMWQ= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: f4d095eb-8450-42ff-c860-08dd133fa839 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2024 02:10:28.3572 (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: O9cuozm0Pe4oPy8vbduHTswfQq6DmMLG+Lzo7rJS0D56OdvFIOkfMM8T7tKXqvXiEL9bTrmkx+QdJqoMKW79ooxR7/orcPsG+EwRLq5ryOfFzwE9arSwOAk9R+rpONYc X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS3PR01MB10407 Because DT check when compiling become very strict in these days, we need to add reg = if it has multi port/endpoint, otherwise it will get error or warning. But it was not so strict and/or mandatry before. Current code uses reg number as DAI ID, but it will use "endpoint" reg first and use "port" reg 2nd. But it should use port number as 1st (A) if it was used for multi connected case. There is no priority for port/endpoint if it was not multi connected (B). case (A) port { /* * "port" and "endpoint" are using different reg number. * It should use as DAI ID, not not */ reg = ; endpoint@y { reg = ; ... }; endpoint@z { reg = ; ... }; }; case (B) port { /* * Both port/endpoint are using same reg numer . */ reg = ; endpoint { reg = ; ... }; }; It will be issue if Audio-Graph-Card is used with Multi Connection. No issue will be happen with Audio-Graph-Card2 / Simple-Card. This patch swtich port/endpoint priority. Signed-off-by: Kuninori Morimoto --- sound/soc/generic/simple-card-utils.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index d2307d135931b..f67a1e58e821c 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -1045,12 +1045,15 @@ static int graph_get_dai_id(struct device_node *ep) * only of_graph_parse_endpoint(). * We need to check "reg" property */ - if (of_property_present(ep, "reg")) - return info.id; + /* check port first */ ret = of_property_present(port, "reg"); if (ret) return info.port; + + /* check endpoint 2nd as backup */ + if (of_property_present(ep, "reg")) + return info.id; } /* From patchwork Tue Dec 3 02:10: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: 13891640 Received: from TYVP286CU001.outbound.protection.outlook.com (mail-japaneastazon11011062.outbound.protection.outlook.com [52.101.125.62]) (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 BDCC7126C16 for ; Tue, 3 Dec 2024 02:10:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.125.62 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733191837; cv=fail; b=r++gPRe9Bm7JoHgX8BQhR1HOG4Mdti4+WOlCEnyKnI/hAEFxuz4X2lYOO9zVI+CoRDDluprVTfk/AR31Ft+tLICtLDd31TTY1uKDcwyqo/RLTNucrMa6cB3XD2LiSAkbyCn1LVblpx4nKzK9q7XARjPw1t5pYWQqSsv0AgM/TSc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733191837; c=relaxed/simple; bh=Zen84/cWsFr2aNgHwBZrT5PR9aS8iPW/b0BhqwRibGg=; h=Message-ID:From:Subject:To:Cc:In-Reply-To:References:Content-Type: Date:MIME-Version; b=Ki+9gmXOPAZQocwKtGwIJlx6XnZTWL6Uz0dW3fTKTRMsC3PIL+WyiDvfvqhqEyUF8Q3VRcyESLGFTIKONK+p4L+dsBoGwIeTuC9+bbZAHSThk5+61QFUCVnl550L3U52UfPctJ0wpDUBT5zdFZ1k6PYqog9EUUsi2t29ls5+lX8= 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=LCYSJOvk; arc=fail smtp.client-ip=52.101.125.62 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="LCYSJOvk" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ex3PymQnJX+jylcsvbonohbBThftn9p/GD/FVM32IHcIG7E6ugmYme7kZaY6VB1Dsq/10V7O1HnkCbxctR47zMDyPB+GVCkHZ+1dJJNmDtH0bcF9TdVyHdSVCverUwnBB8P2gby/OljCs/DfAITDM0fBeWBGSY2Q1JzdpX5ifVCMSvoad9I949yUxiKLbixjn+L+1ao+GKiAF3rTG7Y/WMvNyQ1QGEPCV3rzqRutk9rS8s8+Lygh0vxofU7qYKqWKrGXEsUH9IvjFIbpzcp3sSuZqIHW3PaEl0lLpx3VvhA3X8Lc/boGmeKg+kSogLolSIle1+Q/5ZzS+2yTJfqtNQ== 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=ftbDbBMxfzhNs4aqJ4+HazyW/PeW9B7DfWlraZopxPk=; b=qzMsZRycLjtEsxZyWWwxieEd7bq+N5/V80jdPq7/nPLrdO7BawwqBW8VfpzCwbqUtlO1J1NOV1/7OMAKFHdbw7utsxKY1Z9++t0u/tjhVKId9XysTY1+kGbLDcbEzPrJSCAGyoLmR2XavnurClMfI/1QVGR1kc4sm41S1LNUR6J5IhO0yGm/9tQqKoaXr8t/uHqtFNn+4yJ3/SP5zYRWhEY2/3Pyr5D+SVZ30eJ48xgZHsIYfNxYbcXJ5Kth4TT+f0I4yfygVifDeMKg0bJIFE7sigkXRFT8pkvSLXzJoBSndj516ZYVDbRDTusZpt04vzZlbiRv9b3O/CNkWSBO8g== 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=ftbDbBMxfzhNs4aqJ4+HazyW/PeW9B7DfWlraZopxPk=; b=LCYSJOvkR+IjNkbW5qmqkC8n/sKz0DTK2vtqlpatWiaKBXF2VwQ86hJk788ZJBHE6H1QC5BakFGkCsn5eqE2HMicQR6Uj2h8LmZ/AidTFypT0HgOX2hbEe/HyVabahs26fRoBPvidWlp8ekeixxn8Z9DwhC34iT7FutC38cEPkQ= 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 TYRPR01MB13047.jpnprd01.prod.outlook.com (2603:1096:405:1cf::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.19; Tue, 3 Dec 2024 02:10:33 +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.8207.017; Tue, 3 Dec 2024 02:10:33 +0000 Message-ID: <87o71tfrdz.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 3/3] ASoC: simple-card-utils: use for_each_of_graph_port() on graph_get_dai_id() User-Agent: Wanderlust/2.15.9 Emacs/29.3 Mule/6.0 To: Mark Brown Cc: linux-sound@vger.kernel.org In-Reply-To: <87ser5frep.wl-kuninori.morimoto.gx@renesas.com> References: <87ser5frep.wl-kuninori.morimoto.gx@renesas.com> Date: Tue, 3 Dec 2024 02:10:32 +0000 X-ClientProxiedBy: TYCP286CA0241.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:456::6) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|TYRPR01MB13047:EE_ X-MS-Office365-Filtering-Correlation-Id: 6a4a18d9-20b4-4e36-0c41-08dd133faafe X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|52116014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: nfwMUuDivA4yuSSbGn96MA9WRHPJbZqMZZnucARrnM0r0QI2lHhMNl091+W0TD74M6K7Dr6/9E272JLBdhktGg4xgw+IIvjVp2E4uQ6o+u7AcByrcR89Xcbj+gGkvzPk5HYi4v2sJWH/Mj9vx4hIeGJKEeEmm8t5U/6NvzVP/FEohMFDGvTWcs8tTJ4GeSAWLY5BTHvIz1rZ095WTwm0NqNWAajoHyjrEPCr1fyXKW/CuTTeDO1pia+0UPQgYPRI7brB4XmvSjKWK9s78A8bxwPzbP7MsL7OW+Gu7caE2pdGXP6t60cJVDu/RwlC/hHSPmgz+oMrmTHl0ZlDXLvbLxQ7CUtk6cmsolu5zHTIg78h5mJNJIFstSIB5X7r4IcM0CulL7ewEw+YmOcjUogYRiF2MTROgAOiYdFCIrQCTmcGeygSRzP+eC8ZD9vxUkl+/d8emlMWZtYHV83obKnIkKd5SBhGSoKiaCWE2Aj/OW0J1rRu3WtDkvyYkptiecGs1ezTHzvqIqyvmlY17ouGDr3x6jd+UiksO5JKeEVo2uan1cC/uDC3QDraMD+vbF/EBY3ZW8hcTFuo6lFbZ2gV0VQCiMeWrZTfX0ZVdqoMicuzHTYeNqsQygYJVrykj87uFMMt8WRZ5Rkb92Ch9CEF7f7Q07RtmtCpdpzt6yPnMPspCJfEJzsvLfb7IPV219H2vANGTkyNpBchZKoiF8uZ7ciBsRDLmLjIqkHa5O4WV747uQKoc7ht7kW2W+HYAGL7AsfFkN3i2dtLAaFT6BBIqij7ffh1D7B5ESmVsjpsHkIPk3lQ7BumLcKa0jlHX2E9Okvi5pJk6ozbuxIVTGkC2Lzw0cATJfnH7yjS6GR5PsoT2fktoSExkDwlmz6h6hYXC3GdIjDkbyuNrnHSpBxQmbWXLM4brnFu6OSiB7jYoOxh6s/oetyxhA2urwo0OwhFdTQRcliRCLhh8m8AtXpHbt7JzaZsjszWXROBcHK61ookdn6zG2AghjwvHXMN6Z/B4leObsCZqyIY8Fri8XY3DNrOE0YCQ212G+ZyhSS0vICkTv/nWjaYaeXaFi6Zvmq/TsWjY1U6xxPuPpoid9O9sH4W0yAOb+VRnbWvZHqrU9Nn9aEPL74SddehS8s0EQcsSQ+SoSEFWSZXUwqx7I7hzSU1nP6r6HfF9/d0zn6m14e/reJvSX8d1PLYkEraJYb/VB8njQzGd11vscILQxnvGu9nqb0nwcDtCOezhhS7qZmZb680uOUqcJZ256AQ8zzqPWzJ3vJa8HH3KtLeOtICKh73SPsVUZdOG1oXiYIYuyfIRYyfLl+dZcIIahMS602ZEfZqWVztrXkMVBfbGExT27iyuW3zEb4Z+M+qMFl4CsYuT6YeRznvwN8lE2pShHRoSWlqgNDT1vLRzBlVSXjH4g== 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)(52116014)(376014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: LTVo7VdZPb8FvqsbQU2ksCtBCF4UtC65oFvvVy6oxeLtM0RL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Aj/IqWwx7GNhlkvtihoHEKukb8t3hQOaxBwM+eVMh6x9ZGlJYkecvKxcZoRqhXKJx7kT4ax3x19VnDZEp8LZno5yxWdH/QjhROw0CRCCP6723sAchGRPFt/JA2re3phlHJRzY26mBpYzzw3WXJHp81Yh0a4Fjv9M982LQHwl96IxVaCaA+zFrvTuy69oosPxXcM203AufW5xbasl+TnBiAloPTXH3ZzaImPT/Vcxipy5P4qqiazXNVvzWoKhtnzHZFJ2uH87nCYSVByHups0QWg7ylx1OvJylKl0blM1Lnner4bLU3FWAEn9NNkG6W2TVvXP59GHMngnMf+jyiG3jvO6L1xQSjUBZ2/mwVuYLZwU/GAjoqv5Jg2s7h/nm3pMqhHGt5CAEF5HnTa95Ar88d4vvPLlROOYjCQL8ePhG1iUwSB+8IoihaBru1d3UqzteuSpO32TSlpNMvPzjI74JwxQItPBUgX+pWyXPWkTXtgZFtu71t7RKPwclXTFgTC0kh1/NqQg= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6a4a18d9-20b4-4e36-0c41-08dd133faafe X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2024 02:10:33.0413 (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: 9qUg06GfCpXS9woUqNHGaOol1d4kb51p33Ju0O4Y9OMgAJWOYNgF3k9QhaEbama6wPAsNAaZRpEZ6M7+umIM/wwqRXgVSmPgNMTDV0tjh7Py7diF3cT1uIVxFEgp51fv X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYRPR01MB13047 Because DT check when compiling become very strict in these days, we need to add reg = if it has multi port/endpoint, otherwise it will get error or warning. But it was not so strict and/or mandatry before. Current code is counting "endpoint" to get DAI ID, but it should count "port" instead, otherwise strange ID will be used for DAI if it was multi connected case (A). There is no issue if it was not multi connected (B). One note is that this code will be used if neither port/endpoint doesn't have reg = property on DT. case (A) /* This should be handled as DAI-0 */ port@0 { endpoint@0 { } /* It will be DAI-0 by endpoint count */ endpoint@1 { } /* It will be DAI-1 by endpoint count */ }; /* This should be handled as DAI-1 */ port@1 { endpoint { } /* It will be DAI-2 by endpoint count */ }; case (B) /* both endpoint cound and port count are same */ port@0 { endpoint { ... } }; port@1 { endpoint { ... } }; It will be issue if Audio-Graph-Card is used with Multi Connection. No issue will be happen with Audio-Graph-Card2 / Simple-Card. This patch uses for_each_of_graph_port() instead of for_each_endpoint_of_node(), and thus, we can use "break" to quit from loop. Because for_each_of_graph_port() uses __free(device_node) inside. Signed-off-by: Kuninori Morimoto --- sound/soc/generic/simple-card-utils.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index f67a1e58e821c..6c5a1c5a6b3b2 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -1026,7 +1026,6 @@ static int graph_get_dai_id(struct device_node *ep) { struct device_node *node __free(device_node) = of_graph_get_port_parent(ep); struct device_node *port __free(device_node) = of_get_parent(ep); - struct device_node *endpoint; struct of_endpoint info; int i, id; int ret; @@ -1062,9 +1061,11 @@ static int graph_get_dai_id(struct device_node *ep) */ i = 0; id = -1; - for_each_endpoint_of_node(node, endpoint) { - if (endpoint == ep) + for_each_of_graph_port(node, p) { + if (port == p) { id = i; + break; + } i++; }