Ignore:
File:
1 edited

Legend:

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

    r01b87dc5 r96b02eb9  
    6262}
    6363
    64 static int devmap_devices_class_compare(unsigned long key[], hash_count_t keys,
    65     link_t *item)
    66 {
    67         dev_class_info_t *class_info
    68             = hash_table_get_instance(item, dev_class_info_t, devmap_link);
    69         assert(class_info != NULL);
    70 
    71         return (class_info->devmap_handle == (devmap_handle_t) key[0]);
    72 }
    73 
    7464static void devices_remove_callback(link_t *item)
    7565{
     
    8575        .hash = devices_hash,
    8676        .compare = devmap_devices_compare,
    87         .remove_callback = devices_remove_callback
    88 };
    89 
    90 static hash_table_operations_t devmap_devices_class_ops = {
    91         .hash = devices_hash,
    92         .compare = devmap_devices_class_compare,
    9377        .remove_callback = devices_remove_callback
    9478};
     
    384368        printf(NAME ": create_root_node\n");
    385369
    386         fibril_rwlock_write_lock(&tree->rwlock);
    387370        node = create_dev_node();
    388371        if (node != NULL) {
     
    394377                tree->root_node = node;
    395378        }
    396         fibril_rwlock_write_unlock(&tree->rwlock);
    397379
    398380        return node != NULL;
     
    457439/** Start a driver
    458440 *
     441 * The driver's mutex is assumed to be locked.
     442 *
    459443 * @param drv           The driver's structure.
    460444 * @return              True if the driver's task is successfully spawned, false
     
    465449        int rc;
    466450
    467         assert(fibril_mutex_is_locked(&drv->driver_mutex));
    468        
    469451        printf(NAME ": start_driver '%s'\n", drv->name);
    470452       
     
    688670        }
    689671       
    690         devmap_device_register_with_iface(devmap_pathname,
    691             &node->devmap_handle, DEVMAN_CONNECT_FROM_DEVMAP);
     672        devmap_device_register(devmap_pathname, &node->devmap_handle);
    692673       
    693674        tree_add_devmap_device(tree, node);
     
    861842/** Find the device node structure of the device witch has the specified handle.
    862843 *
     844 * Device tree's rwlock should be held at least for reading.
     845 *
    863846 * @param tree          The device tree where we look for the device node.
    864847 * @param handle        The handle of the device.
     
    868851{
    869852        unsigned long key = handle;
    870         link_t *link;
    871        
    872         assert(fibril_rwlock_is_locked(&tree->rwlock));
    873        
    874         link = hash_table_find(&tree->devman_devices, &key);
     853        link_t *link = hash_table_find(&tree->devman_devices, &key);
    875854        return hash_table_get_instance(link, node_t, devman_link);
    876855}
     
    928907/** Insert new device into device tree.
    929908 *
     909 * The device tree's rwlock should be already held exclusively when calling this
     910 * function.
     911 *
    930912 * @param tree          The device tree.
    931913 * @param node          The newly added device node.
     
    942924        assert(tree != NULL);
    943925        assert(dev_name != NULL);
    944         assert(fibril_rwlock_is_write_locked(&tree->rwlock));
    945926       
    946927        node->name = dev_name;
     
    10611042       
    10621043        info = (dev_class_info_t *) malloc(sizeof(dev_class_info_t));
    1063         if (info != NULL) {
     1044        if (info != NULL)
    10641045                memset(info, 0, sizeof(dev_class_info_t));
    1065                 list_initialize(&info->dev_classes);
    1066                 list_initialize(&info->devmap_link);
    1067                 list_initialize(&info->link);
    1068         }
    10691046       
    10701047        return info;
     
    11901167        fibril_rwlock_initialize(&class_list->rwlock);
    11911168        hash_table_create(&class_list->devmap_devices, DEVICE_BUCKETS, 1,
    1192             &devmap_devices_class_ops);
     1169            &devmap_devices_ops);
    11931170}
    11941171
     
    12381215        hash_table_insert(&class_list->devmap_devices, &key, &cli->devmap_link);
    12391216        fibril_rwlock_write_unlock(&class_list->rwlock);
    1240 
    1241         assert(find_devmap_class_device(class_list, cli->devmap_handle) != NULL);
    12421217}
    12431218
Note: See TracChangeset for help on using the changeset viewer.