[alsa-devel] [PATCH 11/49] ASoC: simple-card-core: add asoc_simple_card_parse_card_widgets()

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Tue May 31 04:19:20 CEST 2016


Hi Mark, again

> > > +int asoc_simple_card_parse_card_widgets(struct snd_soc_card *card,
> > > +					char *prefix)
> > > +{
> > > +	struct device_node *np = card->dev->of_node;
> > > +	char prop[128];
> > > +	int ret = 0;
> > > +
> > > +	snprintf(prop, sizeof(prop), "%swidgets", prefix);
> > > +
> > > +	if (of_property_read_bool(np, prop))
> > > +		ret = snd_soc_of_parse_audio_simple_widgets(card, prop);
> > > +
> > > +	return ret;
> > > +}
> > > +EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_widgets);
> > 
> > This seems like an extremely thin wrapper around existing core
> > functionality, shouldn't we just be adding the property check into the
> > core?
> 
> OK, will do in v2

This, and asoc_simple_card_parse_card_route() (= _route) had same concept.
(_widgets user is only simple-card...)
Many drivers are using _route function, and almost all drivers are expecting
that it will be error if DT doesn't have its property.
But, above helper is tring to parse it, and it is not error if DT doesn't have it.
I will put these 2 helper in soc-core.c, as _try_ function in v2.



More information about the Alsa-devel mailing list