void ttm_base_object_unref(struct ttm_base_object **p_base) { struct ttm_base_object *base = *p_base; *p_base = NULL; if (refcount_release(&base->refcount)) ttm_release_base(base); }
void ttm_base_object_unref(struct ttm_base_object **p_base) { struct ttm_base_object *base = *p_base; struct ttm_object_device *tdev = base->tfile->tdev; *p_base = NULL; /* * Need to take the lock here to avoid racing with * users trying to look up the object. */ rw_wlock(&tdev->object_lock); if (refcount_release(&base->refcount)) ttm_release_base(base); rw_wunlock(&tdev->object_lock); }