Lines Matching defs:notify
27 #include <nvif/notify.h>
33 nvif_notify_put_(struct nvif_notify *notify)
35 struct nvif_object *object = notify->object;
41 .ntfy.index = notify->index,
44 if (atomic_inc_return(¬ify->putcnt) != 1)
51 nvif_notify_put(struct nvif_notify *notify)
53 if (likely(notify->object) &&
54 test_and_clear_bit(NVIF_NOTIFY_USER, ¬ify->flags)) {
55 int ret = nvif_notify_put_(notify);
56 if (test_bit(NVIF_NOTIFY_WORK, ¬ify->flags))
57 flush_work(¬ify->work);
64 nvif_notify_get_(struct nvif_notify *notify)
66 struct nvif_object *object = notify->object;
72 .ntfy.index = notify->index,
75 if (atomic_dec_return(¬ify->putcnt) != 0)
82 nvif_notify_get(struct nvif_notify *notify)
84 if (likely(notify->object) &&
85 !test_and_set_bit(NVIF_NOTIFY_USER, ¬ify->flags))
86 return nvif_notify_get_(notify);
91 nvif_notify_func(struct nvif_notify *notify, bool keep)
93 int ret = notify->func(notify);
95 !test_and_clear_bit(NVIF_NOTIFY_USER, ¬ify->flags)) {
97 atomic_dec(¬ify->putcnt);
99 nvif_notify_get_(notify);
107 struct nvif_notify *notify = container_of(work, typeof(*notify), work);
108 nvif_notify_func(notify, true);
114 struct nvif_notify *notify = NULL;
123 notify = (void *)(unsigned long)args->v0.token;
126 if (!WARN_ON(notify == NULL)) {
127 struct nvif_client *client = notify->object->client;
128 if (!WARN_ON(notify->size != size)) {
129 atomic_inc(¬ify->putcnt);
130 if (test_bit(NVIF_NOTIFY_WORK, ¬ify->flags)) {
131 memcpy((void *)notify->data, data, size);
132 schedule_work(¬ify->work);
135 notify->data = data;
136 ret = nvif_notify_func(notify, client->driver->keep);
137 notify->data = NULL;
145 nvif_notify_dtor(struct nvif_notify *notify)
147 struct nvif_object *object = notify->object;
153 .ntfy.index = notify->index,
155 int ret = nvif_notify_put(notify);
158 notify->object = NULL;
159 kfree((void *)notify->data);
167 void *data, u32 size, u32 reply, struct nvif_notify *notify)
176 notify->object = object;
177 notify->name = name ? name : "nvifNotify";
178 notify->flags = 0;
179 atomic_set(¬ify->putcnt, 1);
180 notify->func = func;
181 notify->data = NULL;
182 notify->size = reply;
184 INIT_WORK(¬ify->work, nvif_notify_work);
185 set_bit(NVIF_NOTIFY_WORK, ¬ify->flags);
186 notify->data = kmalloc(notify->size, GFP_KERNEL);
187 if (!notify->data)
198 args->req.reply = notify->size;
200 args->req.token = (unsigned long)(void *)notify;
204 notify->index = args->ntfy.index;
208 nvif_notify_dtor(notify);