[alsa-devel] [PATCH 1/4 v6] ASoC: add .of_xlate_dai_name callback on struct snd_soc_dai_driver

Lars-Peter Clausen lars at metafoo.de
Wed Feb 20 02:50:39 EST 2013


On 02/14/2013 10:21 AM, Kuninori Morimoto wrote:
[...]
> +const char *snd_soc_of_get_port_dai_name(struct device_node *of_node,
> +					 const char *prop)
> +{
> +	struct snd_soc_dai *dai;
> +	struct of_phandle_args args;
> +	const char *name;
> +	int ret;
> +
> +	ret = of_parse_phandle_with_args(of_node, prop,
> +					 "#sound-dai-cells", 0, &args);
> +	if (ret)
> +		return NULL;
> +
> +	of_node_put(args.np);

You should keep the reference until after the link.

> +
> +	list_for_each_entry(dai, &dai_list, list) {
> +		if (dai->dev->of_node != args.np)
> +			continue;
> +
> +		if (dai->driver->of_xlate_dai_name) {
> +			name = dai->driver->of_xlate_dai_name(dai, &args);
> +			if (name)
> +				return name;
> +		}

Hm, this is not really a translate function, but rather a match function. It
iterates over all dais of the device and returns the name of the first one
which matches. But there is no translation going on. If the dai matches the
callback will always want to return dai->driver->name. Anything else doesn't
make much sense.

> +	}
> +
> +	return NULL;
> +}


More information about the devicetree-discuss mailing list