Changeset a35b458 in mainline for uspace/srv/devman/devtree.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
  • uspace/srv/devman/devtree.c

    r3061bc1 ra35b458  
    127127        fun_node_t *fun;
    128128        dev_node_t *dev;
    129        
     129
    130130        log_msg(LOG_DEFAULT, LVL_DEBUG, "create_root_nodes()");
    131        
     131
    132132        fibril_rwlock_write_lock(&tree->rwlock);
    133        
     133
    134134        /*
    135135         * Create root function. This is a pseudo function to which
     
    138138         * the parent function.
    139139         */
    140        
     140
    141141        fun = create_fun_node();
    142142        if (fun == NULL) {
     
    144144                return false;
    145145        }
    146        
     146
    147147        fun_add_ref(fun);
    148148        insert_fun_node(tree, fun, str_dup(""), NULL);
    149        
     149
    150150        match_id_t *id = create_match_id();
    151151        id->id = str_dup("root");
     
    153153        add_match_id(&fun->match_ids, id);
    154154        tree->root_node = fun;
    155        
     155
    156156        /*
    157157         * Create root device node.
     
    162162                return false;
    163163        }
    164        
     164
    165165        dev_add_ref(dev);
    166166        insert_dev_node(tree, dev, fun);
    167        
     167
    168168        fibril_rwlock_write_unlock(&tree->rwlock);
    169        
     169
    170170        return dev != NULL;
    171171}
     
    182182{
    183183        log_msg(LOG_DEFAULT, LVL_DEBUG, "init_device_tree()");
    184        
     184
    185185        tree->current_handle = 0;
    186        
     186
    187187        hash_table_create(&tree->devman_devices, 0, 0, &devman_devices_ops);
    188188        hash_table_create(&tree->devman_functions, 0, 0, &devman_functions_ops);
    189189        hash_table_create(&tree->loc_functions, 0, 0, &loc_devices_ops);
    190        
     190
    191191        fibril_rwlock_initialize(&tree->rwlock);
    192        
     192
    193193        /* Create root function and root device and add them to the device tree. */
    194194        if (!create_root_nodes(tree))
    195195                return false;
    196    
     196
    197197        /* Find suitable driver and start it. */
    198198        dev_node_t *rdev = tree->root_node->child;
     
    200200        bool rc = assign_driver(rdev, drivers_list, tree);
    201201        dev_del_ref(rdev);
    202        
     202
    203203        return rc;
    204204}
     
    216216{
    217217        assert(fibril_rwlock_is_write_locked(&tree->rwlock));
    218        
     218
    219219        log_msg(LOG_DEFAULT, LVL_DEBUG, "insert_dev_node(dev=%p, pfun=%p [\"%s\"])",
    220220            dev, pfun, pfun->pathname);
     
    227227        dev->pfun = pfun;
    228228        pfun->child = dev;
    229        
     229
    230230        return true;
    231231}
     
    239239{
    240240        assert(fibril_rwlock_is_write_locked(&tree->rwlock));
    241        
     241
    242242        log_msg(LOG_DEFAULT, LVL_DEBUG, "remove_dev_node(dev=%p)", dev);
    243        
     243
    244244        /* Remove node from the handle-to-node map. */
    245245        hash_table_remove(&tree->devman_devices, &dev->handle);
    246        
     246
    247247        /* Unlink from parent function. */
    248248        dev->pfun->child = NULL;
    249249        dev->pfun = NULL;
    250        
     250
    251251        dev->state = DEVICE_REMOVED;
    252252}
     
    267267{
    268268        fun_node_t *pfun;
    269        
     269
    270270        assert(fun_name != NULL);
    271271        assert(fibril_rwlock_is_write_locked(&tree->rwlock));
    272        
     272
    273273        /*
    274274         * The root function is a special case, it does not belong to any
     
    276276         */
    277277        pfun = (dev != NULL) ? dev->pfun : NULL;
    278        
     278
    279279        fun->name = fun_name;
    280280        if (!set_fun_path(tree, fun, pfun)) {
    281281                return false;
    282282        }
    283        
     283
    284284        /* Add the node to the handle-to-node map. */
    285285        fun->handle = ++tree->current_handle;
     
    290290        if (dev != NULL)
    291291                list_append(&fun->dev_functions, &dev->functions);
    292        
     292
    293293        return true;
    294294}
     
    302302{
    303303        assert(fibril_rwlock_is_write_locked(&tree->rwlock));
    304        
     304
    305305        /* Remove the node from the handle-to-node map. */
    306306        hash_table_remove(&tree->devman_functions, &fun->handle);
    307        
     307
    308308        /* Remove the node from the list of its parent's children. */
    309309        if (fun->dev != NULL)
    310310                list_remove(&fun->dev_functions);
    311        
     311
    312312        fun->dev = NULL;
    313313        fun->state = FUN_REMOVED;
Note: See TracChangeset for help on using the changeset viewer.