19 Feb
2013
19 Feb
'13
4:50 p.m.
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;
+}