Re: [PATCH v30 28/30] ALSA: usb-audio: Add USB offload route kcontrol

Takashi Iwai
2024-12-10T16:52:16Z

On Tue, 10 Dec 2024 16:24:30 +0100,
Cezary Rojewski wrote:
>
> On 2024-12-06 9:43 PM, Wesley Cheng wrote:
> >
> > On 12/6/2024 1:09 AM, Cezary Rojewski wrote:
>
> ...
>
> >>>>> +#include <linux/usb.h>
> >>>>> +
> >>>>> +#include <sound/core.h>
> >>>>> +#include <sound/control.h>
> >>>>> +#include <sound/soc-usb.h>
> >>>>
> >>>> ALSA-components should not be dependent on ASoC ones. It should be done the other way around: ALSA <- ASoC.
> >>>>
> >>>
> >>> At least for this kcontrol, we need to know the status of the ASoC state, so that we can communicate the proper path to userspace.  If the ASoC path is not probed or ready, then this module isn't blocked.  It will just communicate that there isn't a valid offload path.
> >>
> >> I'm not asking _why_ you need soc-usb.h header, your reasoning is probably perfectly fine. The code hierarchy is not though. If a sound module is dependent on soc-xxx.h i.e. ASoC symbols, it shall be part of sound/soc/ space.
> >
> >
> > That would basically require a significant change in the current design.  Was that requirement documented somewhere, where ALSA components should not be dependent on ASoC?  What was the reasoning for making it one direction, but not the other?
>
> Well, some may call this a common sense. ASoC is founded on
> ALSA. There are no ALSA-core components which I'm aware of which have
> a dependency on ASoC components. You may not get compilation problems
> now, but such approach does not scale and will hit circular dependency
> problem sooner or later.

In this particular case, I guess we don't have to be too strict.
As long as it's a dynamic add-on, there is less dependency problem.
OTOH, if it were linked directly, that can cause an issue, though.

But, which code is put at which place can be reconsidered, yes. The
right placing may help better understanding of the code, too.

thanks,

Takashi