diff options
Diffstat (limited to 'drivers/usb/gadget/function/f_hid.c')
-rw-r--r-- | drivers/usb/gadget/function/f_hid.c | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c index 21fcf18f53a0..99285b416308 100644 --- a/drivers/usb/gadget/function/f_hid.c +++ b/drivers/usb/gadget/function/f_hid.c | |||
@@ -705,9 +705,6 @@ static inline struct f_hid_opts *to_f_hid_opts(struct config_item *item) | |||
705 | func_inst.group); | 705 | func_inst.group); |
706 | } | 706 | } |
707 | 707 | ||
708 | CONFIGFS_ATTR_STRUCT(f_hid_opts); | ||
709 | CONFIGFS_ATTR_OPS(f_hid_opts); | ||
710 | |||
711 | static void hid_attr_release(struct config_item *item) | 708 | static void hid_attr_release(struct config_item *item) |
712 | { | 709 | { |
713 | struct f_hid_opts *opts = to_f_hid_opts(item); | 710 | struct f_hid_opts *opts = to_f_hid_opts(item); |
@@ -717,13 +714,12 @@ static void hid_attr_release(struct config_item *item) | |||
717 | 714 | ||
718 | static struct configfs_item_operations hidg_item_ops = { | 715 | static struct configfs_item_operations hidg_item_ops = { |
719 | .release = hid_attr_release, | 716 | .release = hid_attr_release, |
720 | .show_attribute = f_hid_opts_attr_show, | ||
721 | .store_attribute = f_hid_opts_attr_store, | ||
722 | }; | 717 | }; |
723 | 718 | ||
724 | #define F_HID_OPT(name, prec, limit) \ | 719 | #define F_HID_OPT(name, prec, limit) \ |
725 | static ssize_t f_hid_opts_##name##_show(struct f_hid_opts *opts, char *page)\ | 720 | static ssize_t f_hid_opts_##name##_show(struct config_item *item, char *page)\ |
726 | { \ | 721 | { \ |
722 | struct f_hid_opts *opts = to_f_hid_opts(item); \ | ||
727 | int result; \ | 723 | int result; \ |
728 | \ | 724 | \ |
729 | mutex_lock(&opts->lock); \ | 725 | mutex_lock(&opts->lock); \ |
@@ -733,9 +729,10 @@ static ssize_t f_hid_opts_##name##_show(struct f_hid_opts *opts, char *page)\ | |||
733 | return result; \ | 729 | return result; \ |
734 | } \ | 730 | } \ |
735 | \ | 731 | \ |
736 | static ssize_t f_hid_opts_##name##_store(struct f_hid_opts *opts, \ | 732 | static ssize_t f_hid_opts_##name##_store(struct config_item *item, \ |
737 | const char *page, size_t len) \ | 733 | const char *page, size_t len) \ |
738 | { \ | 734 | { \ |
735 | struct f_hid_opts *opts = to_f_hid_opts(item); \ | ||
739 | int ret; \ | 736 | int ret; \ |
740 | u##prec num; \ | 737 | u##prec num; \ |
741 | \ | 738 | \ |
@@ -761,16 +758,15 @@ end: \ | |||
761 | return ret; \ | 758 | return ret; \ |
762 | } \ | 759 | } \ |
763 | \ | 760 | \ |
764 | static struct f_hid_opts_attribute f_hid_opts_##name = \ | 761 | CONFIGFS_ATTR(f_hid_opts_, name) |
765 | __CONFIGFS_ATTR(name, S_IRUGO | S_IWUSR, f_hid_opts_##name##_show,\ | ||
766 | f_hid_opts_##name##_store) | ||
767 | 762 | ||
768 | F_HID_OPT(subclass, 8, 255); | 763 | F_HID_OPT(subclass, 8, 255); |
769 | F_HID_OPT(protocol, 8, 255); | 764 | F_HID_OPT(protocol, 8, 255); |
770 | F_HID_OPT(report_length, 16, 65535); | 765 | F_HID_OPT(report_length, 16, 65535); |
771 | 766 | ||
772 | static ssize_t f_hid_opts_report_desc_show(struct f_hid_opts *opts, char *page) | 767 | static ssize_t f_hid_opts_report_desc_show(struct config_item *item, char *page) |
773 | { | 768 | { |
769 | struct f_hid_opts *opts = to_f_hid_opts(item); | ||
774 | int result; | 770 | int result; |
775 | 771 | ||
776 | mutex_lock(&opts->lock); | 772 | mutex_lock(&opts->lock); |
@@ -781,9 +777,10 @@ static ssize_t f_hid_opts_report_desc_show(struct f_hid_opts *opts, char *page) | |||
781 | return result; | 777 | return result; |
782 | } | 778 | } |
783 | 779 | ||
784 | static ssize_t f_hid_opts_report_desc_store(struct f_hid_opts *opts, | 780 | static ssize_t f_hid_opts_report_desc_store(struct config_item *item, |
785 | const char *page, size_t len) | 781 | const char *page, size_t len) |
786 | { | 782 | { |
783 | struct f_hid_opts *opts = to_f_hid_opts(item); | ||
787 | int ret = -EBUSY; | 784 | int ret = -EBUSY; |
788 | char *d; | 785 | char *d; |
789 | 786 | ||
@@ -810,16 +807,13 @@ end: | |||
810 | return ret; | 807 | return ret; |
811 | } | 808 | } |
812 | 809 | ||
813 | static struct f_hid_opts_attribute f_hid_opts_report_desc = | 810 | CONFIGFS_ATTR(f_hid_opts_, report_desc); |
814 | __CONFIGFS_ATTR(report_desc, S_IRUGO | S_IWUSR, | ||
815 | f_hid_opts_report_desc_show, | ||
816 | f_hid_opts_report_desc_store); | ||
817 | 811 | ||
818 | static struct configfs_attribute *hid_attrs[] = { | 812 | static struct configfs_attribute *hid_attrs[] = { |
819 | &f_hid_opts_subclass.attr, | 813 | &f_hid_opts_attr_subclass, |
820 | &f_hid_opts_protocol.attr, | 814 | &f_hid_opts_attr_protocol, |
821 | &f_hid_opts_report_length.attr, | 815 | &f_hid_opts_attr_report_length, |
822 | &f_hid_opts_report_desc.attr, | 816 | &f_hid_opts_attr_report_desc, |
823 | NULL, | 817 | NULL, |
824 | }; | 818 | }; |
825 | 819 | ||