Changeset a35b458 in mainline for kernel/genarch/src/ofw


Ignore:
Timestamp:
2018-03-02T20:10:49Z (8 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.

Location:
kernel/genarch/src/ofw
Files:
4 edited

Legend:

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

    r3061bc1 ra35b458  
    5555        if (!prop)
    5656                return false;
    57                
     57
    5858        ranges = prop->size / sizeof(ofw_ebus_range_t);
    5959        range = prop->value;
    60        
     60
    6161        unsigned int i;
    62        
     62
    6363        for (i = 0; i < ranges; i++) {
    6464                if (reg->space != range[i].child_space)
     
    6767                    range[i].size)) {
    6868                        ofw_pci_reg_t pci_reg;
    69                        
     69
    7070                        pci_reg.space = range[i].parent_space;
    7171                        pci_reg.addr = range[i].parent_base +
    7272                            (reg->addr - range[i].child_base);
    7373                        pci_reg.size = reg->size;
    74                        
     74
    7575                        return ofw_pci_apply_ranges(node->parent, &pci_reg, pa);
    7676                }
     
    8686        ofw_tree_property_t *prop;
    8787        ofw_tree_node_t *controller;
    88        
     88
    8989        prop = ofw_tree_getprop(node, "interrupt-map");
    9090        if (!prop || !prop->value)
     
    9393        ofw_ebus_intr_map_t *intr_map = prop->value;
    9494        size_t count = prop->size / sizeof(ofw_ebus_intr_map_t);
    95        
     95
    9696        assert(count);
    97        
     97
    9898        prop = ofw_tree_getprop(node, "interrupt-map-mask");
    9999        if (!prop || !prop->value)
    100100                return false;
    101        
     101
    102102        ofw_ebus_intr_mask_t *intr_mask = prop->value;
    103        
     103
    104104        assert(prop->size == sizeof(ofw_ebus_intr_mask_t));
    105        
     105
    106106        uint32_t space = reg->space & intr_mask->space_mask;
    107107        uint32_t addr = reg->addr & intr_mask->addr_mask;
    108108        uint32_t intr = interrupt & intr_mask->intr_mask;
    109        
     109
    110110        unsigned int i;
    111111        for (i = 0; i < count; i++) {
     
    127127        if (!controller)
    128128                return false;
    129                
     129
    130130        if (str_cmp(ofw_tree_node_name(controller), "pci") != 0) {
    131131                /*
  • 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}
  • kernel/genarch/src/ofw/pci.c

    r3061bc1 ra35b458  
    6363                return false;
    6464        }
    65                
     65
    6666        ranges = prop->size / sizeof(ofw_pci_range_t);
    6767        range = prop->value;
    68        
     68
    6969        unsigned int i;
    70        
     70
    7171        for (i = 0; i < ranges; i++) {
    7272                if ((reg->space & PCI_SPACE_MASK) !=
     
    9595                return true;
    9696        }
    97        
     97
    9898        ofw_tree_property_t *prop;
    9999        ofw_pci_reg_t *assigned_address;
    100100        size_t assigned_addresses;
    101        
     101
    102102        prop = ofw_tree_getprop(node, "assigned-addresses");
    103103        if (!prop)
    104104                panic("Cannot find 'assigned-addresses' property.");
    105        
     105
    106106        assigned_addresses = prop->size / sizeof(ofw_pci_reg_t);
    107107        assigned_address = prop->value;
    108        
     108
    109109        unsigned int i;
    110        
     110
    111111        for (i = 0; i < assigned_addresses; i++) {
    112112                if ((assigned_address[i].space & PCI_REG_MASK) ==
     
    118118                }
    119119        }
    120        
     120
    121121        return false;
    122122}
  • kernel/genarch/src/ofw/sbus.c

    r3061bc1 ra35b458  
    4646        ofw_sbus_range_t *range;
    4747        size_t ranges;
    48        
     48
    4949        /*
    5050         * The SBUS support is very rudimentary in that we simply assume
     
    5555        if (!node->parent || node->parent->parent)
    5656                return false;
    57        
     57
    5858        prop = ofw_tree_getprop(node, "ranges");
    5959        if (!prop)
    6060                return false;
    61                
     61
    6262        ranges = prop->size / sizeof(ofw_sbus_range_t);
    6363        range = prop->value;
    64        
     64
    6565        unsigned int i;
    66        
     66
    6767        for (i = 0; i < ranges; i++) {
    6868                if (overlaps(reg->addr, reg->size, range[i].child_base,
     
    7373                }
    7474        }
    75        
     75
    7676        return false;
    7777}
Note: See TracChangeset for help on using the changeset viewer.