Changeset 498ced1 in mainline for uspace/lib/usbhost/src/endpoint.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/lib/usbhost/src/endpoint.c

    rb13d80b r498ced1  
    3636
    3737#include <assert.h>
    38 #include <atomic.h>
    3938#include <mem.h>
    4039#include <stdlib.h>
     
    6059        ep->device = dev;
    6160
    62         atomic_set(&ep->refcnt, 0);
     61        refcount_init(&ep->refcnt);
    6362        fibril_condvar_initialize(&ep->avail);
    6463
     
    9190void endpoint_add_ref(endpoint_t *ep)
    9291{
    93         atomic_inc(&ep->refcnt);
     92        refcount_up(&ep->refcnt);
    9493}
    9594
     
    115114void endpoint_del_ref(endpoint_t *ep)
    116115{
    117         if (atomic_predec(&ep->refcnt) == 0) {
     116        if (refcount_down(&ep->refcnt))
    118117                endpoint_destroy(ep);
    119         }
    120118}
    121119
Note: See TracChangeset for help on using the changeset viewer.