mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/7] ASoC: core: Create new components in sane state
@ 2026-10-07 13:33 Cezary Rojewski
  2026-10-07 13:33 ` [PATCH 1/7] ASoC: core: Add component constructor Cezary Rojewski
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Cezary Rojewski @ 2026-10-07 13:33 UTC (permalink / raw)
  To: broonie, linux-sound
  Cc: tiwai, perex, amade, linux-kernel, kuninori.morimoto.gx, Cezary Rojewski

There is a gap between snd_soc_component_alloc() and
snd_soc_register_component().  A driver that obtains a component object
through snd_soc_component_alloc() receives an object in uninitialized
state.  soc_component_initialize() is the function responsible for
bringing it into a sane one but it is not accessible by the framework
users.  Example of the uninitialized members are the lists e.g.:
comp->dai_list.

The framework shall prevent manipulation of uninitialized components.
Introduce snd_soc_component_new() which acts as a constructor: allocates
and initializes the component object before returning it to the caller.

Given the quite recent discussion related to all things
component-register [1], decided to stick to the "register" wording and
renamed soc_component_add() to snd_soc_component_register().  With that,
register/unregister pattern is kept.  At the same time, the update
brings a clear division between:

	1) snd_soc_component_register(component..)
	2) snd_soc_register_component(dev..)

A driver uses 1) when operating on pre-constructed component object
explicitly and 2) when they want the ASoC framework to do everything for
them.

Parameter "name" is added to the ctor parameter list as it is one of the
fields that is always initialized, see the 'if (!component->name)'
within soc_component_initialize().  Private data on the other hand is
not so opted out of including it.  And thus snd_soc_component_set_priv()
remains intact.

[1]: https://lore.kernel.org/all/87y0f2rz8l.wl-kuninori.morimoto.gx@renesas.com/


Cezary Rojewski (7):
  ASoC: core: Add component constructor
  ASoC: core: Rename and export soc_component_add()
  ASoC: dmaengine: Switch to snd_snd_component_new()
  ASoC: topology-test: Switch to snd_snd_component_new()
  ASoC: Intel: catpt: Switch to snd_snd_component_new()
  ASoC: Intel: avs: Switch to snd_snd_component_new()
  ASoC: core: Remove unused component-register members

 include/sound/soc-component.h         |  7 ++-
 include/sound/soc.h                   |  8 +--
 sound/soc/intel/avs/pcm.c             | 11 ++--
 sound/soc/intel/avs/probes.c          | 12 ++---
 sound/soc/intel/catpt/pcm.c           | 12 ++---
 sound/soc/soc-component.c             | 19 -------
 sound/soc/soc-core.c                  | 77 ++++++++++++---------------
 sound/soc/soc-generic-dmaengine-pcm.c | 18 +++----
 sound/soc/soc-topology-test.c         | 66 +++++++++++------------
 9 files changed, 96 insertions(+), 134 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-10-07 13:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-07 13:33 [PATCH 0/7] ASoC: core: Create new components in sane state Cezary Rojewski
2026-10-07 13:33 ` [PATCH 1/7] ASoC: core: Add component constructor Cezary Rojewski
2026-10-07 13:33 ` [PATCH 2/7] ASoC: core: Rename and export soc_component_add() Cezary Rojewski
2026-10-07 13:33 ` [PATCH 3/7] ASoC: dmaengine: Switch to snd_snd_component_new() Cezary Rojewski
2026-10-07 13:33 ` [PATCH 4/7] ASoC: topology-test: " Cezary Rojewski
2026-10-07 13:33 ` [PATCH 5/7] ASoC: Intel: catpt: " Cezary Rojewski
2026-10-07 13:33 ` [PATCH 6/7] ASoC: Intel: avs: " Cezary Rojewski
2026-10-07 13:33 ` [PATCH 7/7] ASoC: core: Remove unused component-register members Cezary Rojewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®