Lines Matching refs:opts

1155 	struct f_printer_opts *opts = to_f_printer_opts(item);  in printer_attr_release()  local
1157 usb_put_function_instance(&opts->func_inst); in printer_attr_release()
1166 static ssize_t f_printer_opts_pnp_string_show(struct f_printer_opts *opts, in f_printer_opts_pnp_string_show() argument
1171 mutex_lock(&opts->lock); in f_printer_opts_pnp_string_show()
1172 result = strlcpy(page, opts->pnp_string + 2, PNP_STRING_LEN - 2); in f_printer_opts_pnp_string_show()
1173 mutex_unlock(&opts->lock); in f_printer_opts_pnp_string_show()
1178 static ssize_t f_printer_opts_pnp_string_store(struct f_printer_opts *opts, in f_printer_opts_pnp_string_store() argument
1183 mutex_lock(&opts->lock); in f_printer_opts_pnp_string_store()
1184 result = strlcpy(opts->pnp_string + 2, page, PNP_STRING_LEN - 2); in f_printer_opts_pnp_string_store()
1185 l = strlen(opts->pnp_string + 2) + 2; in f_printer_opts_pnp_string_store()
1186 opts->pnp_string[0] = (l >> 8) & 0xFF; in f_printer_opts_pnp_string_store()
1187 opts->pnp_string[1] = l & 0xFF; in f_printer_opts_pnp_string_store()
1188 mutex_unlock(&opts->lock); in f_printer_opts_pnp_string_store()
1198 static ssize_t f_printer_opts_q_len_show(struct f_printer_opts *opts, in f_printer_opts_q_len_show() argument
1203 mutex_lock(&opts->lock); in f_printer_opts_q_len_show()
1204 result = sprintf(page, "%d\n", opts->q_len); in f_printer_opts_q_len_show()
1205 mutex_unlock(&opts->lock); in f_printer_opts_q_len_show()
1210 static ssize_t f_printer_opts_q_len_store(struct f_printer_opts *opts, in f_printer_opts_q_len_store() argument
1216 mutex_lock(&opts->lock); in f_printer_opts_q_len_store()
1217 if (opts->refcnt) { in f_printer_opts_q_len_store()
1226 opts->q_len = (unsigned)num; in f_printer_opts_q_len_store()
1229 mutex_unlock(&opts->lock); in f_printer_opts_q_len_store()
1264 struct f_printer_opts *opts; in gprinter_free_inst() local
1266 opts = container_of(f, struct f_printer_opts, func_inst); in gprinter_free_inst()
1270 gprinter_put_minor(opts->minor); in gprinter_free_inst()
1276 kfree(opts); in gprinter_free_inst()
1281 struct f_printer_opts *opts; in gprinter_alloc_inst() local
1285 opts = kzalloc(sizeof(*opts), GFP_KERNEL); in gprinter_alloc_inst()
1286 if (!opts) in gprinter_alloc_inst()
1289 mutex_init(&opts->lock); in gprinter_alloc_inst()
1290 opts->func_inst.free_func_inst = gprinter_free_inst; in gprinter_alloc_inst()
1291 ret = &opts->func_inst; in gprinter_alloc_inst()
1299 kfree(opts); in gprinter_alloc_inst()
1304 opts->minor = gprinter_get_minor(); in gprinter_alloc_inst()
1305 if (opts->minor < 0) { in gprinter_alloc_inst()
1306 ret = ERR_PTR(opts->minor); in gprinter_alloc_inst()
1307 kfree(opts); in gprinter_alloc_inst()
1312 config_group_init_type_name(&opts->func_inst.group, "", in gprinter_alloc_inst()
1323 struct f_printer_opts *opts; in gprinter_free() local
1325 opts = container_of(f->fi, struct f_printer_opts, func_inst); in gprinter_free()
1327 mutex_lock(&opts->lock); in gprinter_free()
1328 --opts->refcnt; in gprinter_free()
1329 mutex_unlock(&opts->lock); in gprinter_free()
1379 struct f_printer_opts *opts; in gprinter_alloc() local
1381 opts = container_of(fi, struct f_printer_opts, func_inst); in gprinter_alloc()
1383 mutex_lock(&opts->lock); in gprinter_alloc()
1384 if (opts->minor >= minors) { in gprinter_alloc()
1385 mutex_unlock(&opts->lock); in gprinter_alloc()
1391 mutex_unlock(&opts->lock); in gprinter_alloc()
1395 ++opts->refcnt; in gprinter_alloc()
1396 dev->minor = opts->minor; in gprinter_alloc()
1397 dev->pnp_string = opts->pnp_string; in gprinter_alloc()
1398 dev->q_len = opts->q_len; in gprinter_alloc()
1399 mutex_unlock(&opts->lock); in gprinter_alloc()