Lines Matching refs:client
68 static int bounce_error_event(struct snd_seq_client *client,
71 static int snd_seq_deliver_single_event(struct snd_seq_client *client,
76 static void free_ump_info(struct snd_seq_client *client);
93 static inline int snd_seq_write_pool_allocated(struct snd_seq_client *client) in snd_seq_write_pool_allocated() argument
95 return snd_seq_total_cells(client->pool) > 0; in snd_seq_write_pool_allocated()
111 struct snd_seq_client *client; in client_use_ptr() local
119 client = clientptr(clientid); in client_use_ptr()
120 if (client) in client_use_ptr()
121 return snd_seq_client_ref(client); in client_use_ptr()
154 client = clientptr(clientid); in client_use_ptr()
155 if (client) in client_use_ptr()
156 return snd_seq_client_ref(client); in client_use_ptr()
202 struct snd_seq_client *client; in seq_create_client1() local
205 client = kzalloc(sizeof(*client), GFP_KERNEL); in seq_create_client1()
206 if (client == NULL) in seq_create_client1()
208 client->pool = snd_seq_pool_new(poolsize); in seq_create_client1()
209 if (client->pool == NULL) { in seq_create_client1()
210 kfree(client); in seq_create_client1()
213 client->type = NO_CLIENT; in seq_create_client1()
214 snd_use_lock_init(&client->use_lock); in seq_create_client1()
215 rwlock_init(&client->ports_lock); in seq_create_client1()
216 mutex_init(&client->ports_mutex); in seq_create_client1()
217 INIT_LIST_HEAD(&client->ports_list_head); in seq_create_client1()
218 mutex_init(&client->ioctl_mutex); in seq_create_client1()
219 client->ump_endpoint_port = -1; in seq_create_client1()
229 clienttab[client->number = c] = client; in seq_create_client1()
230 return client; in seq_create_client1()
234 clienttab[client->number = client_index] = client; in seq_create_client1()
235 return client; in seq_create_client1()
240 snd_seq_pool_delete(&client->pool); in seq_create_client1()
241 kfree(client); in seq_create_client1()
246 static int seq_free_client1(struct snd_seq_client *client) in seq_free_client1() argument
248 if (!client) in seq_free_client1()
251 clienttablock[client->number] = 1; in seq_free_client1()
252 clienttab[client->number] = NULL; in seq_free_client1()
254 snd_seq_delete_all_ports(client); in seq_free_client1()
255 snd_seq_queue_client_leave(client->number); in seq_free_client1()
256 snd_use_lock_sync(&client->use_lock); in seq_free_client1()
257 if (client->pool) in seq_free_client1()
258 snd_seq_pool_delete(&client->pool); in seq_free_client1()
260 clienttablock[client->number] = 0; in seq_free_client1()
266 static void seq_free_client(struct snd_seq_client * client) in seq_free_client() argument
269 switch (client->type) { in seq_free_client()
272 client->number); in seq_free_client()
276 seq_free_client1(client); in seq_free_client()
282 client->number, client->type); in seq_free_client()
286 snd_seq_system_client_ev_client_exit(client->number); in seq_free_client()
297 struct snd_seq_client *client; in snd_seq_open() local
306 client = seq_create_client1(-1, SNDRV_SEQ_DEFAULT_EVENTS); in snd_seq_open()
307 if (!client) in snd_seq_open()
312 client->accept_input = 1; in snd_seq_open()
314 client->accept_output = 1; in snd_seq_open()
316 user = &client->data.user; in snd_seq_open()
324 seq_free_client1(client); in snd_seq_open()
325 kfree(client); in snd_seq_open()
331 client->type = USER_CLIENT; in snd_seq_open()
334 c = client->number; in snd_seq_open()
335 file->private_data = client; in snd_seq_open()
339 sprintf(client->name, "Client-%d", c); in snd_seq_open()
340 client->data.user.owner = get_pid(task_pid(current)); in snd_seq_open()
351 struct snd_seq_client *client = file->private_data; in snd_seq_release() local
353 if (client) { in snd_seq_release()
354 seq_free_client(client); in snd_seq_release()
355 if (client->data.user.fifo) in snd_seq_release()
356 snd_seq_fifo_delete(&client->data.user.fifo); in snd_seq_release()
358 free_ump_info(client); in snd_seq_release()
360 put_pid(client->data.user.owner); in snd_seq_release()
361 kfree(client); in snd_seq_release()
367 static bool event_is_compatible(const struct snd_seq_client *client, in event_is_compatible() argument
370 if (snd_seq_ev_is_ump(ev) && !client->midi_version) in event_is_compatible()
387 struct snd_seq_client *client = file->private_data; in snd_seq_read() local
401 if (snd_BUG_ON(!client)) in snd_seq_read()
404 if (!client->accept_input) in snd_seq_read()
406 fifo = client->data.user.fifo; in snd_seq_read()
421 if (IS_ENABLED(CONFIG_SND_SEQ_UMP) && client->midi_version > 0) in snd_seq_read()
434 if (!event_is_compatible(client, &cell->event)) { in snd_seq_read()
498 snd_seq_client_use_ptr(event->dest.client); in get_event_dest_client()
526 static int bounce_error_event(struct snd_seq_client *client, in bounce_error_event() argument
533 if (client == NULL || in bounce_error_event()
534 ! (client->filter & SNDRV_SEQ_FILTER_BOUNCE) || in bounce_error_event()
535 ! client->accept_input) in bounce_error_event()
543 bounce_ev.source.client = SNDRV_SEQ_CLIENT_SYSTEM; in bounce_error_event()
545 bounce_ev.dest.client = client->number; in bounce_error_event()
552 client->event_lost++; in bounce_error_event()
608 static int _snd_seq_deliver_single_event(struct snd_seq_client *client, in _snd_seq_deliver_single_event() argument
633 return snd_seq_deliver_from_ump(client, dest, dest_port, in _snd_seq_deliver_single_event()
640 return snd_seq_deliver_to_ump(client, dest, dest_port, in _snd_seq_deliver_single_event()
656 static int snd_seq_deliver_single_event(struct snd_seq_client *client, in snd_seq_deliver_single_event() argument
660 int result = _snd_seq_deliver_single_event(client, event, atomic, hop); in snd_seq_deliver_single_event()
663 return bounce_error_event(client, event, result, atomic, hop); in snd_seq_deliver_single_event()
671 static int __deliver_to_subscribers(struct snd_seq_client *client, in __deliver_to_subscribers() argument
685 snd_seq_port_use_ptr(client, port); in __deliver_to_subscribers()
708 err = snd_seq_deliver_single_event(client, event, atomic, hop); in __deliver_to_subscribers()
727 static int deliver_to_subscribers(struct snd_seq_client *client, in deliver_to_subscribers() argument
736 ret = __deliver_to_subscribers(client, event, in deliver_to_subscribers()
739 if (!snd_seq_client_is_ump(client) || client->ump_endpoint_port < 0) in deliver_to_subscribers()
745 if (event->source.port == client->ump_endpoint_port) in deliver_to_subscribers()
746 ret2 = __deliver_to_subscribers(client, event, in deliver_to_subscribers()
750 ret2 = __deliver_to_subscribers(client, event, in deliver_to_subscribers()
751 client->ump_endpoint_port, in deliver_to_subscribers()
767 static int snd_seq_deliver_event(struct snd_seq_client *client, struct snd_seq_event *event, in snd_seq_deliver_event() argument
775 event->source.client, event->source.port, in snd_seq_deliver_event()
776 event->dest.client, event->dest.port); in snd_seq_deliver_event()
785 event->dest.client == SNDRV_SEQ_ADDRESS_SUBSCRIBERS) in snd_seq_deliver_event()
786 result = deliver_to_subscribers(client, event, atomic, hop); in snd_seq_deliver_event()
788 result = snd_seq_deliver_single_event(client, event, atomic, hop); in snd_seq_deliver_event()
810 struct snd_seq_client *client __free(snd_seq_client) = in snd_seq_dispatch_event()
811 snd_seq_client_use_ptr(cell->event.source.client); in snd_seq_dispatch_event()
812 if (client == NULL) { in snd_seq_dispatch_event()
828 result = snd_seq_deliver_event(client, &tmpev, atomic, hop); in snd_seq_dispatch_event()
863 result = snd_seq_deliver_event(client, &cell->event, atomic, hop); in snd_seq_dispatch_event()
875 static int snd_seq_client_enqueue_event(struct snd_seq_client *client, in snd_seq_client_enqueue_event() argument
886 event->dest.client = SNDRV_SEQ_ADDRESS_SUBSCRIBERS; in snd_seq_client_enqueue_event()
888 } else if (event->dest.client == SNDRV_SEQ_ADDRESS_SUBSCRIBERS) { in snd_seq_client_enqueue_event()
891 snd_seq_port_use_ptr(client, event->source.port); in snd_seq_client_enqueue_event()
901 return snd_seq_deliver_event(client, event, atomic, hop); in snd_seq_client_enqueue_event()
905 if (snd_seq_queue_is_used(event->queue, client->number) <= 0) in snd_seq_client_enqueue_event()
907 if (! snd_seq_write_pool_allocated(client)) in snd_seq_client_enqueue_event()
911 err = snd_seq_event_dup(client->pool, event, &cell, !blocking || atomic, in snd_seq_client_enqueue_event()
966 struct snd_seq_client *client = file->private_data; in snd_seq_write() local
976 if (snd_BUG_ON(!client)) in snd_seq_write()
979 if (!client->accept_output || client->pool == NULL) in snd_seq_write()
985 mutex_lock(&client->ioctl_mutex); in snd_seq_write()
986 if (client->pool->size > 0 && !snd_seq_write_pool_allocated(client)) { in snd_seq_write()
987 err = snd_seq_pool_init(client->pool); in snd_seq_write()
1013 ev->source.client = client->number; /* fill in client number */ in snd_seq_write()
1020 if (!event_is_compatible(client, ev)) { in snd_seq_write()
1048 if (client->convert32 && snd_seq_ev_is_varusr(ev)) in snd_seq_write()
1055 err = snd_seq_client_enqueue_event(client, ev, file, in snd_seq_write()
1057 0, 0, &client->ioctl_mutex); in snd_seq_write()
1070 mutex_unlock(&client->ioctl_mutex); in snd_seq_write()
1076 mutex_unlock(&client->ioctl_mutex); in snd_seq_write()
1086 struct snd_seq_client *client = file->private_data; in snd_seq_poll() local
1090 if (snd_BUG_ON(!client)) in snd_seq_poll()
1094 client->data.user.fifo) { in snd_seq_poll()
1097 if (snd_seq_fifo_poll_wait(client->data.user.fifo, file, wait)) in snd_seq_poll()
1104 if (snd_seq_pool_poll_wait(client->pool, file, wait)) in snd_seq_poll()
1114 static int snd_seq_ioctl_pversion(struct snd_seq_client *client, void *arg) in snd_seq_ioctl_pversion() argument
1122 static int snd_seq_ioctl_user_pversion(struct snd_seq_client *client, void *arg) in snd_seq_ioctl_user_pversion() argument
1124 client->user_pversion = *(unsigned int *)arg; in snd_seq_ioctl_user_pversion()
1128 static int snd_seq_ioctl_client_id(struct snd_seq_client *client, void *arg) in snd_seq_ioctl_client_id() argument
1132 *client_id = client->number; in snd_seq_ioctl_client_id()
1137 static int snd_seq_ioctl_system_info(struct snd_seq_client *client, void *arg) in snd_seq_ioctl_system_info() argument
1155 static int snd_seq_ioctl_running_mode(struct snd_seq_client *client, void *arg) in snd_seq_ioctl_running_mode() argument
1160 client_load_and_use_ptr(info->client); in snd_seq_ioctl_running_mode()
1182 info->client = cptr->number; in get_client_info()
1207 static int snd_seq_ioctl_get_client_info(struct snd_seq_client *client, in snd_seq_ioctl_get_client_info() argument
1213 client_load_and_use_ptr(client_info->client); in snd_seq_ioctl_get_client_info()
1224 static int snd_seq_ioctl_set_client_info(struct snd_seq_client *client, in snd_seq_ioctl_set_client_info() argument
1230 if (client->number != client_info->client) in snd_seq_ioctl_set_client_info()
1233 if (client->type != client_info->type) in snd_seq_ioctl_set_client_info()
1236 if (client->user_pversion >= SNDRV_PROTOCOL_VERSION(1, 0, 3)) { in snd_seq_ioctl_set_client_info()
1249 strscpy(client->name, client_info->name, sizeof(client->name)); in snd_seq_ioctl_set_client_info()
1251 client->filter = client_info->filter; in snd_seq_ioctl_set_client_info()
1252 client->event_lost = client_info->event_lost; in snd_seq_ioctl_set_client_info()
1253 if (client->user_pversion >= SNDRV_PROTOCOL_VERSION(1, 0, 3)) in snd_seq_ioctl_set_client_info()
1254 client->midi_version = client_info->midi_version; in snd_seq_ioctl_set_client_info()
1255 memcpy(client->event_filter, client_info->event_filter, 32); in snd_seq_ioctl_set_client_info()
1256 client->group_filter = client_info->group_filter & SND_SEQ_GROUP_FILTER_MASK; in snd_seq_ioctl_set_client_info()
1259 snd_seq_system_client_ev_client_change(client->number); in snd_seq_ioctl_set_client_info()
1268 static int snd_seq_ioctl_create_port(struct snd_seq_client *client, void *arg) in snd_seq_ioctl_create_port() argument
1276 if (info->addr.client != client->number) in snd_seq_ioctl_create_port()
1278 if (client->type == USER_CLIENT && info->kernel) in snd_seq_ioctl_create_port()
1281 client->ump_endpoint_port >= 0) in snd_seq_ioctl_create_port()
1290 err = snd_seq_create_port(client, port_idx, &port); in snd_seq_ioctl_create_port()
1294 if (client->type == KERNEL_CLIENT) { in snd_seq_ioctl_create_port()
1313 client->ump_endpoint_port = port->addr.port; in snd_seq_ioctl_create_port()
1314 snd_seq_system_client_ev_port_start(port->addr.client, port->addr.port); in snd_seq_ioctl_create_port()
1323 static int snd_seq_ioctl_delete_port(struct snd_seq_client *client, void *arg) in snd_seq_ioctl_delete_port() argument
1329 if (info->addr.client != client->number) in snd_seq_ioctl_delete_port()
1332 err = snd_seq_delete_port(client, info->addr.port); in snd_seq_ioctl_delete_port()
1334 if (client->ump_endpoint_port == info->addr.port) in snd_seq_ioctl_delete_port()
1335 client->ump_endpoint_port = -1; in snd_seq_ioctl_delete_port()
1336 snd_seq_system_client_ev_port_exit(client->number, info->addr.port); in snd_seq_ioctl_delete_port()
1345 static int snd_seq_ioctl_get_port_info(struct snd_seq_client *client, void *arg) in snd_seq_ioctl_get_port_info() argument
1350 client_load_and_use_ptr(info->addr.client); in snd_seq_ioctl_get_port_info()
1368 static int snd_seq_ioctl_set_port_info(struct snd_seq_client *client, void *arg) in snd_seq_ioctl_set_port_info() argument
1372 if (info->addr.client != client->number) /* only set our own ports ! */ in snd_seq_ioctl_set_port_info()
1376 snd_seq_port_use_ptr(client, info->addr.port); in snd_seq_ioctl_set_port_info()
1380 snd_seq_system_client_ev_port_change(info->addr.client, in snd_seq_ioctl_set_port_info()
1393 static int check_subscription_permission(struct snd_seq_client *client, in check_subscription_permission() argument
1398 if (client->number != subs->sender.client && in check_subscription_permission()
1399 client->number != subs->dest.client) { in check_subscription_permission()
1411 if (client->number != subs->sender.client) { in check_subscription_permission()
1416 if (client->number != subs->dest.client) { in check_subscription_permission()
1427 int snd_seq_client_notify_subscription(int client, int port, in snd_seq_client_notify_subscription() argument
1438 return snd_seq_system_notify(client, port, &event, false); /* non-atomic */ in snd_seq_client_notify_subscription()
1445 static int snd_seq_ioctl_subscribe_port(struct snd_seq_client *client, in snd_seq_ioctl_subscribe_port() argument
1452 client_load_and_use_ptr(subs->dest.client); in snd_seq_ioctl_subscribe_port()
1456 client_load_and_use_ptr(subs->sender.client); in snd_seq_ioctl_subscribe_port()
1468 result = check_subscription_permission(client, sport, dport, subs); in snd_seq_ioctl_subscribe_port()
1473 result = snd_seq_port_connect(client, sender, sport, receiver, dport, subs); in snd_seq_ioctl_subscribe_port()
1484 static int snd_seq_ioctl_unsubscribe_port(struct snd_seq_client *client, in snd_seq_ioctl_unsubscribe_port() argument
1491 snd_seq_client_use_ptr(subs->dest.client); in snd_seq_ioctl_unsubscribe_port()
1495 snd_seq_client_use_ptr(subs->sender.client); in snd_seq_ioctl_unsubscribe_port()
1507 result = check_subscription_permission(client, sport, dport, subs); in snd_seq_ioctl_unsubscribe_port()
1511 result = snd_seq_port_disconnect(client, sender, sport, receiver, dport, subs); in snd_seq_ioctl_unsubscribe_port()
1520 static int snd_seq_ioctl_create_queue(struct snd_seq_client *client, void *arg) in snd_seq_ioctl_create_queue() argument
1524 snd_seq_queue_alloc(client->number, info->locked, info->flags); in snd_seq_ioctl_create_queue()
1542 static int snd_seq_ioctl_delete_queue(struct snd_seq_client *client, void *arg) in snd_seq_ioctl_delete_queue() argument
1546 return snd_seq_queue_delete(client->number, info->queue); in snd_seq_ioctl_delete_queue()
1550 static int snd_seq_ioctl_get_queue_info(struct snd_seq_client *client, in snd_seq_ioctl_get_queue_info() argument
1570 static int snd_seq_ioctl_set_queue_info(struct snd_seq_client *client, in snd_seq_ioctl_set_queue_info() argument
1575 if (info->owner != client->number) in snd_seq_ioctl_set_queue_info()
1579 if (snd_seq_queue_check_access(info->queue, client->number)) { in snd_seq_ioctl_set_queue_info()
1580 if (snd_seq_queue_set_owner(info->queue, client->number, info->locked) < 0) in snd_seq_ioctl_set_queue_info()
1583 snd_seq_queue_use(info->queue, client->number, 1); in snd_seq_ioctl_set_queue_info()
1592 if (q->owner != client->number) in snd_seq_ioctl_set_queue_info()
1600 static int snd_seq_ioctl_get_named_queue(struct snd_seq_client *client, in snd_seq_ioctl_get_named_queue() argument
1617 static int snd_seq_ioctl_get_queue_status(struct snd_seq_client *client, in snd_seq_ioctl_get_queue_status() argument
1645 static int snd_seq_ioctl_get_queue_tempo(struct snd_seq_client *client, in snd_seq_ioctl_get_queue_tempo() argument
1664 if (client->user_pversion >= SNDRV_PROTOCOL_VERSION(1, 0, 4)) in snd_seq_ioctl_get_queue_tempo()
1672 int snd_seq_set_queue_tempo(int client, struct snd_seq_queue_tempo *tempo) in snd_seq_set_queue_tempo() argument
1674 if (!snd_seq_queue_check_access(tempo->queue, client)) in snd_seq_set_queue_tempo()
1676 return snd_seq_queue_timer_set_tempo(tempo->queue, client, tempo); in snd_seq_set_queue_tempo()
1680 static int snd_seq_ioctl_set_queue_tempo(struct snd_seq_client *client, in snd_seq_ioctl_set_queue_tempo() argument
1686 if (client->user_pversion < SNDRV_PROTOCOL_VERSION(1, 0, 4)) in snd_seq_ioctl_set_queue_tempo()
1688 result = snd_seq_set_queue_tempo(client->number, tempo); in snd_seq_ioctl_set_queue_tempo()
1694 static int snd_seq_ioctl_get_queue_timer(struct snd_seq_client *client, in snd_seq_ioctl_get_queue_timer() argument
1721 static int snd_seq_ioctl_set_queue_timer(struct snd_seq_client *client, in snd_seq_ioctl_set_queue_timer() argument
1730 if (snd_seq_queue_check_access(timer->queue, client->number)) { in snd_seq_ioctl_set_queue_timer()
1755 static int snd_seq_ioctl_get_queue_client(struct snd_seq_client *client, in snd_seq_ioctl_get_queue_client() argument
1761 used = snd_seq_queue_is_used(info->queue, client->number); in snd_seq_ioctl_get_queue_client()
1765 info->client = client->number; in snd_seq_ioctl_get_queue_client()
1772 static int snd_seq_ioctl_set_queue_client(struct snd_seq_client *client, in snd_seq_ioctl_set_queue_client() argument
1779 err = snd_seq_queue_use(info->queue, client->number, info->used); in snd_seq_ioctl_set_queue_client()
1784 return snd_seq_ioctl_get_queue_client(client, arg); in snd_seq_ioctl_set_queue_client()
1789 static int snd_seq_ioctl_get_client_pool(struct snd_seq_client *client, in snd_seq_ioctl_get_client_pool() argument
1794 client_load_and_use_ptr(info->client); in snd_seq_ioctl_get_client_pool()
1799 info->client = cptr->number; in snd_seq_ioctl_get_client_pool()
1817 static int snd_seq_ioctl_set_client_pool(struct snd_seq_client *client, in snd_seq_ioctl_set_client_pool() argument
1823 if (client->number != info->client) in snd_seq_ioctl_set_client_pool()
1827 (! snd_seq_write_pool_allocated(client) || in snd_seq_ioctl_set_client_pool()
1828 info->output_pool != client->pool->size)) { in snd_seq_ioctl_set_client_pool()
1829 if (snd_seq_write_pool_allocated(client)) { in snd_seq_ioctl_set_client_pool()
1831 if (atomic_read(&client->pool->counter)) in snd_seq_ioctl_set_client_pool()
1834 snd_seq_pool_mark_closing(client->pool); in snd_seq_ioctl_set_client_pool()
1835 snd_seq_pool_done(client->pool); in snd_seq_ioctl_set_client_pool()
1837 client->pool->size = info->output_pool; in snd_seq_ioctl_set_client_pool()
1838 rc = snd_seq_pool_init(client->pool); in snd_seq_ioctl_set_client_pool()
1842 if (client->type == USER_CLIENT && client->data.user.fifo != NULL && in snd_seq_ioctl_set_client_pool()
1845 info->input_pool != client->data.user.fifo_pool_size) { in snd_seq_ioctl_set_client_pool()
1847 rc = snd_seq_fifo_resize(client->data.user.fifo, info->input_pool); in snd_seq_ioctl_set_client_pool()
1850 client->data.user.fifo_pool_size = info->input_pool; in snd_seq_ioctl_set_client_pool()
1853 info->output_room <= client->pool->size) { in snd_seq_ioctl_set_client_pool()
1854 client->pool->room = info->output_room; in snd_seq_ioctl_set_client_pool()
1857 return snd_seq_ioctl_get_client_pool(client, arg); in snd_seq_ioctl_set_client_pool()
1862 static int snd_seq_ioctl_remove_events(struct snd_seq_client *client, in snd_seq_ioctl_remove_events() argument
1875 if (client->type == USER_CLIENT && client->data.user.fifo) in snd_seq_ioctl_remove_events()
1876 snd_seq_fifo_clear(client->data.user.fifo); in snd_seq_ioctl_remove_events()
1880 snd_seq_queue_remove_cells(client->number, info); in snd_seq_ioctl_remove_events()
1889 static int snd_seq_ioctl_get_subscription(struct snd_seq_client *client, in snd_seq_ioctl_get_subscription() argument
1895 client_load_and_use_ptr(subs->sender.client); in snd_seq_ioctl_get_subscription()
1909 static int snd_seq_ioctl_query_subs(struct snd_seq_client *client, void *arg) in snd_seq_ioctl_query_subs() argument
1917 client_load_and_use_ptr(subs->root.client); in snd_seq_ioctl_query_subs()
1964 static int snd_seq_ioctl_query_next_client(struct snd_seq_client *client, in snd_seq_ioctl_query_next_client() argument
1970 if (info->client < INT_MAX) in snd_seq_ioctl_query_next_client()
1971 info->client++; in snd_seq_ioctl_query_next_client()
1972 if (info->client < 0) in snd_seq_ioctl_query_next_client()
1973 info->client = 0; in snd_seq_ioctl_query_next_client()
1974 for (; info->client < SNDRV_SEQ_MAX_CLIENTS; info->client++) { in snd_seq_ioctl_query_next_client()
1976 client_load_and_use_ptr(info->client); in snd_seq_ioctl_query_next_client()
1988 static int snd_seq_ioctl_query_next_port(struct snd_seq_client *client, in snd_seq_ioctl_query_next_port() argument
1994 client_load_and_use_ptr(info->addr.client); in snd_seq_ioctl_query_next_port()
2015 static void free_ump_info(struct snd_seq_client *client) in free_ump_info() argument
2019 if (!client->ump_info) in free_ump_info()
2022 kfree(client->ump_info[i]); in free_ump_info()
2023 kfree(client->ump_info); in free_ump_info()
2024 client->ump_info = NULL; in free_ump_info()
2040 struct snd_seq_client *client) in dump_ump_info() argument
2046 if (!client->ump_info) in dump_ump_info()
2048 ep = client->ump_info[SNDRV_SEQ_CLIENT_UMP_INFO_ENDPOINT]; in dump_ump_info()
2052 bp = client->ump_info[i + 1]; in dump_ump_info()
2072 int client, type, err = 0; in snd_seq_ioctl_client_ump_info() local
2076 if (get_user(client, &argp->client) || get_user(type, &argp->type)) in snd_seq_ioctl_client_ump_info()
2079 caller->number != client) in snd_seq_ioctl_client_ump_info()
2089 client_load_and_use_ptr(client); in snd_seq_ioctl_client_ump_info()
2138 snd_seq_system_ump_notify(client, 0, in snd_seq_ioctl_client_ump_info()
2142 snd_seq_system_ump_notify(client, type - 1, in snd_seq_ioctl_client_ump_info()
2154 int (*func)(struct snd_seq_client *client, void *arg);
2194 struct snd_seq_client *client = file->private_data; in snd_seq_ioctl() local
2217 if (snd_BUG_ON(!client)) in snd_seq_ioctl()
2225 return snd_seq_ioctl_client_ump_info(client, cmd, arg); in snd_seq_ioctl()
2248 scoped_guard(mutex, &client->ioctl_mutex) { in snd_seq_ioctl()
2249 err = handler->func(client, &buf); in snd_seq_ioctl()
2276 struct snd_seq_client *client; in snd_seq_create_kernel_client() local
2297 client = seq_create_client1(client_index, 0); in snd_seq_create_kernel_client()
2298 if (client == NULL) in snd_seq_create_kernel_client()
2302 client->accept_input = 1; in snd_seq_create_kernel_client()
2303 client->accept_output = 1; in snd_seq_create_kernel_client()
2304 client->data.kernel.card = card; in snd_seq_create_kernel_client()
2305 client->user_pversion = SNDRV_SEQ_VERSION; in snd_seq_create_kernel_client()
2308 vsnprintf(client->name, sizeof(client->name), name_fmt, args); in snd_seq_create_kernel_client()
2311 client->type = KERNEL_CLIENT; in snd_seq_create_kernel_client()
2315 snd_seq_system_client_ev_client_start(client->number); in snd_seq_create_kernel_client()
2318 return client->number; in snd_seq_create_kernel_client()
2323 int snd_seq_delete_kernel_client(int client) in snd_seq_delete_kernel_client() argument
2330 ptr = clientptr(client); in snd_seq_delete_kernel_client()
2345 int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev, in snd_seq_kernel_client_enqueue() argument
2359 ev->source.client = client; in snd_seq_kernel_client_enqueue()
2365 client_load_and_use_ptr(client); in snd_seq_kernel_client_enqueue()
2387 int snd_seq_kernel_client_dispatch(int client, struct snd_seq_event * ev, in snd_seq_kernel_client_dispatch() argument
2395 ev->source.client = client; in snd_seq_kernel_client_dispatch()
2401 snd_seq_client_use_ptr(client); in snd_seq_kernel_client_dispatch()
2412 static int call_seq_client_ctl(struct snd_seq_client *client, in call_seq_client_ctl() argument
2419 return handler->func(client, arg); in call_seq_client_ctl()
2441 struct snd_seq_client *client; in snd_seq_kernel_client_ctl() local
2443 client = clientptr(clientid); in snd_seq_kernel_client_ctl()
2444 if (client == NULL) in snd_seq_kernel_client_ctl()
2447 return call_seq_client_ctl(client, cmd, arg); in snd_seq_kernel_client_ctl()
2454 struct snd_seq_client *client __free(snd_seq_client) = in snd_seq_kernel_client_ioctl()
2457 if (!client) in snd_seq_kernel_client_ioctl()
2459 guard(mutex)(&client->ioctl_mutex); in snd_seq_kernel_client_ioctl()
2460 return call_seq_client_ctl(client, cmd, arg); in snd_seq_kernel_client_ioctl()
2467 struct snd_seq_client *client; in snd_seq_kernel_client_write_poll() local
2469 client = clientptr(clientid); in snd_seq_kernel_client_write_poll()
2470 if (client == NULL) in snd_seq_kernel_client_write_poll()
2473 if (snd_seq_pool_poll_wait(client->pool, file, wait)) in snd_seq_kernel_client_write_poll()
2520 is_src ? s->info.dest.client : s->info.sender.client, in snd_seq_info_dump_subscribers()
2548 struct snd_seq_client *client) in snd_seq_info_dump_ports() argument
2552 guard(mutex)(&client->ports_mutex); in snd_seq_info_dump_ports()
2553 list_for_each_entry(p, &client->ports_list_head, list) { in snd_seq_info_dump_ports()
2564 if (snd_seq_client_is_midi2(client) && p->is_midi1) in snd_seq_info_dump_ports()
2601 struct snd_seq_client *client __free(snd_seq_client) = in snd_seq_info_clients_read()
2604 if (client == NULL) in snd_seq_info_clients_read()
2606 if (client->type == NO_CLIENT) in snd_seq_info_clients_read()
2609 guard(mutex)(&client->ioctl_mutex); in snd_seq_info_clients_read()
2611 c, client->name, in snd_seq_info_clients_read()
2612 client->type == USER_CLIENT ? "User" : "Kernel", in snd_seq_info_clients_read()
2613 midi_version_string(client->midi_version)); in snd_seq_info_clients_read()
2615 dump_ump_info(buffer, client); in snd_seq_info_clients_read()
2617 snd_seq_info_dump_ports(buffer, client); in snd_seq_info_clients_read()
2618 if (snd_seq_write_pool_allocated(client)) { in snd_seq_info_clients_read()
2620 snd_seq_info_pool(buffer, client->pool, " "); in snd_seq_info_clients_read()
2622 if (client->type == USER_CLIENT && client->data.user.fifo && in snd_seq_info_clients_read()
2623 client->data.user.fifo->pool) { in snd_seq_info_clients_read()
2625 snd_seq_info_pool(buffer, client->data.user.fifo->pool, " "); in snd_seq_info_clients_read()