On 1/10/22 10:06, Pali Rohár wrote:
On Monday 10 January 2022 08:43:17 Stefan Roese wrote:
+       /* If mSATA card is not present, disable SATA DT node */
+       if (!mode_sata) {
+               fdt_for_each_node_by_compatible (node, blob, -1,
+                                                "marvell,armada-380-ahci") {

Why are adding the space before the "(" here? This does not seem the
common and preferred coding style AFAICT.

Hello Stefan! Just to note that I'm adding this space too when writing
for-loops. E.g.:

for (i = 0; i < 10; i++) {
...
}

or:

fdt_for_each_node_by_compatible (node, blob, -1, compatible) {
...
}

Right. But we already have multiple of these for () helpers in U-Boot
and Linux. And AFACIT all are used without this space:

[stefan@ryzen u-boot (master)]$ git grep for_each drivers/
drivers/block/blkcache.c:       list_for_each_entry(node, &block_cache, lh)
drivers/block/blkcache.c:       list_for_each_safe(entry, n, &block_cache) {
drivers/button/button-adc.c:    dev_for_each_subnode(node, dev->parent) {
drivers/button/button-adc.c:    dev_for_each_subnode(node, parent) {
drivers/button/button-gpio.c:   dev_for_each_subnode(node, parent) {
drivers/clk/clk-uclass.c: list_for_each_entry(child_dev, &clk->dev->child_head, sibling_node) {
drivers/clk/clk_stm32mp1.c:     ofnode_for_each_subnode(subnode, node) {
drivers/core/device-remove.c: list_for_each_entry_safe(pos, n, &dev->child_head, sibling_node) { drivers/core/device-remove.c: list_for_each_entry_safe(pos, n, &dev->child_head, sibling_node) { drivers/core/device.c: list_for_each_entry_safe(pos, n, &dev->parent->child_head, drivers/core/device.c: list_for_each_entry(uc, gd->uclass_root, sibling_node) {

So I would prefer to also use this new helper without the extra space as
well.

Thanks,
Stefan

Reply via email to