Changeset a35b458 in mainline for kernel/genarch/src/ofw/ofw_tree.c


Ignore:
Timestamp:
2018-03-02T20:10:49Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f1380b7
Parents:
3061bc1
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
Message:

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/genarch/src/ofw/ofw_tree.c

    r3061bc1 ra35b458  
    7070                        return &node->property[i];
    7171        }
    72        
     72
    7373        return NULL;
    7474}
     
    8787        if ((!prop) || (prop->size < 2))
    8888                return NULL;
    89        
     89
    9090        return prop->value;
    9191}
     
    110110                        return cur;
    111111        }
    112        
     112
    113113        /*
    114114         * Disambigued name not found.
     
    122122                        return cur;
    123123        }
    124        
     124
    125125        return NULL;
    126126}
     
    141141                ofw_tree_property_t *prop =
    142142                    ofw_tree_getprop(cur, "device_type");
    143                
     143
    144144                if ((!prop) || (!prop->value))
    145145                        continue;
    146                
     146
    147147                if (str_cmp(prop->value, dtype) == 0)
    148148                        return cur;
    149149        }
    150        
     150
    151151        return NULL;
    152152}
     
    170170                if (cur->node_handle == handle)
    171171                        return cur;
    172                
     172
    173173                if (cur->child) {
    174174                        ofw_tree_node_t *node =
     
    178178                }
    179179        }
    180        
     180
    181181        return NULL;
    182182}
     
    197197                ofw_tree_property_t *prop =
    198198                    ofw_tree_getprop(cur, "device_type");
    199                
     199
    200200                if ((!prop) || (!prop->value))
    201201                        continue;
    202                
     202
    203203                if (str_cmp(prop->value, dtype) == 0)
    204204                        return cur;
    205205        }
    206        
     206
    207207        return NULL;
    208208}
     
    223223                ofw_tree_property_t *prop =
    224224                    ofw_tree_getprop(cur, "name");
    225                
     225
    226226                if ((!prop) || (!prop->value))
    227227                        continue;
    228                
     228
    229229                if (str_cmp(prop->value, name) == 0)
    230230                        return cur;
    231231        }
    232        
     232
    233233        return NULL;
    234234}
     
    246246        if (path[0] != '/')
    247247                return NULL;
    248        
     248
    249249        ofw_tree_node_t *node = ofw_root;
    250250        size_t j;
    251        
     251
    252252        for (size_t i = 1; (i < str_size(path)) && (node); i = j + 1) {
    253253                for (j = i; (j < str_size(path)) && (path[j] != '/'); j++);
    254                
     254
    255255                /* Skip extra slashes */
    256256                if (i == j)
    257257                        continue;
    258                
     258
    259259                char buf[NAME_BUF_LEN + 1];
    260260                memcpy(buf, &path[i], j - i);
     
    262262                node = ofw_tree_find_child(node, buf);
    263263        }
    264        
     264
    265265        return node;
    266266}
     
    285285                ofw_tree_property_t *prop =
    286286                    ofw_tree_getprop(cur, "device_type");
    287                
     287
    288288                if ((prop) && (prop->value) && (str_cmp(prop->value, dtype) == 0)) {
    289289                        bool ret = walker(cur, arg);
     
    291291                                return false;
    292292                }
    293                
     293
    294294                if (cur->child) {
    295295                        bool ret =
     
    299299                }
    300300        }
    301        
     301
    302302        return true;
    303303}
     
    336336{
    337337        ofw_tree_node_t *node = (ofw_tree_node_t *) data;
    338        
     338
    339339        /* Compute serialized data size */
    340340        *size = 0;
     
    342342                *size += str_size(node->property[i].name) + 1 +
    343343                    sizeof(node->property[i].size) + node->property[i].size;
    344        
     344
    345345        if (dry_run)
    346346                return NULL;
    347        
     347
    348348        void *dump = malloc(*size, FRAME_ATOMIC);
    349349        if (dump == NULL) {
     
    351351                return NULL;
    352352        }
    353        
     353
    354354        /* Serialize the data */
    355355        size_t pos = 0;
     
    358358                str_cpy(dump + pos, *size - pos, node->property[i].name);
    359359                pos += str_size(node->property[i].name) + 1;
    360                
     360
    361361                /* Value size */
    362362                memcpy(dump + pos, &node->property[i].size,
    363363                    sizeof(node->property[i].size));
    364364                pos += sizeof(node->property[i].size);
    365                
     365
    366366                /* Value */
    367367                memcpy(dump + pos, node->property[i].value,
     
    369369                pos += node->property[i].size;
    370370        }
    371        
     371
    372372        return ((void *) dump);
    373373}
     
    385385{
    386386        char *cur_path = (char *) malloc(PATH_MAX_LEN, 0);
    387        
     387
    388388        for (ofw_tree_node_t *cur = node; cur; cur = cur->peer) {
    389389                if ((cur->parent) && (path))
     
    391391                else
    392392                        snprintf(cur_path, PATH_MAX_LEN, "firmware.%s", cur->da_name);
    393                
     393
    394394                sysinfo_set_item_gen_data(cur_path, NULL, ofw_sysinfo_properties,
    395395                    (void *) cur);
    396                
     396
    397397                if (cur->child)
    398398                        ofw_tree_node_sysinfo(cur->child, cur_path);
    399399        }
    400        
     400
    401401        free(cur_path);
    402402}
Note: See TracChangeset for help on using the changeset viewer.