Changeset 498ced1 in mainline for uspace/srv/devman
- Timestamp:
- 2018-08-11T02:43:32Z (7 years ago)
- 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)
- Location:
- uspace/srv/devman
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/dev.c
rb13d80b r498ced1 48 48 return NULL; 49 49 50 atomic_set(&dev->refcnt, 0);50 refcount_init(&dev->refcnt); 51 51 list_initialize(&dev->functions); 52 52 link_initialize(&dev->driver_devices); … … 74 74 void dev_add_ref(dev_node_t *dev) 75 75 { 76 atomic_inc(&dev->refcnt);76 refcount_up(&dev->refcnt); 77 77 } 78 78 … … 85 85 void dev_del_ref(dev_node_t *dev) 86 86 { 87 if ( atomic_predec(&dev->refcnt) == 0)87 if (refcount_down(&dev->refcnt)) 88 88 delete_dev_node(dev); 89 89 } -
uspace/srv/devman/devman.h
rb13d80b r498ced1 41 41 #include <ipc/loc.h> 42 42 #include <fibril_synch.h> 43 #include < atomic.h>43 #include <refcount.h> 44 44 #include <async.h> 45 45 … … 115 115 struct dev_node { 116 116 /** Reference count */ 117 atomic_ t refcnt;117 atomic_refcount_t refcnt; 118 118 119 119 /** The global unique identifier of the device. */ … … 155 155 struct fun_node { 156 156 /** Reference count */ 157 atomic_ t refcnt;157 atomic_refcount_t refcnt; 158 158 /** State */ 159 159 fun_state_t state; -
uspace/srv/devman/driver.c
rb13d80b r498ced1 406 406 } 407 407 408 log_msg(LOG_DEFAULT, LVL_DEBUG, "pass_devices_to_driver: dev->refcnt=%d\n",409 (int)atomic_get(&dev->refcnt));410 408 dev_add_ref(dev); 411 409 -
uspace/srv/devman/fun.c
rb13d80b r498ced1 60 60 61 61 fun->state = FUN_INIT; 62 atomic_set(&fun->refcnt, 0);62 refcount_init(&fun->refcnt); 63 63 fibril_mutex_initialize(&fun->busy_lock); 64 64 link_initialize(&fun->dev_functions); … … 89 89 void fun_add_ref(fun_node_t *fun) 90 90 { 91 atomic_inc(&fun->refcnt);91 refcount_up(&fun->refcnt); 92 92 } 93 93 … … 100 100 void fun_del_ref(fun_node_t *fun) 101 101 { 102 if ( atomic_predec(&fun->refcnt) == 0)102 if (refcount_down(&fun->refcnt)) 103 103 delete_fun_node(fun); 104 104 }
Note:
See TracChangeset
for help on using the changeset viewer.
