[PATCH 0/3] ASoC: core: Two step component registration
Cezary Rojewski
cezary.rojewski at intel.com
Fri Jul 31 18:09:00 CEST 2020
On 2020-07-31 5:58 PM, Lars-Peter Clausen wrote:
> On 7/31/20 5:47 PM, Cezary Rojewski wrote:
>> On 2020-07-31 5:07 PM, Pierre-Louis Bossart wrote:
>>> On 7/31/20 9:41 AM, Cezary Rojewski wrote:
>>>> Provide a mechanism for true two-step component registration. This
>>>> mimics device registration flow where initialization is the first step
>>>> while addition goes as second in line. Drivers may choose to modify
>>>> component's fields before registering component to ASoC subsystem via
>>>> snd_soc_add_component.
>>>
>>> I must admit I don't see where this might be used for Intel
>>> platforms, we've been happily using snd_soc_register_component()
>>> without hitting limitations.
>>
>> Patchset targets entire ASoC framework, not Intel catalog. As
>> _initialize and _add are already in place, having a two-step
>> registration is cohesive with other "frameworks" e.g. device one.
>>
>> New to ASoC? Trying to learn soc-components? Guess what,
>> creation/registration procedure is exactly the same as one you're used
>> to already!
>>
>>> Also the only two uses of snd_soc_add_component() seem mainly driven
>>> by memory allocation - and avoiding a devm_kzalloc in
>>> snd_soc_register_component().
>>
>> In general, code quality and improvements to its flow should not
>> require ton of usages. But hey, you got two already.
>>
>>> Out of curiosity, can you provide an example where this two-step
>>> would be required or beneficial? Thanks!
>>
>> Overridding component->name which is currently always tied to
>> fmt_single_name so you may choose a different name than the ->dev one.
>
> For what it is worth, I think this is a sensible change for the outlined
> reasons. It's something I've always had in the back of my mind, but
> there was never enough of a need to actually do it.
>
> One change I'd like to see is the addition of snd_soc_component_alloc(),
> which combines the step of kzalloc() and snd_soc_component_init() as
> these will be done pretty much always in lockstep. And it also matches
> the APIs that other frameworks offer.
>
> - Lars
>
Nice, so it's not just me imagining things : D
In general granular registration is robust and scales well into the
future. Components functionality will only grow in time so I bet
usecases don't end on my example.
I'd suggest transition to _alloc/_init/other being separated from this
patchset - let it serve as a middle step.
Czarek
More information about the Alsa-devel
mailing list