Changeset 498ced1 in mainline for uspace/srv/devman/dev.c


Ignore:
Timestamp:
2018-08-11T02:43:32Z (7 years ago)
Author:
Jiří Zárevúcky <jiri.zarevucky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
05882233
Parents:
b13d80b
git-author:
Jiří Zárevúcky <jiri.zarevucky@…> (2018-08-11 02:29:02)
git-committer:
Jiří Zárevúcky <jiri.zarevucky@…> (2018-08-11 02:43:32)
Message:

Unify reference counting and remove some unnecessary instances of <atomic.h>

File:
1 edited

Legend:

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

    rb13d80b r498ced1  
    4848                return NULL;
    4949
    50         atomic_set(&dev->refcnt, 0);
     50        refcount_init(&dev->refcnt);
    5151        list_initialize(&dev->functions);
    5252        link_initialize(&dev->driver_devices);
     
    7474void dev_add_ref(dev_node_t *dev)
    7575{
    76         atomic_inc(&dev->refcnt);
     76        refcount_up(&dev->refcnt);
    7777}
    7878
     
    8585void dev_del_ref(dev_node_t *dev)
    8686{
    87         if (atomic_predec(&dev->refcnt) == 0)
     87        if (refcount_down(&dev->refcnt))
    8888                delete_dev_node(dev);
    8989}
Note: See TracChangeset for help on using the changeset viewer.