Lines Matching +full:1 +full:- +full:v0
58 list_for_each_entry(ntfy, &cli->notifys, head) { in usif_notify_find()
59 if (ntfy->handle == handle) in usif_notify_find()
68 list_del(&ntfy->head); in usif_notify_dtor()
77 struct nvif_notify_rep_v0 v0; in usif_notify() member
83 if (length == sizeof(rep->v0) && rep->v0.version == 0) { in usif_notify()
84 if (WARN_ON(!(ntfy = (void *)(unsigned long)rep->v0.token))) in usif_notify()
86 BUG_ON(rep->v0.route != NVDRM_NOTIFY_USIF); in usif_notify()
88 if (WARN_ON(1)) in usif_notify()
91 if (WARN_ON(!ntfy->p || ntfy->reply != (length + size))) in usif_notify()
93 filp = ntfy->p->base.file_priv; in usif_notify()
94 dev = filp->minor->dev; in usif_notify()
96 memcpy(&ntfy->p->e.data[0], header, length); in usif_notify()
97 memcpy(&ntfy->p->e.data[length], data, size); in usif_notify()
98 switch (rep->v0.version) { in usif_notify()
100 struct nvif_notify_rep_v0 *rep = (void *)ntfy->p->e.data; in usif_notify()
101 rep->route = ntfy->route; in usif_notify()
102 rep->token = ntfy->token; in usif_notify()
110 spin_lock_irqsave(&dev->event_lock, flags); in usif_notify()
111 if (!WARN_ON(filp->event_space < ntfy->p->e.base.length)) { in usif_notify()
112 list_add_tail(&ntfy->p->base.link, &filp->event_list); in usif_notify()
113 filp->event_space -= ntfy->p->e.base.length; in usif_notify()
115 wake_up_interruptible(&filp->event_wait); in usif_notify()
116 spin_unlock_irqrestore(&dev->event_lock, flags); in usif_notify()
117 atomic_set(&ntfy->enabled, 0); in usif_notify()
125 struct nvif_client *client = &cli->base; in usif_notify_new()
127 struct nvif_ioctl_ntfy_new_v0 v0; in usif_notify_new() member
130 struct nvif_notify_req_v0 v0; in usif_notify_new() member
133 int ret = -ENOSYS; in usif_notify_new()
135 if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) { in usif_notify_new()
136 if (usif_notify_find(f, args->v0.index)) in usif_notify_new()
137 return -EEXIST; in usif_notify_new()
141 ret = -ENOSYS; in usif_notify_new()
144 return -ENOMEM; in usif_notify_new()
145 atomic_set(&ntfy->enabled, 0); in usif_notify_new()
147 if (!(ret = nvif_unpack(ret, &data, &size, req->v0, 0, 0, true))) { in usif_notify_new()
148 ntfy->reply = sizeof(struct nvif_notify_rep_v0) + req->v0.reply; in usif_notify_new()
149 ntfy->route = req->v0.route; in usif_notify_new()
150 ntfy->token = req->v0.token; in usif_notify_new()
151 req->v0.route = NVDRM_NOTIFY_USIF; in usif_notify_new()
152 req->v0.token = (unsigned long)(void *)ntfy; in usif_notify_new()
154 req->v0.token = ntfy->token; in usif_notify_new()
155 req->v0.route = ntfy->route; in usif_notify_new()
156 ntfy->handle = args->v0.index; in usif_notify_new()
160 list_add(&ntfy->head, &cli->notifys); in usif_notify_new()
170 struct nvif_client *client = &cli->base; in usif_notify_del()
172 struct nvif_ioctl_ntfy_del_v0 v0; in usif_notify_del() member
175 int ret = -ENOSYS; in usif_notify_del()
177 if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) { in usif_notify_del()
178 if (!(ntfy = usif_notify_find(f, args->v0.index))) in usif_notify_del()
179 return -ENOENT; in usif_notify_del()
193 struct nvif_client *client = &cli->base; in usif_notify_get()
195 struct nvif_ioctl_ntfy_del_v0 v0; in usif_notify_get() member
198 int ret = -ENOSYS; in usif_notify_get()
200 if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) { in usif_notify_get()
201 if (!(ntfy = usif_notify_find(f, args->v0.index))) in usif_notify_get()
202 return -ENOENT; in usif_notify_get()
206 if (atomic_xchg(&ntfy->enabled, 1)) in usif_notify_get()
209 ntfy->p = kmalloc(sizeof(*ntfy->p) + ntfy->reply, GFP_KERNEL); in usif_notify_get()
210 if (ret = -ENOMEM, !ntfy->p) in usif_notify_get()
212 ntfy->p->base.event = &ntfy->p->e.base; in usif_notify_get()
213 ntfy->p->base.file_priv = f; in usif_notify_get()
214 ntfy->p->e.base.type = DRM_NOUVEAU_EVENT_NVIF; in usif_notify_get()
215 ntfy->p->e.base.length = sizeof(ntfy->p->e.base) + ntfy->reply; in usif_notify_get()
220 atomic_set(&ntfy->enabled, 0); in usif_notify_get()
221 kfree(ntfy->p); in usif_notify_get()
230 struct nvif_client *client = &cli->base; in usif_notify_put()
232 struct nvif_ioctl_ntfy_put_v0 v0; in usif_notify_put() member
235 int ret = -ENOSYS; in usif_notify_put()
237 if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) { in usif_notify_put()
238 if (!(ntfy = usif_notify_find(f, args->v0.index))) in usif_notify_put()
239 return -ENOENT; in usif_notify_put()
244 if (ret == 0 && atomic_xchg(&ntfy->enabled, 0)) in usif_notify_put()
245 kfree(ntfy->p); in usif_notify_put()
259 list_del(&object->head); in usif_object_dtor()
267 struct nvif_client *client = &cli->base; in usif_object_new()
269 struct nvif_ioctl_new_v0 v0; in usif_object_new() member
272 int ret = -ENOSYS; in usif_object_new()
275 return -ENOMEM; in usif_object_new()
276 list_add(&object->head, &cli->objects); in usif_object_new()
278 if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) { in usif_object_new()
279 object->route = args->v0.route; in usif_object_new()
280 object->token = args->v0.token; in usif_object_new()
281 args->v0.route = NVDRM_OBJECT_USIF; in usif_object_new()
282 args->v0.token = (unsigned long)(void *)object; in usif_object_new()
284 args->v0.token = object->token; in usif_object_new()
285 args->v0.route = object->route; in usif_object_new()
297 struct nvif_client *client = &cli->base; in usif_ioctl()
301 struct nvif_ioctl_v0 v0; in usif_ioctl() member
307 if (ret = -ENOMEM, !argv) in usif_ioctl()
309 if (ret = -EFAULT, copy_from_user(argv, user, size)) in usif_ioctl()
312 if (!(ret = nvif_unpack(-ENOSYS, &data, &size, argv->v0, 0, 0, true))) { in usif_ioctl()
314 owner = argv->v0.owner; in usif_ioctl()
315 if (argv->v0.object == 0ULL && in usif_ioctl()
316 argv->v0.type != NVIF_IOCTL_V0_DEL) in usif_ioctl()
317 argv->v0.owner = NVDRM_OBJECT_ANY; /* except client */ in usif_ioctl()
319 argv->v0.owner = NVDRM_OBJECT_USIF; in usif_ioctl()
323 /* USIF slightly abuses some return-only ioctl members in order in usif_ioctl()
326 mutex_lock(&cli->mutex); in usif_ioctl()
327 if (argv->v0.route) { in usif_ioctl()
328 if (ret = -EINVAL, argv->v0.route == 0xff) in usif_ioctl()
331 mutex_unlock(&cli->mutex); in usif_ioctl()
336 switch (argv->v0.type) { in usif_ioctl()
356 if (argv->v0.route == NVDRM_OBJECT_USIF) { in usif_ioctl()
357 object = (void *)(unsigned long)argv->v0.token; in usif_ioctl()
358 argv->v0.route = object->route; in usif_ioctl()
359 argv->v0.token = object->token; in usif_ioctl()
360 if (ret == 0 && argv->v0.type == NVIF_IOCTL_V0_DEL) { in usif_ioctl()
361 list_del(&object->head); in usif_ioctl()
365 argv->v0.route = NVIF_IOCTL_V0_ROUTE_HIDDEN; in usif_ioctl()
366 argv->v0.token = 0; in usif_ioctl()
368 argv->v0.owner = owner; in usif_ioctl()
369 mutex_unlock(&cli->mutex); in usif_ioctl()
372 ret = -EFAULT; in usif_ioctl()
384 list_for_each_entry_safe(notify, ntemp, &cli->notifys, head) { in usif_client_fini()
388 list_for_each_entry_safe(object, otemp, &cli->objects, head) { in usif_client_fini()
396 INIT_LIST_HEAD(&cli->objects); in usif_client_init()
397 INIT_LIST_HEAD(&cli->notifys); in usif_client_init()