<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/sound/soc/soc-core.c, branch linux-6.2.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.</subtitle>
<id>https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-6.2.y</id>
<link rel='self' href='https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-6.2.y'/>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/'/>
<updated>2022-11-29T12:55:51Z</updated>
<entry>
<title>ASoC: Merge up fixes</title>
<updated>2022-11-29T12:55:51Z</updated>
<author>
<name>Mark Brown</name>
<email>broonie@kernel.org</email>
</author>
<published>2022-11-29T12:55:12Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=aeb2e9c4eedc6fed264a51ca2ea17c83984d2a64'/>
<id>urn:sha1:aeb2e9c4eedc6fed264a51ca2ea17c83984d2a64</id>
<content type='text'>
Merge the fixes branch up so we can apply further AMD work.
</content>
</entry>
<entry>
<title>ASoC: core: Exit all links before removing their components</title>
<updated>2022-11-18T15:38:27Z</updated>
<author>
<name>Cezary Rojewski</name>
<email>cezary.rojewski@intel.com</email>
</author>
<published>2022-10-27T08:58:40Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=c7eb967d70446971413061effca3226578cb4dab'/>
<id>urn:sha1:c7eb967d70446971413061effca3226578cb4dab</id>
<content type='text'>
Flows leading to link-&gt;init() and link-&gt;exit() are not symmetric.
Currently the relevant part of card probe sequence goes as:

	for_each_card_rtds(card, rtd)
		for_each_rtd_components(rtd, i, component)
			component-&gt;probe()
	for_each_card_rtds(card, rtd)
		for_each_rtd_dais(rtd, i, dai)
			dai-&gt;probe()
	for_each_card_rtds(card, rtd)
		rtd-&gt;init()

On the other side, equivalent remove sequence goes as:

	for_each_card_rtds(card, rtd)
		for_each_rtd_dais(rtd, i, dai)
			dai-&gt;remove()
	for_each_card_rtds(card, rtd)
		for_each_rtd_components(rtd, i, component)
			component-&gt;remove()
	for_each_card_rtds(card, rtd)
		rtd-&gt;exit()

what can lead to errors as link-&gt;exit() may still operate on resources
owned by its components despite the probability of them being freed
during the component-&gt;remove().

This change modifies the remove sequence to:

	for_each_card_rtds(card, rtd)
		rtd-&gt;exit()
	for_each_card_rtds(card, rtd)
		for_each_rtd_dais(rtd, i, dai)
			dai-&gt;remove()
	for_each_card_rtds(card, rtd)
		for_each_rtd_components(rtd, i, component)
			component-&gt;remove()

so code found in link-&gt;exit() is safe to touch any component stuff as
component-&gt;remove() has not been called yet.

Signed-off-by: Cezary Rojewski &lt;cezary.rojewski@intel.com&gt;
Reviewed-by: Amadeusz Sławiński &lt;amadeuszx.slawinski@linux.intel.com&gt;
Link: https://lore.kernel.org/r/20221027085840.1562698-1-cezary.rojewski@intel.com
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>ASoC: core: fix wrong size kzalloc for rtd's components member</title>
<updated>2022-11-15T14:16:19Z</updated>
<author>
<name>lishqchn</name>
<email>lishqchn@qq.com</email>
</author>
<published>2022-11-08T04:24:56Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=66a796c04b639e2658b4d820dd5fbc842c8c3aae'/>
<id>urn:sha1:66a796c04b639e2658b4d820dd5fbc842c8c3aae</id>
<content type='text'>
The actual space for struct snd_soc_component has been allocated by
snd_soc_register_component, here rtd's components are pointers to
components, I replace the base size from *component to component.

Signed-off-by: lishqchn &lt;lishqchn@qq.com&gt;
Link: https://lore.kernel.org/r/tencent_59850BB028662B6F2D49D7F3624AB84CCF05@qq.com
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>ASoC: core: Fix use-after-free in snd_soc_exit()</title>
<updated>2022-10-28T11:58:04Z</updated>
<author>
<name>Chen Zhongjin</name>
<email>chenzhongjin@huawei.com</email>
</author>
<published>2022-10-28T03:16:03Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=6ec27c53886c8963729885bcf2dd996eba2767a7'/>
<id>urn:sha1:6ec27c53886c8963729885bcf2dd996eba2767a7</id>
<content type='text'>
KASAN reports a use-after-free:

BUG: KASAN: use-after-free in device_del+0xb5b/0xc60
Read of size 8 at addr ffff888008655050 by task rmmod/387
CPU: 2 PID: 387 Comm: rmmod
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996)
Call Trace:
&lt;TASK&gt;
dump_stack_lvl+0x79/0x9a
print_report+0x17f/0x47b
kasan_report+0xbb/0xf0
device_del+0xb5b/0xc60
platform_device_del.part.0+0x24/0x200
platform_device_unregister+0x2e/0x40
snd_soc_exit+0xa/0x22 [snd_soc_core]
__do_sys_delete_module.constprop.0+0x34f/0x5b0
do_syscall_64+0x3a/0x90
entry_SYSCALL_64_after_hwframe+0x63/0xcd
...
&lt;/TASK&gt;

It's bacause in snd_soc_init(), snd_soc_util_init() is possble to fail,
but its ret is ignored, which makes soc_dummy_dev unregistered twice.

snd_soc_init()
    snd_soc_util_init()
        platform_device_register_simple(soc_dummy_dev)
        platform_driver_register() # fail
    	platform_device_unregister(soc_dummy_dev)
    platform_driver_register() # success
...
snd_soc_exit()
    snd_soc_util_exit()
    # soc_dummy_dev will be unregistered for second time

To fix it, handle error and stop snd_soc_init() when util_init() fail.
Also clean debugfs when util_init() or driver_register() fail.

Fixes: fb257897bf20 ("ASoC: Work around allmodconfig failure")
Signed-off-by: Chen Zhongjin &lt;chenzhongjin@huawei.com&gt;
Link: https://lore.kernel.org/r/20221028031603.59416-1-chenzhongjin@huawei.com
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>ASoC: core: clarify the driver name initialization</title>
<updated>2022-09-29T16:22:41Z</updated>
<author>
<name>Jaroslav Kysela</name>
<email>perex@perex.cz</email>
</author>
<published>2022-09-29T14:37:54Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=c8d18e44022518ab026338ae86bf14cdf2e71887'/>
<id>urn:sha1:c8d18e44022518ab026338ae86bf14cdf2e71887</id>
<content type='text'>
The driver field in the struct snd_ctl_card_info is a valid
user space identifier. Actually, many ASoC drivers do not care
and let to initialize this field using a standard wrapping method.
Unfortunately, in this way, this field becomes unusable and
unreadable for the drivers with longer card names. Also,
there is a possibility to have clashes (driver field has
only limit of 15 characters).

This change will print an error when the wrapping is used.
The developers of the affected drivers should fix the problem.

Signed-off-by: Jaroslav Kysela &lt;perex@perex.cz&gt;
Reviewed-by: Nícolas F. R. A. Prado &lt;nfraprado@collabora.com&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>ASoC: soc.h: remove num_cpus/codecs</title>
<updated>2022-09-20T11:19:30Z</updated>
<author>
<name>Kuninori Morimoto</name>
<email>kuninori.morimoto.gx@renesas.com</email>
</author>
<published>2022-09-20T06:32:16Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=3989ade2d1e7ffc900e3842dc542b9e4bb3618fe'/>
<id>urn:sha1:3989ade2d1e7ffc900e3842dc542b9e4bb3618fe</id>
<content type='text'>
Current rtd has both dai_link pointer (A) and num_cpus/codecs (B).

(A)	rtd-&gt;dai_link	= dai_link;
(B)	rtd-&gt;num_cpus	= dai_link-&gt;num_cpus;
(B)	rtd-&gt;num_codecs	= dai_link-&gt;num_codecs;

But, we can get num_cpus/codecs (B) via dai_link (A).
This means we don't need to keep num_cpus/codecs on rtd.
This patch removes these.

Signed-off-by: Kuninori Morimoto &lt;kuninori.morimoto.gx@renesas.com&gt;
Link: https://lore.kernel.org/r/87sfkmv9n3.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>ASoC: soc-core.c: setup rtd-&gt;pmdown_time at soc_new_pcm_runtime()</title>
<updated>2022-09-19T16:52:41Z</updated>
<author>
<name>Kuninori Morimoto</name>
<email>kuninori.morimoto.gx@renesas.com</email>
</author>
<published>2022-09-09T01:19:18Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=c403dcd8b0c4dc01974329e38dc3f82859fd6f99'/>
<id>urn:sha1:c403dcd8b0c4dc01974329e38dc3f82859fd6f99</id>
<content type='text'>
Almost all default rtd-&gt;xxx are setup at soc_new_pcm_runtime()
which is sub-function of snd_soc_add_pcm_runtime() (A).
But "rtd-&gt;pmdown_time" is setup at soc_init_pcm_runtime() (B).
It is very random timing setup. This patch setup it at (A),
same as other rtd-&gt;xxx.

	static int snd_soc_bind_card(...)
	{
		...
		for_each_card_prelinks(...) {
(A)			ret = snd_soc_add_pcm_runtime(...);
			...
		}
		...
		for_each_card_rtds(...) {
(B)			ret = soc_init_pcm_runtime(...);
			...
		}
		...
	}

One note is that current topology/intel are directly calling
snd_soc_add_pcm_runtime() (A) without calling soc_init_pcm_runtime() (B).
This means, its "rtd-&gt;pmdown_time settings" was 0, but will have default
value by this patch.

"rtd-&gt;pmdown_time settings" will be used at
snd_soc_runtime_ignore_pmdown_time(). This patch adds
"ignore_pmdown_time" to these driver to keep compatibility.

	bool snd_soc_runtime_ignore_pmdown_time(...)
	{
		...
=&gt;		if (!rtd-&gt;pmdown_time || rtd-&gt;dai_link-&gt;ignore_pmdown_time)
			return true;
		...
	}

Signed-off-by: Kuninori Morimoto &lt;kuninori.morimoto.gx@renesas.com&gt;
Link: https://lore.kernel.org/r/875yhxmjjd.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>ASoC: core: Replace sprintf() with sysfs_emit()</title>
<updated>2022-08-15T00:19:49Z</updated>
<author>
<name>Takashi Iwai</name>
<email>tiwai@suse.de</email>
</author>
<published>2022-08-01T17:01:06Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=628d0f72d5828611cae353bd8b49d7647711c283'/>
<id>urn:sha1:628d0f72d5828611cae353bd8b49d7647711c283</id>
<content type='text'>
For sysfs outputs, it's safer to use a new helper, sysfs_emit(),
instead of the raw sprintf() &amp; co.  This patch replaces the sprintf()
usage straightforwardly with a new helper, sysfs_emit().

Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Link: https://lore.kernel.org/r/20220801170108.26340-7-tiwai@suse.de
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>ASoC: soc-core.c: share code for snd_soc_of_get_dai_link_cpus/codecs()</title>
<updated>2022-06-29T17:10:15Z</updated>
<author>
<name>Kuninori Morimoto</name>
<email>kuninori.morimoto.gx@renesas.com</email>
</author>
<published>2022-06-22T05:54:13Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=9cc69528188a4e3eb24370f6c05a92791ac249ba'/>
<id>urn:sha1:9cc69528188a4e3eb24370f6c05a92791ac249ba</id>
<content type='text'>
ASoC has snd_soc_of_get_dai_link_cpus/codecs(), and these are almost same
code. The main difference are below.

	for_each_link_cpus()	dai_link-&gt;cpus		dai_link-&gt;num_cpus
	for_each_link_codecs()	dai_link-&gt;codecs	dai_link-&gt;num_codecs

Because we need to use these parameters, we can't share full-code for now,
but can share some codes.
This patch adds __snd_soc_of_get/put_xxx() functions, and share the code.

Signed-off-by: Kuninori Morimoto &lt;kuninori.morimoto.gx@renesas.com&gt;
Link: https://lore.kernel.org/r/87y1xpp7ju.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>ASoC: soc-core.c: fixup snd_soc_of_get_dai_link_cpus()</title>
<updated>2022-06-29T17:10:14Z</updated>
<author>
<name>Kuninori Morimoto</name>
<email>kuninori.morimoto.gx@renesas.com</email>
</author>
<published>2022-06-22T05:54:06Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=586fb2641371cf7f23a401ab1c79b17e3ec457f4'/>
<id>urn:sha1:586fb2641371cf7f23a401ab1c79b17e3ec457f4</id>
<content type='text'>
commit 900dedd7e47cc3f ("ASoC: Introduce snd_soc_of_get_dai_link_cpus")
adds new snd_soc_of_get_dai_link_cpus(), but it is using
"codec" everywhere. It is very strange, and is issue when error case.
It should call cpu instead of codec in error case.
This patch tidyup it.

Fixes: 900dedd7e47cc3f ("ASoC: Introduce snd_soc_of_get_dai_link_cpus")
Signed-off-by: Kuninori Morimoto &lt;kuninori.morimoto.gx@renesas.com&gt;
Reviewed-by: Martin Povišer &lt;povik+lin@cutebit.org&gt;
Link: https://lore.kernel.org/r/87zgi5p7k1.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
</feed>
