Lines Matching refs:opts
2107 static ssize_t f_midi2_opts_uint_show(struct f_midi2_opts *opts, in f_midi2_opts_uint_show() argument
2112 mutex_lock(&opts->lock); in f_midi2_opts_uint_show()
2114 mutex_unlock(&opts->lock); in f_midi2_opts_uint_show()
2118 static ssize_t f_midi2_opts_uint_store(struct f_midi2_opts *opts, in f_midi2_opts_uint_store() argument
2125 mutex_lock(&opts->lock); in f_midi2_opts_uint_store()
2126 if (opts->refcnt) { in f_midi2_opts_uint_store()
2143 mutex_unlock(&opts->lock); in f_midi2_opts_uint_store()
2148 static ssize_t f_midi2_opts_bool_store(struct f_midi2_opts *opts, in f_midi2_opts_bool_store() argument
2154 mutex_lock(&opts->lock); in f_midi2_opts_bool_store()
2155 if (opts->refcnt) { in f_midi2_opts_bool_store()
2167 mutex_unlock(&opts->lock); in f_midi2_opts_bool_store()
2172 static ssize_t f_midi2_opts_str_show(struct f_midi2_opts *opts, in f_midi2_opts_str_show() argument
2177 mutex_lock(&opts->lock); in f_midi2_opts_str_show()
2180 mutex_unlock(&opts->lock); in f_midi2_opts_str_show()
2184 static ssize_t f_midi2_opts_str_store(struct f_midi2_opts *opts, in f_midi2_opts_str_store() argument
2191 mutex_lock(&opts->lock); in f_midi2_opts_str_store()
2192 if (opts->refcnt) { in f_midi2_opts_str_store()
2209 mutex_unlock(&opts->lock); in f_midi2_opts_str_store()
2222 struct f_midi2_block_opts *opts = to_f_midi2_block_opts(item); \
2223 return f_midi2_opts_uint_show(opts->ep->opts, opts->info.name, \
2230 struct f_midi2_block_opts *opts = to_f_midi2_block_opts(item); \
2231 return f_midi2_opts_uint_store(opts->ep->opts, &opts->info.name,\
2242 struct f_midi2_block_opts *opts = to_f_midi2_block_opts(item); \
2243 return f_midi2_opts_uint_show(opts->ep->opts, opts->info.name, \
2250 struct f_midi2_block_opts *opts = to_f_midi2_block_opts(item); \
2251 return f_midi2_opts_bool_store(opts->ep->opts, &opts->info.name,\
2271 struct f_midi2_block_opts *opts = to_f_midi2_block_opts(item); in f_midi2_block_opts_name_show() local
2273 return f_midi2_opts_str_show(opts->ep->opts, opts->info.name, page); in f_midi2_block_opts_name_show()
2279 struct f_midi2_block_opts *opts = to_f_midi2_block_opts(item); in f_midi2_block_opts_name_store() local
2281 return f_midi2_opts_str_store(opts->ep->opts, &opts->info.name, 128, in f_midi2_block_opts_name_store()
2304 struct f_midi2_block_opts *opts = to_f_midi2_block_opts(item); in f_midi2_block_opts_release() local
2306 kfree(opts->info.name); in f_midi2_block_opts_release()
2307 kfree(opts); in f_midi2_block_opts_release()
2328 mutex_lock(&ep_opts->opts->lock); in f_midi2_block_opts_create()
2329 if (ep_opts->opts->refcnt || ep_opts->blks[blk]) { in f_midi2_block_opts_create()
2354 mutex_unlock(&ep_opts->opts->lock); in f_midi2_block_opts_create()
2394 mutex_lock(&block_opts->ep->opts->lock); in f_midi2_opts_block_drop()
2396 mutex_unlock(&block_opts->ep->opts->lock); in f_midi2_opts_block_drop()
2409 struct f_midi2_ep_opts *opts = to_f_midi2_ep_opts(item); \
2410 return f_midi2_opts_uint_show(opts->opts, opts->info.name, \
2417 struct f_midi2_ep_opts *opts = to_f_midi2_ep_opts(item); \
2418 return f_midi2_opts_uint_store(opts->opts, &opts->info.name, \
2429 struct f_midi2_ep_opts *opts = to_f_midi2_ep_opts(item); \
2430 return f_midi2_opts_str_show(opts->opts, opts->info.name, page);\
2436 struct f_midi2_ep_opts *opts = to_f_midi2_ep_opts(item); \
2437 return f_midi2_opts_str_store(opts->opts, &opts->info.name, maxlen,\
2466 struct f_midi2_ep_opts *opts = to_f_midi2_ep_opts(item); in f_midi2_ep_opts_release() local
2468 kfree(opts->info.ep_name); in f_midi2_ep_opts_release()
2469 kfree(opts->info.product_id); in f_midi2_ep_opts_release()
2470 kfree(opts); in f_midi2_ep_opts_release()
2490 static int f_midi2_ep_opts_create(struct f_midi2_opts *opts, in f_midi2_ep_opts_create() argument
2500 ep_opts->opts = opts; in f_midi2_ep_opts_create()
2507 opts->eps[index] = ep_opts; in f_midi2_ep_opts_create()
2516 struct f_midi2_opts *opts; in f_midi2_opts_ep_make() local
2527 opts = to_f_midi2_opts(&group->cg_item); in f_midi2_opts_ep_make()
2530 if (opts->eps[index]) in f_midi2_opts_ep_make()
2532 ret = f_midi2_ep_opts_create(opts, index, &ep_opts); in f_midi2_opts_ep_make()
2546 mutex_lock(&ep_opts->opts->lock); in f_midi2_opts_ep_drop()
2547 ep_opts->opts->eps[ep_opts->index] = NULL; in f_midi2_opts_ep_drop()
2548 mutex_unlock(&ep_opts->opts->lock); in f_midi2_opts_ep_drop()
2561 struct f_midi2_opts *opts = to_f_midi2_opts(item); \
2562 return f_midi2_opts_uint_show(opts, opts->info.name, \
2569 struct f_midi2_opts *opts = to_f_midi2_opts(item); \
2570 return f_midi2_opts_bool_store(opts, &opts->info.name, \
2582 struct f_midi2_opts *opts = to_f_midi2_opts(item); in f_midi2_opts_iface_name_show() local
2584 return f_midi2_opts_str_show(opts, opts->info.iface_name, page); in f_midi2_opts_iface_name_show()
2590 struct f_midi2_opts *opts = to_f_midi2_opts(item); in f_midi2_opts_iface_name_store() local
2592 return f_midi2_opts_str_store(opts, &opts->info.iface_name, 128, in f_midi2_opts_iface_name_store()
2607 struct f_midi2_opts *opts = to_f_midi2_opts(item); in f_midi2_opts_release() local
2609 usb_put_function_instance(&opts->func_inst); in f_midi2_opts_release()
2630 struct f_midi2_opts *opts; in f_midi2_free_inst() local
2632 opts = container_of(f, struct f_midi2_opts, func_inst); in f_midi2_free_inst()
2634 kfree(opts->info.iface_name); in f_midi2_free_inst()
2635 kfree(opts); in f_midi2_free_inst()
2641 struct f_midi2_opts *opts; in f_midi2_alloc_inst() local
2646 opts = kzalloc(sizeof(*opts), GFP_KERNEL); in f_midi2_alloc_inst()
2647 if (!opts) in f_midi2_alloc_inst()
2650 mutex_init(&opts->lock); in f_midi2_alloc_inst()
2651 opts->func_inst.free_func_inst = f_midi2_free_inst; in f_midi2_alloc_inst()
2652 opts->info.process_ump = true; in f_midi2_alloc_inst()
2653 opts->info.static_block = true; in f_midi2_alloc_inst()
2654 opts->info.num_reqs = 32; in f_midi2_alloc_inst()
2655 opts->info.req_buf_size = 512; in f_midi2_alloc_inst()
2658 ret = f_midi2_ep_opts_create(opts, 0, &ep_opts); in f_midi2_alloc_inst()
2660 kfree(opts); in f_midi2_alloc_inst()
2668 kfree(opts); in f_midi2_alloc_inst()
2675 config_group_init_type_name(&opts->func_inst.group, "", in f_midi2_alloc_inst()
2680 configfs_add_default_group(&ep_opts->group, &opts->func_inst.group); in f_midi2_alloc_inst()
2686 return &opts->func_inst; in f_midi2_alloc_inst()
2689 static void do_f_midi2_free(struct f_midi2 *midi2, struct f_midi2_opts *opts) in do_f_midi2_free() argument
2691 mutex_lock(&opts->lock); in do_f_midi2_free()
2692 --opts->refcnt; in do_f_midi2_free()
2693 mutex_unlock(&opts->lock); in do_f_midi2_free()
2707 static int verify_parameters(struct f_midi2_opts *opts) in verify_parameters() argument
2713 for (num_eps = 0; num_eps < MAX_UMP_EPS && opts->eps[num_eps]; in verify_parameters()
2723 ep = &opts->eps[i]->info; in verify_parameters()
2730 for (j = 0; j < SNDRV_UMP_MAX_BLOCKS && opts->eps[i]->blks[j]; in verify_parameters()
2732 bp = &opts->eps[i]->blks[j]->info; in verify_parameters()
2802 struct f_midi2_opts *opts; in f_midi2_alloc() local
2811 opts = container_of(fi, struct f_midi2_opts, func_inst); in f_midi2_alloc()
2812 mutex_lock(&opts->lock); in f_midi2_alloc()
2813 num_eps = verify_parameters(opts); in f_midi2_alloc()
2815 mutex_unlock(&opts->lock); in f_midi2_alloc()
2819 ++opts->refcnt; in f_midi2_alloc()
2820 mutex_unlock(&opts->lock); in f_midi2_alloc()
2833 midi2->info = opts->info; in f_midi2_alloc()
2838 ep->info = opts->eps[i]->info; in f_midi2_alloc()
2841 opts->eps[i]->blks[blk]; blk++) { in f_midi2_alloc()
2844 bp->info = opts->eps[i]->blks[blk]->info; in f_midi2_alloc()
2852 do_f_midi2_free(midi2, opts); in f_midi2_alloc()
2856 if (opts->info.iface_name && *opts->info.iface_name) in f_midi2_alloc()
2857 midi2->string_defs[STR_IFACE].s = opts->info.iface_name; in f_midi2_alloc()
2874 do_f_midi2_free(midi2, opts); in f_midi2_alloc()