Lines Matching refs:opts
1218 struct f_printer_opts *opts = to_f_printer_opts(item); in printer_attr_release() local
1220 usb_put_function_instance(&opts->func_inst); in printer_attr_release()
1230 struct f_printer_opts *opts = to_f_printer_opts(item); in f_printer_opts_pnp_string_show() local
1233 mutex_lock(&opts->lock); in f_printer_opts_pnp_string_show()
1234 if (!opts->pnp_string) in f_printer_opts_pnp_string_show()
1237 result = strscpy(page, opts->pnp_string, PAGE_SIZE); in f_printer_opts_pnp_string_show()
1246 mutex_unlock(&opts->lock); in f_printer_opts_pnp_string_show()
1254 struct f_printer_opts *opts = to_f_printer_opts(item); in f_printer_opts_pnp_string_store() local
1258 mutex_lock(&opts->lock); in f_printer_opts_pnp_string_store()
1266 if (opts->pnp_string_allocated) in f_printer_opts_pnp_string_store()
1267 kfree(opts->pnp_string); in f_printer_opts_pnp_string_store()
1269 opts->pnp_string_allocated = true; in f_printer_opts_pnp_string_store()
1270 opts->pnp_string = new_pnp; in f_printer_opts_pnp_string_store()
1273 mutex_unlock(&opts->lock); in f_printer_opts_pnp_string_store()
1283 struct f_printer_opts *opts = to_f_printer_opts(item); in f_printer_opts_q_len_show() local
1286 mutex_lock(&opts->lock); in f_printer_opts_q_len_show()
1287 result = sprintf(page, "%d\n", opts->q_len); in f_printer_opts_q_len_show()
1288 mutex_unlock(&opts->lock); in f_printer_opts_q_len_show()
1296 struct f_printer_opts *opts = to_f_printer_opts(item); in f_printer_opts_q_len_store() local
1300 mutex_lock(&opts->lock); in f_printer_opts_q_len_store()
1301 if (opts->refcnt) { in f_printer_opts_q_len_store()
1310 opts->q_len = (unsigned)num; in f_printer_opts_q_len_store()
1313 mutex_unlock(&opts->lock); in f_printer_opts_q_len_store()
1354 struct f_printer_opts *opts; in gprinter_free_inst() local
1356 opts = container_of(f, struct f_printer_opts, func_inst); in gprinter_free_inst()
1360 gprinter_put_minor(opts->minor); in gprinter_free_inst()
1366 if (opts->pnp_string_allocated) in gprinter_free_inst()
1367 kfree(opts->pnp_string); in gprinter_free_inst()
1368 kfree(opts); in gprinter_free_inst()
1373 struct f_printer_opts *opts; in gprinter_alloc_inst() local
1377 opts = kzalloc(sizeof(*opts), GFP_KERNEL); in gprinter_alloc_inst()
1378 if (!opts) in gprinter_alloc_inst()
1381 mutex_init(&opts->lock); in gprinter_alloc_inst()
1382 opts->func_inst.free_func_inst = gprinter_free_inst; in gprinter_alloc_inst()
1383 ret = &opts->func_inst; in gprinter_alloc_inst()
1386 opts->q_len = DEFAULT_Q_LEN; in gprinter_alloc_inst()
1394 kfree(opts); in gprinter_alloc_inst()
1399 opts->minor = gprinter_get_minor(); in gprinter_alloc_inst()
1400 if (opts->minor < 0) { in gprinter_alloc_inst()
1401 ret = ERR_PTR(opts->minor); in gprinter_alloc_inst()
1402 kfree(opts); in gprinter_alloc_inst()
1407 config_group_init_type_name(&opts->func_inst.group, "", in gprinter_alloc_inst()
1418 struct f_printer_opts *opts; in gprinter_free() local
1420 opts = container_of(f->fi, struct f_printer_opts, func_inst); in gprinter_free()
1423 mutex_lock(&opts->lock); in gprinter_free()
1424 --opts->refcnt; in gprinter_free()
1425 mutex_unlock(&opts->lock); in gprinter_free()
1475 struct f_printer_opts *opts; in gprinter_alloc() local
1477 opts = container_of(fi, struct f_printer_opts, func_inst); in gprinter_alloc()
1479 mutex_lock(&opts->lock); in gprinter_alloc()
1480 if (opts->minor >= minors) { in gprinter_alloc()
1481 mutex_unlock(&opts->lock); in gprinter_alloc()
1487 mutex_unlock(&opts->lock); in gprinter_alloc()
1492 ++opts->refcnt; in gprinter_alloc()
1493 dev->minor = opts->minor; in gprinter_alloc()
1494 dev->pnp_string = &opts->pnp_string; in gprinter_alloc()
1495 dev->q_len = opts->q_len; in gprinter_alloc()
1496 mutex_unlock(&opts->lock); in gprinter_alloc()