Changeset 8565a42 in mainline for uspace/srv/devman/fun.c


Ignore:
Timestamp:
2018-03-02T20:34:50Z (7 years ago)
Author:
GitHub <noreply@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a1a81f69, d5e5fd1
Parents:
3061bc1 (diff), 34e1206 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:34:50)
git-committer:
GitHub <noreply@…> (2018-03-02 20:34:50)
Message:

Remove all trailing whitespace, everywhere.

See individual commit messages for details.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/devman/fun.c

    r3061bc1 r8565a42  
    5858        if (fun == NULL)
    5959                return NULL;
    60        
     60
    6161        fun->state = FUN_INIT;
    6262        atomic_set(&fun->refcnt, 0);
     
    6464        link_initialize(&fun->dev_functions);
    6565        list_initialize(&fun->match_ids.ids);
    66        
     66
    6767        return fun;
    6868}
     
    7676        assert(fun->dev == NULL);
    7777        assert(fun->child == NULL);
    78        
     78
    7979        clean_match_ids(&fun->match_ids);
    8080        free(fun->name);
     
    125125{
    126126        fun_node_t *fun;
    127        
     127
    128128        assert(fibril_rwlock_is_locked(&tree->rwlock));
    129        
     129
    130130        ht_link_t *link = hash_table_find(&tree->devman_functions, &handle);
    131131        if (link == NULL)
    132132                return NULL;
    133        
     133
    134134        fun = hash_table_get_inst(link, fun_node_t, devman_fun);
    135        
     135
    136136        return fun;
    137137}
     
    146146{
    147147        fun_node_t *fun = NULL;
    148        
     148
    149149        fibril_rwlock_read_lock(&tree->rwlock);
    150        
     150
    151151        fun = find_fun_node_no_lock(tree, handle);
    152152        if (fun != NULL)
    153153                fun_add_ref(fun);
    154        
     154
    155155        fibril_rwlock_read_unlock(&tree->rwlock);
    156        
     156
    157157        return fun;
    158158}
     
    170170        assert(fibril_rwlock_is_write_locked(&tree->rwlock));
    171171        assert(fun->name != NULL);
    172        
     172
    173173        size_t pathsize = (str_size(fun->name) + 1);
    174174        if (parent != NULL)
    175175                pathsize += str_size(parent->pathname) + 1;
    176        
     176
    177177        fun->pathname = (char *) malloc(pathsize);
    178178        if (fun->pathname == NULL) {
     
    180180                return false;
    181181        }
    182        
     182
    183183        if (parent != NULL) {
    184184                str_cpy(fun->pathname, pathsize, parent->pathname);
     
    188188                str_cpy(fun->pathname, pathsize, fun->name);
    189189        }
    190        
     190
    191191        return true;
    192192}
     
    209209
    210210        fibril_rwlock_read_lock(&tree->rwlock);
    211        
     211
    212212        fun_node_t *fun = tree->root_node;
    213213        fun_add_ref(fun);
     
    219219        char *next_path_elem = NULL;
    220220        bool cont = (rel_path[1] != '\0');
    221        
     221
    222222        while (cont && fun != NULL) {
    223223                next_path_elem  = get_path_elem_end(rel_path + 1);
     
    228228                        cont = false;
    229229                }
    230                
     230
    231231                fun_node_t *cfun = find_node_child(tree, fun, rel_path + 1);
    232232                fun_del_ref(fun);
    233233                fun = cfun;
    234                
     234
    235235                if (cont) {
    236236                        /* Restore the original path. */
     
    239239                rel_path = next_path_elem;
    240240        }
    241        
     241
    242242        fibril_rwlock_read_unlock(&tree->rwlock);
    243        
     243
    244244        return fun;
    245245}
     
    299299{
    300300        dev_node_t *dev;
    301        
     301
    302302        fibril_rwlock_write_lock(&device_tree.rwlock);
    303        
     303
    304304        if (fun->state == FUN_ON_LINE) {
    305305                fibril_rwlock_write_unlock(&device_tree.rwlock);
     
    308308                return EOK;
    309309        }
    310        
     310
    311311        if (fun->ftype == fun_inner) {
    312312                dev = create_dev_node();
     
    315315                        return ENOMEM;
    316316                }
    317                
     317
    318318                insert_dev_node(&device_tree, dev, fun);
    319319                dev_add_ref(dev);
    320320        }
    321        
     321
    322322        log_msg(LOG_DEFAULT, LVL_DEBUG, "devman_add_function(fun=\"%s\")", fun->pathname);
    323        
     323
    324324        if (fun->ftype == fun_inner) {
    325325                dev = fun->child;
    326326                assert(dev != NULL);
    327                
     327
    328328                /* Give one reference over to assign_driver_fibril(). */
    329329                dev_add_ref(dev);
    330                
     330
    331331                /*
    332332                 * Try to find a suitable driver and assign it to the device.  We do
     
    347347        } else
    348348                loc_register_tree_function(fun, &device_tree);
    349        
     349
    350350        fun->state = FUN_ON_LINE;
    351351        fibril_rwlock_write_unlock(&device_tree.rwlock);
    352        
     352
    353353        return EOK;
    354354}
     
    357357{
    358358        errno_t rc;
    359        
     359
    360360        fibril_rwlock_write_lock(&device_tree.rwlock);
    361        
     361
    362362        if (fun->state == FUN_OFF_LINE) {
    363363                fibril_rwlock_write_unlock(&device_tree.rwlock);
     
    366366                return EOK;
    367367        }
    368        
     368
    369369        if (fun->ftype == fun_inner) {
    370370                log_msg(LOG_DEFAULT, LVL_DEBUG, "Offlining inner function %s.",
    371371                    fun->pathname);
    372                
     372
    373373                if (fun->child != NULL) {
    374374                        dev_node_t *dev = fun->child;
    375375                        device_state_t dev_state;
    376                        
     376
    377377                        dev_add_ref(dev);
    378378                        dev_state = dev->state;
    379                        
     379
    380380                        fibril_rwlock_write_unlock(&device_tree.rwlock);
    381381
     
    388388                                }
    389389                        }
    390                        
     390
    391391                        /* Verify that driver removed all functions */
    392392                        fibril_rwlock_read_lock(&device_tree.rwlock);
     
    396396                                return EIO;
    397397                        }
    398                        
     398
    399399                        driver_t *driver = dev->drv;
    400400                        fibril_rwlock_read_unlock(&device_tree.rwlock);
    401                        
     401
    402402                        if (driver)
    403403                                detach_driver(&device_tree, dev);
    404                        
     404
    405405                        fibril_rwlock_write_lock(&device_tree.rwlock);
    406406                        remove_dev_node(&device_tree, dev);
    407                        
     407
    408408                        /* Delete ref created when node was inserted */
    409409                        dev_del_ref(dev);
     
    419419                        return EIO;
    420420                }
    421                
     421
    422422                fun->service_id = 0;
    423423        }
    424        
     424
    425425        fun->state = FUN_OFF_LINE;
    426426        fibril_rwlock_write_unlock(&device_tree.rwlock);
    427        
     427
    428428        return EOK;
    429429}
Note: See TracChangeset for help on using the changeset viewer.