On Sat, Jul 03, 2021 at 01:50:34PM +0100, Richard Fitzgerald wrote:
That commit breaks all users of the snd_soc_component_*_pin() functions because it results in the prefix being added twice. It also breaks code that correctly uses the snd_soc_dapm_*_pin() functions.
Use the snd_soc_component_*_pin() functions if you want the component prefix to be prepended automatically.
Use the raw snd_soc_dapm_*_pin() functions if the caller has the full name that should be matched exactly.
I'm not sure the analysis of which function to use when is correct or what we want here (though it will work ATM), though looking again more closely at the patch it doesn't look entirely right either. The way this used to be done, and the way that older code will most likely assume things work, was that the DAPM functions would first try to match on the local DAPM context before falling back to doing a global match. This is what the fallback loop is intended to do, and the dapm functions are passing the "search other contexts" flag into dapm_find_widget().
I'd not expect the distinction you seem to expect between component and DAPM and we probably have a bunch of older drivers that aren't working correctly like the Realtek driver mentioned in the original fix. I think what needs to happen is that dapm_find_widget() needs to be checking both the prefixed and non-prefixed names, and that the component stuff shouldn't need to bother and just be a convenience wrapper for users that happene to have a component to hand. Alternatively we need to do an audit of all the non-machine drivers to switch them to use the component functions exclusively (and possibly some of the machine drivers as well), most of the CODEC users look to be a small number of Wolfson/Cirrus ones.