Lines Matching refs:opts
1084 struct f_midi_opts *opts = to_f_midi_opts(item); in midi_attr_release() local
1086 usb_put_function_instance(&opts->func_inst); in midi_attr_release()
1096 struct f_midi_opts *opts = to_f_midi_opts(item); \
1099 mutex_lock(&opts->lock); \
1100 result = sprintf(page, "%d\n", opts->name); \
1101 mutex_unlock(&opts->lock); \
1109 struct f_midi_opts *opts = to_f_midi_opts(item); \
1113 mutex_lock(&opts->lock); \
1114 if (opts->refcnt > 1) { \
1127 opts->name = num; \
1131 mutex_unlock(&opts->lock); \
1145 struct f_midi_opts *opts = to_f_midi_opts(item); in f_midi_opts_id_show() local
1148 mutex_lock(&opts->lock); in f_midi_opts_id_show()
1149 if (opts->id) { in f_midi_opts_id_show()
1150 result = strlcpy(page, opts->id, PAGE_SIZE); in f_midi_opts_id_show()
1156 mutex_unlock(&opts->lock); in f_midi_opts_id_show()
1164 struct f_midi_opts *opts = to_f_midi_opts(item); in f_midi_opts_id_store() local
1168 mutex_lock(&opts->lock); in f_midi_opts_id_store()
1169 if (opts->refcnt > 1) { in f_midi_opts_id_store()
1179 if (opts->id_allocated) in f_midi_opts_id_store()
1180 kfree(opts->id); in f_midi_opts_id_store()
1181 opts->id = c; in f_midi_opts_id_store()
1182 opts->id_allocated = true; in f_midi_opts_id_store()
1185 mutex_unlock(&opts->lock); in f_midi_opts_id_store()
1209 struct f_midi_opts *opts; in f_midi_free_inst() local
1212 opts = container_of(f, struct f_midi_opts, func_inst); in f_midi_free_inst()
1214 mutex_lock(&opts->lock); in f_midi_free_inst()
1215 if (!--opts->refcnt) { in f_midi_free_inst()
1218 mutex_unlock(&opts->lock); in f_midi_free_inst()
1221 if (opts->id_allocated) in f_midi_free_inst()
1222 kfree(opts->id); in f_midi_free_inst()
1223 kfree(opts); in f_midi_free_inst()
1229 struct f_midi_opts *opts; in f_midi_alloc_inst() local
1231 opts = kzalloc(sizeof(*opts), GFP_KERNEL); in f_midi_alloc_inst()
1232 if (!opts) in f_midi_alloc_inst()
1235 mutex_init(&opts->lock); in f_midi_alloc_inst()
1236 opts->func_inst.free_func_inst = f_midi_free_inst; in f_midi_alloc_inst()
1237 opts->index = SNDRV_DEFAULT_IDX1; in f_midi_alloc_inst()
1238 opts->id = SNDRV_DEFAULT_STR1; in f_midi_alloc_inst()
1239 opts->buflen = 512; in f_midi_alloc_inst()
1240 opts->qlen = 32; in f_midi_alloc_inst()
1241 opts->in_ports = 1; in f_midi_alloc_inst()
1242 opts->out_ports = 1; in f_midi_alloc_inst()
1243 opts->refcnt = 1; in f_midi_alloc_inst()
1245 config_group_init_type_name(&opts->func_inst.group, "", in f_midi_alloc_inst()
1248 return &opts->func_inst; in f_midi_alloc_inst()
1254 struct f_midi_opts *opts; in f_midi_free() local
1258 opts = container_of(f->fi, struct f_midi_opts, func_inst); in f_midi_free()
1259 mutex_lock(&opts->lock); in f_midi_free()
1266 mutex_unlock(&opts->lock); in f_midi_free()
1269 f_midi_free_inst(&opts->func_inst); in f_midi_free()
1299 struct f_midi_opts *opts; in f_midi_alloc() local
1302 opts = container_of(fi, struct f_midi_opts, func_inst); in f_midi_alloc()
1304 mutex_lock(&opts->lock); in f_midi_alloc()
1306 if (opts->in_ports > MAX_PORTS || opts->out_ports > MAX_PORTS) { in f_midi_alloc()
1312 midi = kzalloc(struct_size(midi, in_ports_array, opts->in_ports), in f_midi_alloc()
1319 for (i = 0; i < opts->in_ports; i++) in f_midi_alloc()
1323 midi->id = kstrdup(opts->id, GFP_KERNEL); in f_midi_alloc()
1324 if (opts->id && !midi->id) { in f_midi_alloc()
1328 midi->in_ports = opts->in_ports; in f_midi_alloc()
1329 midi->out_ports = opts->out_ports; in f_midi_alloc()
1330 midi->index = opts->index; in f_midi_alloc()
1331 midi->buflen = opts->buflen; in f_midi_alloc()
1332 midi->qlen = opts->qlen; in f_midi_alloc()
1342 ++opts->refcnt; in f_midi_alloc()
1343 mutex_unlock(&opts->lock); in f_midi_alloc()
1359 mutex_unlock(&opts->lock); in f_midi_alloc()