Re: [PATCH 2/2] ASoC: audio-graph-card2: Use helper function to simplify code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Hi Zhang

Thank you for the patch

> -	do {
> -		*port = of_get_next_child(ports, *port);
> -		if (!*port)
> +	for_each_child_of_node(ports, *port) {
> +		if (of_node_name_eq(*port, "port")) {
> +			ep  = port_to_endpoint(*port);
> +			rep = of_graph_get_remote_endpoint(ep);
>  			break;
> -	} while (!of_node_name_eq(*port, "port"));
> -
> -	if (*port) {
> -		ep  = port_to_endpoint(*port);
> -		rep = of_graph_get_remote_endpoint(ep);
> +		}
>  	}

Original code calls (A) first, but this code calls (B) first in
for_each_child_of_node(), it breaks logic

(A)	of_get_next_child(ports, *port);
(B)	of_get_next_child(ports, NULL);

This function try to find next port, not for port loop.

Thank you for your help !!

Best regards
---
Kuninori Morimoto




[Index of Archives]     [Pulseaudio]     [Linux Audio Users]     [ALSA Devel]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux