Lines Matching refs:notify

33 nvif_notify_put_(struct nvif_notify *notify)  in nvif_notify_put_()  argument
35 struct nvif_object *object = notify->object; in nvif_notify_put_()
41 .ntfy.index = notify->index, in nvif_notify_put_()
44 if (atomic_inc_return(&notify->putcnt) != 1) in nvif_notify_put_()
51 nvif_notify_put(struct nvif_notify *notify) in nvif_notify_put() argument
53 if (likely(notify->object) && in nvif_notify_put()
54 test_and_clear_bit(NVIF_NOTIFY_USER, &notify->flags)) { in nvif_notify_put()
55 int ret = nvif_notify_put_(notify); in nvif_notify_put()
56 if (test_bit(NVIF_NOTIFY_WORK, &notify->flags)) in nvif_notify_put()
57 flush_work(&notify->work); in nvif_notify_put()
64 nvif_notify_get_(struct nvif_notify *notify) in nvif_notify_get_() argument
66 struct nvif_object *object = notify->object; in nvif_notify_get_()
72 .ntfy.index = notify->index, in nvif_notify_get_()
75 if (atomic_dec_return(&notify->putcnt) != 0) in nvif_notify_get_()
82 nvif_notify_get(struct nvif_notify *notify) in nvif_notify_get() argument
84 if (likely(notify->object) && in nvif_notify_get()
85 !test_and_set_bit(NVIF_NOTIFY_USER, &notify->flags)) in nvif_notify_get()
86 return nvif_notify_get_(notify); in nvif_notify_get()
91 nvif_notify_func(struct nvif_notify *notify, bool keep) in nvif_notify_func() argument
93 int ret = notify->func(notify); in nvif_notify_func()
95 !test_and_clear_bit(NVIF_NOTIFY_USER, &notify->flags)) { in nvif_notify_func()
97 atomic_dec(&notify->putcnt); in nvif_notify_func()
99 nvif_notify_get_(notify); in nvif_notify_func()
107 struct nvif_notify *notify = container_of(work, typeof(*notify), work); in nvif_notify_work() local
108 nvif_notify_func(notify, true); in nvif_notify_work()
114 struct nvif_notify *notify = NULL; in nvif_notify() local
123 notify = (void *)(unsigned long)args->v0.token; in nvif_notify()
126 if (!WARN_ON(notify == NULL)) { in nvif_notify()
127 struct nvif_client *client = nvif_client(notify->object); in nvif_notify()
128 if (!WARN_ON(notify->size != size)) { in nvif_notify()
129 atomic_inc(&notify->putcnt); in nvif_notify()
130 if (test_bit(NVIF_NOTIFY_WORK, &notify->flags)) { in nvif_notify()
131 memcpy((void *)notify->data, data, size); in nvif_notify()
132 schedule_work(&notify->work); in nvif_notify()
135 notify->data = data; in nvif_notify()
136 ret = nvif_notify_func(notify, client->driver->keep); in nvif_notify()
137 notify->data = NULL; in nvif_notify()
145 nvif_notify_fini(struct nvif_notify *notify) in nvif_notify_fini() argument
147 struct nvif_object *object = notify->object; in nvif_notify_fini()
153 .ntfy.index = notify->index, in nvif_notify_fini()
155 int ret = nvif_notify_put(notify); in nvif_notify_fini()
159 nvif_object_ref(NULL, &notify->object); in nvif_notify_fini()
160 kfree((void *)notify->data); in nvif_notify_fini()
169 void *data, u32 size, u32 reply, struct nvif_notify *notify) in nvif_notify_init() argument
178 notify->object = NULL; in nvif_notify_init()
179 nvif_object_ref(object, &notify->object); in nvif_notify_init()
180 notify->flags = 0; in nvif_notify_init()
181 atomic_set(&notify->putcnt, 1); in nvif_notify_init()
182 notify->dtor = dtor; in nvif_notify_init()
183 notify->func = func; in nvif_notify_init()
184 notify->data = NULL; in nvif_notify_init()
185 notify->size = reply; in nvif_notify_init()
187 INIT_WORK(&notify->work, nvif_notify_work); in nvif_notify_init()
188 set_bit(NVIF_NOTIFY_WORK, &notify->flags); in nvif_notify_init()
189 notify->data = kmalloc(notify->size, GFP_KERNEL); in nvif_notify_init()
190 if (!notify->data) in nvif_notify_init()
201 args->req.reply = notify->size; in nvif_notify_init()
203 args->req.token = (unsigned long)(void *)notify; in nvif_notify_init()
207 notify->index = args->ntfy.index; in nvif_notify_init()
211 nvif_notify_fini(notify); in nvif_notify_init()
216 nvif_notify_del(struct nvif_notify *notify) in nvif_notify_del() argument
218 nvif_notify_fini(notify); in nvif_notify_del()
219 kfree(notify); in nvif_notify_del()
223 nvif_notify_ref(struct nvif_notify *notify, struct nvif_notify **pnotify) in nvif_notify_ref() argument
225 BUG_ON(notify != NULL); in nvif_notify_ref()
228 *pnotify = notify; in nvif_notify_ref()
236 struct nvif_notify *notify = kzalloc(sizeof(*notify), GFP_KERNEL); in nvif_notify_new() local
237 if (notify) { in nvif_notify_new()
239 type, data, size, reply, notify); in nvif_notify_new()
241 kfree(notify); in nvif_notify_new()
242 notify = NULL; in nvif_notify_new()
244 *pnotify = notify; in nvif_notify_new()