Changeset 0876062 in mainline for uspace/srv/devman/devman.c


Ignore:
Timestamp:
2011-03-30T13:19:28Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3fddb55
Parents:
4265fd4
Message:

devman refuse to register same function twice

File:
1 edited

Legend:

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

    r4265fd4 r0876062  
    11651165}
    11661166
     1167/** Find function with a specified name belonging to given device.
     1168 *
     1169 * Device tree rwlock should be held at least for reading.
     1170 *
     1171 * @param dev Device the function belongs to.
     1172 * @param name Function name (not path).
     1173 * @return Function node.
     1174 * @retval NULL No function with given name.
     1175 */
     1176fun_node_t *find_fun_node_in_device(dev_node_t *dev, const char *name)
     1177{
     1178        assert(dev != NULL);
     1179        assert(name != NULL);
     1180
     1181        fun_node_t *fun;
     1182        link_t *link;
     1183
     1184        for (link = dev->functions.next;
     1185            link != &dev->functions;
     1186            link = link->next) {
     1187                fun = list_get_instance(link, fun_node_t, dev_functions);
     1188
     1189                if (str_cmp(name, fun->name) == 0)
     1190                        return fun;
     1191        }
     1192
     1193        return NULL;
     1194}
     1195
    11671196/** Find child function node with a specified name.
    11681197 *
     
    11751204fun_node_t *find_node_child(fun_node_t *pfun, const char *name)
    11761205{
    1177         fun_node_t *fun;
    1178         link_t *link;
    1179        
    1180         link = pfun->child->functions.next;
    1181        
    1182         while (link != &pfun->child->functions) {
    1183                 fun = list_get_instance(link, fun_node_t, dev_functions);
    1184                
    1185                 if (str_cmp(name, fun->name) == 0)
    1186                         return fun;
    1187                
    1188                 link = link->next;
    1189         }
    1190        
    1191         return NULL;
     1206        return find_fun_node_in_device(pfun->child, name);
    11921207}
    11931208
Note: See TracChangeset for help on using the changeset viewer.