Lines Matching refs:opts
710 struct f_hid_opts *opts = to_f_hid_opts(item); in hid_attr_release() local
712 usb_put_function_instance(&opts->func_inst); in hid_attr_release()
722 struct f_hid_opts *opts = to_f_hid_opts(item); \
725 mutex_lock(&opts->lock); \
726 result = sprintf(page, "%d\n", opts->name); \
727 mutex_unlock(&opts->lock); \
735 struct f_hid_opts *opts = to_f_hid_opts(item); \
739 mutex_lock(&opts->lock); \
740 if (opts->refcnt) { \
753 opts->name = num; \
757 mutex_unlock(&opts->lock); \
769 struct f_hid_opts *opts = to_f_hid_opts(item); in f_hid_opts_report_desc_show() local
772 mutex_lock(&opts->lock); in f_hid_opts_report_desc_show()
773 result = opts->report_desc_length; in f_hid_opts_report_desc_show()
774 memcpy(page, opts->report_desc, opts->report_desc_length); in f_hid_opts_report_desc_show()
775 mutex_unlock(&opts->lock); in f_hid_opts_report_desc_show()
783 struct f_hid_opts *opts = to_f_hid_opts(item); in f_hid_opts_report_desc_store() local
787 mutex_lock(&opts->lock); in f_hid_opts_report_desc_store()
789 if (opts->refcnt) in f_hid_opts_report_desc_store()
800 kfree(opts->report_desc); in f_hid_opts_report_desc_store()
801 opts->report_desc = d; in f_hid_opts_report_desc_store()
802 opts->report_desc_length = len; in f_hid_opts_report_desc_store()
803 opts->report_desc_alloc = true; in f_hid_opts_report_desc_store()
806 mutex_unlock(&opts->lock); in f_hid_opts_report_desc_store()
833 struct f_hid_opts *opts; in hidg_free_inst() local
835 opts = container_of(f, struct f_hid_opts, func_inst); in hidg_free_inst()
839 hidg_put_minor(opts->minor); in hidg_free_inst()
845 if (opts->report_desc_alloc) in hidg_free_inst()
846 kfree(opts->report_desc); in hidg_free_inst()
848 kfree(opts); in hidg_free_inst()
853 struct f_hid_opts *opts; in hidg_alloc_inst() local
857 opts = kzalloc(sizeof(*opts), GFP_KERNEL); in hidg_alloc_inst()
858 if (!opts) in hidg_alloc_inst()
860 mutex_init(&opts->lock); in hidg_alloc_inst()
861 opts->func_inst.free_func_inst = hidg_free_inst; in hidg_alloc_inst()
862 ret = &opts->func_inst; in hidg_alloc_inst()
870 kfree(opts); in hidg_alloc_inst()
875 opts->minor = hidg_get_minor(); in hidg_alloc_inst()
876 if (opts->minor < 0) { in hidg_alloc_inst()
877 ret = ERR_PTR(opts->minor); in hidg_alloc_inst()
878 kfree(opts); in hidg_alloc_inst()
883 config_group_init_type_name(&opts->func_inst.group, "", &hid_func_type); in hidg_alloc_inst()
893 struct f_hid_opts *opts; in hidg_free() local
896 opts = container_of(f->fi, struct f_hid_opts, func_inst); in hidg_free()
899 mutex_lock(&opts->lock); in hidg_free()
900 --opts->refcnt; in hidg_free()
901 mutex_unlock(&opts->lock); in hidg_free()
922 struct f_hid_opts *opts; in hidg_alloc() local
929 opts = container_of(fi, struct f_hid_opts, func_inst); in hidg_alloc()
931 mutex_lock(&opts->lock); in hidg_alloc()
932 ++opts->refcnt; in hidg_alloc()
934 hidg->minor = opts->minor; in hidg_alloc()
935 hidg->bInterfaceSubClass = opts->subclass; in hidg_alloc()
936 hidg->bInterfaceProtocol = opts->protocol; in hidg_alloc()
937 hidg->report_length = opts->report_length; in hidg_alloc()
938 hidg->report_desc_length = opts->report_desc_length; in hidg_alloc()
939 if (opts->report_desc) { in hidg_alloc()
940 hidg->report_desc = kmemdup(opts->report_desc, in hidg_alloc()
941 opts->report_desc_length, in hidg_alloc()
945 mutex_unlock(&opts->lock); in hidg_alloc()
950 mutex_unlock(&opts->lock); in hidg_alloc()