diff options
Diffstat (limited to 'drivers/usb/gadget/function/f_uac1.c')
-rw-r--r-- | drivers/usb/gadget/function/f_uac1.c | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/drivers/usb/gadget/function/f_uac1.c b/drivers/usb/gadget/function/f_uac1.c index 8ee701924d29..6a2346b99f55 100644 --- a/drivers/usb/gadget/function/f_uac1.c +++ b/drivers/usb/gadget/function/f_uac1.c | |||
@@ -769,9 +769,6 @@ static inline struct f_uac1_opts *to_f_uac1_opts(struct config_item *item) | |||
769 | func_inst.group); | 769 | func_inst.group); |
770 | } | 770 | } |
771 | 771 | ||
772 | CONFIGFS_ATTR_STRUCT(f_uac1_opts); | ||
773 | CONFIGFS_ATTR_OPS(f_uac1_opts); | ||
774 | |||
775 | static void f_uac1_attr_release(struct config_item *item) | 772 | static void f_uac1_attr_release(struct config_item *item) |
776 | { | 773 | { |
777 | struct f_uac1_opts *opts = to_f_uac1_opts(item); | 774 | struct f_uac1_opts *opts = to_f_uac1_opts(item); |
@@ -781,14 +778,13 @@ static void f_uac1_attr_release(struct config_item *item) | |||
781 | 778 | ||
782 | static struct configfs_item_operations f_uac1_item_ops = { | 779 | static struct configfs_item_operations f_uac1_item_ops = { |
783 | .release = f_uac1_attr_release, | 780 | .release = f_uac1_attr_release, |
784 | .show_attribute = f_uac1_opts_attr_show, | ||
785 | .store_attribute = f_uac1_opts_attr_store, | ||
786 | }; | 781 | }; |
787 | 782 | ||
788 | #define UAC1_INT_ATTRIBUTE(name) \ | 783 | #define UAC1_INT_ATTRIBUTE(name) \ |
789 | static ssize_t f_uac1_opts_##name##_show(struct f_uac1_opts *opts, \ | 784 | static ssize_t f_uac1_opts_##name##_show(struct config_item *item, \ |
790 | char *page) \ | 785 | char *page) \ |
791 | { \ | 786 | { \ |
787 | struct f_uac1_opts *opts = to_f_uac1_opts(item); \ | ||
792 | int result; \ | 788 | int result; \ |
793 | \ | 789 | \ |
794 | mutex_lock(&opts->lock); \ | 790 | mutex_lock(&opts->lock); \ |
@@ -798,9 +794,10 @@ static ssize_t f_uac1_opts_##name##_show(struct f_uac1_opts *opts, \ | |||
798 | return result; \ | 794 | return result; \ |
799 | } \ | 795 | } \ |
800 | \ | 796 | \ |
801 | static ssize_t f_uac1_opts_##name##_store(struct f_uac1_opts *opts, \ | 797 | static ssize_t f_uac1_opts_##name##_store(struct config_item *item, \ |
802 | const char *page, size_t len) \ | 798 | const char *page, size_t len) \ |
803 | { \ | 799 | { \ |
800 | struct f_uac1_opts *opts = to_f_uac1_opts(item); \ | ||
804 | int ret; \ | 801 | int ret; \ |
805 | u32 num; \ | 802 | u32 num; \ |
806 | \ | 803 | \ |
@@ -822,19 +819,17 @@ end: \ | |||
822 | return ret; \ | 819 | return ret; \ |
823 | } \ | 820 | } \ |
824 | \ | 821 | \ |
825 | static struct f_uac1_opts_attribute f_uac1_opts_##name = \ | 822 | CONFIGFS_ATTR(f_uac1_opts_, name) |
826 | __CONFIGFS_ATTR(name, S_IRUGO | S_IWUSR, \ | ||
827 | f_uac1_opts_##name##_show, \ | ||
828 | f_uac1_opts_##name##_store) | ||
829 | 823 | ||
830 | UAC1_INT_ATTRIBUTE(req_buf_size); | 824 | UAC1_INT_ATTRIBUTE(req_buf_size); |
831 | UAC1_INT_ATTRIBUTE(req_count); | 825 | UAC1_INT_ATTRIBUTE(req_count); |
832 | UAC1_INT_ATTRIBUTE(audio_buf_size); | 826 | UAC1_INT_ATTRIBUTE(audio_buf_size); |
833 | 827 | ||
834 | #define UAC1_STR_ATTRIBUTE(name) \ | 828 | #define UAC1_STR_ATTRIBUTE(name) \ |
835 | static ssize_t f_uac1_opts_##name##_show(struct f_uac1_opts *opts, \ | 829 | static ssize_t f_uac1_opts_##name##_show(struct config_item *item, \ |
836 | char *page) \ | 830 | char *page) \ |
837 | { \ | 831 | { \ |
832 | struct f_uac1_opts *opts = to_f_uac1_opts(item); \ | ||
838 | int result; \ | 833 | int result; \ |
839 | \ | 834 | \ |
840 | mutex_lock(&opts->lock); \ | 835 | mutex_lock(&opts->lock); \ |
@@ -844,9 +839,10 @@ static ssize_t f_uac1_opts_##name##_show(struct f_uac1_opts *opts, \ | |||
844 | return result; \ | 839 | return result; \ |
845 | } \ | 840 | } \ |
846 | \ | 841 | \ |
847 | static ssize_t f_uac1_opts_##name##_store(struct f_uac1_opts *opts, \ | 842 | static ssize_t f_uac1_opts_##name##_store(struct config_item *item, \ |
848 | const char *page, size_t len) \ | 843 | const char *page, size_t len) \ |
849 | { \ | 844 | { \ |
845 | struct f_uac1_opts *opts = to_f_uac1_opts(item); \ | ||
850 | int ret = -EBUSY; \ | 846 | int ret = -EBUSY; \ |
851 | char *tmp; \ | 847 | char *tmp; \ |
852 | \ | 848 | \ |
@@ -870,22 +866,19 @@ end: \ | |||
870 | return ret; \ | 866 | return ret; \ |
871 | } \ | 867 | } \ |
872 | \ | 868 | \ |
873 | static struct f_uac1_opts_attribute f_uac1_opts_##name = \ | 869 | CONFIGFS_ATTR(f_uac1_opts_, name) |
874 | __CONFIGFS_ATTR(name, S_IRUGO | S_IWUSR, \ | ||
875 | f_uac1_opts_##name##_show, \ | ||
876 | f_uac1_opts_##name##_store) | ||
877 | 870 | ||
878 | UAC1_STR_ATTRIBUTE(fn_play); | 871 | UAC1_STR_ATTRIBUTE(fn_play); |
879 | UAC1_STR_ATTRIBUTE(fn_cap); | 872 | UAC1_STR_ATTRIBUTE(fn_cap); |
880 | UAC1_STR_ATTRIBUTE(fn_cntl); | 873 | UAC1_STR_ATTRIBUTE(fn_cntl); |
881 | 874 | ||
882 | static struct configfs_attribute *f_uac1_attrs[] = { | 875 | static struct configfs_attribute *f_uac1_attrs[] = { |
883 | &f_uac1_opts_req_buf_size.attr, | 876 | &f_uac1_opts_attr_req_buf_size, |
884 | &f_uac1_opts_req_count.attr, | 877 | &f_uac1_opts_attr_req_count, |
885 | &f_uac1_opts_audio_buf_size.attr, | 878 | &f_uac1_opts_attr_audio_buf_size, |
886 | &f_uac1_opts_fn_play.attr, | 879 | &f_uac1_opts_attr_fn_play, |
887 | &f_uac1_opts_fn_cap.attr, | 880 | &f_uac1_opts_attr_fn_cap, |
888 | &f_uac1_opts_fn_cntl.attr, | 881 | &f_uac1_opts_attr_fn_cntl, |
889 | NULL, | 882 | NULL, |
890 | }; | 883 | }; |
891 | 884 | ||