lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250206161831.2519-1-laurentiumihalcea111@gmail.com>
Date: Thu,  6 Feb 2025 11:18:31 -0500
From: Laurentiu Mihalcea <laurentiumihalcea111@...il.com>
To: Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>,
	Mark Brown <broonie@...nel.org>,
	Jaroslav Kysela <perex@...ex.cz>,
	Takashi Iwai <tiwai@...e.com>
Cc: linux-sound@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH RFC] ASoC: simple-card-utils: always find dlc using result of graph_get_dai_id()

From: Laurentiu Mihalcea <laurentiu.mihalcea@....com>

If the number of ports is 1, the DAI name will be the one corresponding
to dai_drv[0]. If ARRAY_SIZE(dai_drv) > 1, this means users are forced
to specify all ports corresponding to the DAIs. For instance:

	(it is assumed that ARRAY_SIZE(dai_drv) is 2)

	[snippet taken from DTS]
	dai: my_dai@...ecafe {
		/* some more properties go here */

		ports {
			#address-cells = <1>;
			#size-cells = <0>;

			port@0 {
				reg = <0>;
				endpoint {
					/* specify remote here */
				};
			};

			port@1 {
				reg = <1>;
				endpoint {
					/* specify remote here */
				};
			};
		};
	};
	[/snippet taken from DTS]

This is problematic when users don't want to connect all ports. In the
above example, we're forced to specify all ports even if we want to
"connect" only port@1, for instance, to a remote endpoint.

Generally speaking, assuming that ARRAY_SIZE(dai_drv) is N, and we want to
connect a single port: i, we'd need to specify at least two ports in the
DTS so that "of_graph_get_endpoint_count(node) > 1" is evaluated to true
and the ID resulting from "graph_get_dai_id()" is taken into account.

Fix this by always using 1 as the number of arguments passed to
snd_soc_get_dlc(). This way, snd_soc_get_dlc() will use the ID computed
by graph_get_dai_id(), which takes the value of the 'reg' property into
account if specified.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@....com>
---
 sound/soc/generic/simple-card-utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
index dd414634b4ac..a592617e1b0e 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -1103,7 +1103,7 @@ int graph_util_parse_dai(struct device *dev, struct device_node *ep,
 	/* Get dai->name */
 	args.np		= node;
 	args.args[0]	= graph_get_dai_id(ep);
-	args.args_count	= (of_graph_get_endpoint_count(node) > 1);
+	args.args_count = 1;
 
 	/*
 	 * FIXME
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ