Lines Matching refs:dev
46 struct etna_device *dev = calloc(sizeof(*dev), 1); in etna_device_new() local
48 if (!dev) in etna_device_new()
51 atomic_set(&dev->refcnt, 1); in etna_device_new()
52 dev->fd = fd; in etna_device_new()
53 dev->handle_table = drmHashCreate(); in etna_device_new()
54 dev->name_table = drmHashCreate(); in etna_device_new()
55 etna_bo_cache_init(&dev->bo_cache); in etna_device_new()
57 return dev; in etna_device_new()
65 struct etna_device *dev = etna_device_new(dup_fd); in etna_device_new_dup() local
67 if (dev) in etna_device_new_dup()
68 dev->closefd = 1; in etna_device_new_dup()
72 return dev; in etna_device_new_dup()
75 drm_public struct etna_device *etna_device_ref(struct etna_device *dev) in etna_device_ref() argument
77 atomic_inc(&dev->refcnt); in etna_device_ref()
79 return dev; in etna_device_ref()
82 static void etna_device_del_impl(struct etna_device *dev) in etna_device_del_impl() argument
84 etna_bo_cache_cleanup(&dev->bo_cache, 0); in etna_device_del_impl()
85 drmHashDestroy(dev->handle_table); in etna_device_del_impl()
86 drmHashDestroy(dev->name_table); in etna_device_del_impl()
88 if (dev->closefd) in etna_device_del_impl()
89 close(dev->fd); in etna_device_del_impl()
91 free(dev); in etna_device_del_impl()
94 drm_private void etna_device_del_locked(struct etna_device *dev) in etna_device_del_locked() argument
96 if (!atomic_dec_and_test(&dev->refcnt)) in etna_device_del_locked()
99 etna_device_del_impl(dev); in etna_device_del_locked()
102 drm_public void etna_device_del(struct etna_device *dev) in etna_device_del() argument
104 if (!atomic_dec_and_test(&dev->refcnt)) in etna_device_del()
108 etna_device_del_impl(dev); in etna_device_del()
112 drm_public int etna_device_fd(struct etna_device *dev) in etna_device_fd() argument
114 return dev->fd; in etna_device_fd()