Lines Matching refs:opts
717 struct f_hid_opts *opts = to_f_hid_opts(item); in hid_attr_release() local
719 usb_put_function_instance(&opts->func_inst); in hid_attr_release()
729 static ssize_t f_hid_opts_##name##_show(struct f_hid_opts *opts, char *page)\
733 mutex_lock(&opts->lock); \
734 result = sprintf(page, "%d\n", opts->name); \
735 mutex_unlock(&opts->lock); \
740 static ssize_t f_hid_opts_##name##_store(struct f_hid_opts *opts, \
746 mutex_lock(&opts->lock); \
747 if (opts->refcnt) { \
760 opts->name = num; \
764 mutex_unlock(&opts->lock); \
776 static ssize_t f_hid_opts_report_desc_show(struct f_hid_opts *opts, char *page) in f_hid_opts_report_desc_show() argument
780 mutex_lock(&opts->lock); in f_hid_opts_report_desc_show()
781 result = opts->report_desc_length; in f_hid_opts_report_desc_show()
782 memcpy(page, opts->report_desc, opts->report_desc_length); in f_hid_opts_report_desc_show()
783 mutex_unlock(&opts->lock); in f_hid_opts_report_desc_show()
788 static ssize_t f_hid_opts_report_desc_store(struct f_hid_opts *opts, in f_hid_opts_report_desc_store() argument
794 mutex_lock(&opts->lock); in f_hid_opts_report_desc_store()
796 if (opts->refcnt) in f_hid_opts_report_desc_store()
807 kfree(opts->report_desc); in f_hid_opts_report_desc_store()
808 opts->report_desc = d; in f_hid_opts_report_desc_store()
809 opts->report_desc_length = len; in f_hid_opts_report_desc_store()
810 opts->report_desc_alloc = true; in f_hid_opts_report_desc_store()
813 mutex_unlock(&opts->lock); in f_hid_opts_report_desc_store()
843 struct f_hid_opts *opts; in hidg_free_inst() local
845 opts = container_of(f, struct f_hid_opts, func_inst); in hidg_free_inst()
849 hidg_put_minor(opts->minor); in hidg_free_inst()
855 if (opts->report_desc_alloc) in hidg_free_inst()
856 kfree(opts->report_desc); in hidg_free_inst()
858 kfree(opts); in hidg_free_inst()
863 struct f_hid_opts *opts; in hidg_alloc_inst() local
867 opts = kzalloc(sizeof(*opts), GFP_KERNEL); in hidg_alloc_inst()
868 if (!opts) in hidg_alloc_inst()
870 mutex_init(&opts->lock); in hidg_alloc_inst()
871 opts->func_inst.free_func_inst = hidg_free_inst; in hidg_alloc_inst()
872 ret = &opts->func_inst; in hidg_alloc_inst()
880 kfree(opts); in hidg_alloc_inst()
885 opts->minor = hidg_get_minor(); in hidg_alloc_inst()
886 if (opts->minor < 0) { in hidg_alloc_inst()
887 ret = ERR_PTR(opts->minor); in hidg_alloc_inst()
888 kfree(opts); in hidg_alloc_inst()
893 config_group_init_type_name(&opts->func_inst.group, "", &hid_func_type); in hidg_alloc_inst()
903 struct f_hid_opts *opts; in hidg_free() local
906 opts = container_of(f->fi, struct f_hid_opts, func_inst); in hidg_free()
909 mutex_lock(&opts->lock); in hidg_free()
910 --opts->refcnt; in hidg_free()
911 mutex_unlock(&opts->lock); in hidg_free()
932 struct f_hid_opts *opts; in hidg_alloc() local
939 opts = container_of(fi, struct f_hid_opts, func_inst); in hidg_alloc()
941 mutex_lock(&opts->lock); in hidg_alloc()
942 ++opts->refcnt; in hidg_alloc()
944 hidg->minor = opts->minor; in hidg_alloc()
945 hidg->bInterfaceSubClass = opts->subclass; in hidg_alloc()
946 hidg->bInterfaceProtocol = opts->protocol; in hidg_alloc()
947 hidg->report_length = opts->report_length; in hidg_alloc()
948 hidg->report_desc_length = opts->report_desc_length; in hidg_alloc()
949 if (opts->report_desc) { in hidg_alloc()
950 hidg->report_desc = kmemdup(opts->report_desc, in hidg_alloc()
951 opts->report_desc_length, in hidg_alloc()
955 mutex_unlock(&opts->lock); in hidg_alloc()
960 mutex_unlock(&opts->lock); in hidg_alloc()