Messages in this thread | | | Date | Thu, 7 Dec 2023 22:01:32 +0200 | From | Vladimir Oltean <> | Subject | Re: [PATCH net-next 07/15] net: dsa: mt7530: do not run mt7530_setup_port5() if port 5 is disabled |
| |
On Thu, Dec 07, 2023 at 08:40:15PM +0200, Vladimir Oltean wrote: > Also, reducing the indentation level of for_each_child_of_node() by one > can't be bad. Maybe even by more. There's this pattern: > > for_each_child_of_node(dn, mac_np) { > // do stuff with mac_np > break; > } > > aka we only care about the first child of dn. We could find the mac_np > as the only operation inside for_each_child_of_node(), break directly, > and "do stuff with mac_np" could be done outside, further reducing the > indentation by 1 level.
I noticed just now that there is further filtering on the child OF node by of_device_is_compatible(). In that case, of_get_compatible_child() could be used to eliminate for_each_child_of_node() completely.
| |