Lines Matching refs:opts
871 struct f_hid_opts *opts = to_f_hid_opts(item); in hid_attr_release() local
873 usb_put_function_instance(&opts->func_inst); in hid_attr_release()
883 struct f_hid_opts *opts = to_f_hid_opts(item); \
886 mutex_lock(&opts->lock); \
887 result = sprintf(page, "%d\n", opts->name); \
888 mutex_unlock(&opts->lock); \
896 struct f_hid_opts *opts = to_f_hid_opts(item); \
900 mutex_lock(&opts->lock); \
901 if (opts->refcnt) { \
914 opts->name = num; \
918 mutex_unlock(&opts->lock); \
930 struct f_hid_opts *opts = to_f_hid_opts(item); in f_hid_opts_report_desc_show() local
933 mutex_lock(&opts->lock); in f_hid_opts_report_desc_show()
934 result = opts->report_desc_length; in f_hid_opts_report_desc_show()
935 memcpy(page, opts->report_desc, opts->report_desc_length); in f_hid_opts_report_desc_show()
936 mutex_unlock(&opts->lock); in f_hid_opts_report_desc_show()
944 struct f_hid_opts *opts = to_f_hid_opts(item); in f_hid_opts_report_desc_store() local
948 mutex_lock(&opts->lock); in f_hid_opts_report_desc_store()
950 if (opts->refcnt) in f_hid_opts_report_desc_store()
961 kfree(opts->report_desc); in f_hid_opts_report_desc_store()
962 opts->report_desc = d; in f_hid_opts_report_desc_store()
963 opts->report_desc_length = len; in f_hid_opts_report_desc_store()
964 opts->report_desc_alloc = true; in f_hid_opts_report_desc_store()
967 mutex_unlock(&opts->lock); in f_hid_opts_report_desc_store()
975 struct f_hid_opts *opts = to_f_hid_opts(item); in f_hid_opts_dev_show() local
977 return sprintf(page, "%d:%d\n", major, opts->minor); in f_hid_opts_dev_show()
1004 struct f_hid_opts *opts; in hidg_free_inst() local
1006 opts = container_of(f, struct f_hid_opts, func_inst); in hidg_free_inst()
1010 hidg_put_minor(opts->minor); in hidg_free_inst()
1016 if (opts->report_desc_alloc) in hidg_free_inst()
1017 kfree(opts->report_desc); in hidg_free_inst()
1019 kfree(opts); in hidg_free_inst()
1024 struct f_hid_opts *opts; in hidg_alloc_inst() local
1028 opts = kzalloc(sizeof(*opts), GFP_KERNEL); in hidg_alloc_inst()
1029 if (!opts) in hidg_alloc_inst()
1031 mutex_init(&opts->lock); in hidg_alloc_inst()
1032 opts->func_inst.free_func_inst = hidg_free_inst; in hidg_alloc_inst()
1033 ret = &opts->func_inst; in hidg_alloc_inst()
1041 kfree(opts); in hidg_alloc_inst()
1046 opts->minor = hidg_get_minor(); in hidg_alloc_inst()
1047 if (opts->minor < 0) { in hidg_alloc_inst()
1048 ret = ERR_PTR(opts->minor); in hidg_alloc_inst()
1049 kfree(opts); in hidg_alloc_inst()
1054 config_group_init_type_name(&opts->func_inst.group, "", &hid_func_type); in hidg_alloc_inst()
1064 struct f_hid_opts *opts; in hidg_free() local
1067 opts = container_of(f->fi, struct f_hid_opts, func_inst); in hidg_free()
1070 mutex_lock(&opts->lock); in hidg_free()
1071 --opts->refcnt; in hidg_free()
1072 mutex_unlock(&opts->lock); in hidg_free()
1088 struct f_hid_opts *opts; in hidg_alloc() local
1095 opts = container_of(fi, struct f_hid_opts, func_inst); in hidg_alloc()
1097 mutex_lock(&opts->lock); in hidg_alloc()
1098 ++opts->refcnt; in hidg_alloc()
1100 hidg->minor = opts->minor; in hidg_alloc()
1101 hidg->bInterfaceSubClass = opts->subclass; in hidg_alloc()
1102 hidg->bInterfaceProtocol = opts->protocol; in hidg_alloc()
1103 hidg->report_length = opts->report_length; in hidg_alloc()
1104 hidg->report_desc_length = opts->report_desc_length; in hidg_alloc()
1105 if (opts->report_desc) { in hidg_alloc()
1106 hidg->report_desc = kmemdup(opts->report_desc, in hidg_alloc()
1107 opts->report_desc_length, in hidg_alloc()
1111 mutex_unlock(&opts->lock); in hidg_alloc()
1116 mutex_unlock(&opts->lock); in hidg_alloc()