@@ -127,13 +127,15 @@ static int of_dma_find_channel(struct device_node *np, char *name,
return count;
for (i = 0; i < count; i++) {
- of_property_read_string_index(np, "dma-names", i, &s);
+ if (of_property_read_string_index(np, "dma-names", i, &s))
+ continue;
if (strcmp(name, s))
continue;
- return of_parse_phandle_with_args(np, "dmas", "#dma-cells",
- i, dma_spec);
+ if (!of_parse_phandle_with_args(np, "dmas", "#dma-cells", i,
+ dma_spec))
+ return 0;
}
return -ENODEV;
@@ -159,33 +161,34 @@ struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
return NULL;
}
- r = of_dma_find_channel(np, name, &dma_spec);
-
- if (r) {
- pr_err("%s: can't find DMA channel\n", np->full_name);
- return NULL;
- }
+ do {
+ r = of_dma_find_channel(np, name, &dma_spec);
+ if (r) {
+ pr_err("%s: can't find DMA channel\n", np->full_name);
+ return NULL;
+ }
+
+ ofdma = of_dma_find_controller(dma_spec.np);
+ if (!ofdma) {
+ pr_debug("%s: can't find DMA controller %s\n",
+ np->full_name, dma_spec.np->full_name);
+ continue;
+ }
- ofdma = of_dma_find_controller(dma_spec.np);
- if (!ofdma) {
- pr_err("%s: can't find DMA controller %s\n", np->full_name,
- dma_spec.np->full_name);
- return NULL;
- }
+ if (dma_spec.args_count != ofdma->of_dma_nbcells) {
+ pr_debug("%s: wrong #dma-cells for %s\n", np->full_name,
+ dma_spec.np->full_name);
+ continue;
+ }
- if (dma_spec.args_count != ofdma->of_dma_nbcells) {
- pr_err("%s: wrong #dma-cells for %s\n", np->full_name,
- dma_spec.np->full_name);
- return NULL;
- }
+ chan = ofdma->of_dma_xlate(&dma_spec, ofdma);
- chan = ofdma->of_dma_xlate(&dma_spec, ofdma);
+ of_node_put(dma_spec.np);
- of_node_put(dma_spec.np);
+ } while (!chan);
return chan;
}
-EXPORT_SYMBOL_GPL(of_dma_request_slave_channel);
Cheers
Jon