diff options
author | Christoph Hellwig <hch@lst.de> | 2015-10-03 09:32:41 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2015-10-14 01:14:09 -0400 |
commit | ea6bd6b14ec67eb22e3eb8b2a2b979b5ea800a3a (patch) | |
tree | f9a87f209b6f7e8e3b190130016292e87ac2f3b7 /drivers/usb/gadget/function/f_acm.c | |
parent | da4e527cd8850712bb705f4c41f0839705ab7c98 (diff) |
usb-gadget/f_acm: use per-attribute show and store methods
To simplify the configfs interface and remove boilerplate code that also
causes binary bloat.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/usb/gadget/function/f_acm.c')
-rw-r--r-- | drivers/usb/gadget/function/f_acm.c | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/drivers/usb/gadget/function/f_acm.c b/drivers/usb/gadget/function/f_acm.c index be9df09fde26..68b289fc0d92 100644 --- a/drivers/usb/gadget/function/f_acm.c +++ b/drivers/usb/gadget/function/f_acm.c | |||
@@ -776,21 +776,6 @@ static inline struct f_serial_opts *to_f_serial_opts(struct config_item *item) | |||
776 | func_inst.group); | 776 | func_inst.group); |
777 | } | 777 | } |
778 | 778 | ||
779 | CONFIGFS_ATTR_STRUCT(f_serial_opts); | ||
780 | static ssize_t f_acm_attr_show(struct config_item *item, | ||
781 | struct configfs_attribute *attr, | ||
782 | char *page) | ||
783 | { | ||
784 | struct f_serial_opts *opts = to_f_serial_opts(item); | ||
785 | struct f_serial_opts_attribute *f_serial_opts_attr = | ||
786 | container_of(attr, struct f_serial_opts_attribute, attr); | ||
787 | ssize_t ret = 0; | ||
788 | |||
789 | if (f_serial_opts_attr->show) | ||
790 | ret = f_serial_opts_attr->show(opts, page); | ||
791 | return ret; | ||
792 | } | ||
793 | |||
794 | static void acm_attr_release(struct config_item *item) | 779 | static void acm_attr_release(struct config_item *item) |
795 | { | 780 | { |
796 | struct f_serial_opts *opts = to_f_serial_opts(item); | 781 | struct f_serial_opts *opts = to_f_serial_opts(item); |
@@ -800,20 +785,17 @@ static void acm_attr_release(struct config_item *item) | |||
800 | 785 | ||
801 | static struct configfs_item_operations acm_item_ops = { | 786 | static struct configfs_item_operations acm_item_ops = { |
802 | .release = acm_attr_release, | 787 | .release = acm_attr_release, |
803 | .show_attribute = f_acm_attr_show, | ||
804 | }; | 788 | }; |
805 | 789 | ||
806 | static ssize_t f_acm_port_num_show(struct f_serial_opts *opts, char *page) | 790 | static ssize_t f_acm_port_num_show(struct config_item *item, char *page) |
807 | { | 791 | { |
808 | return sprintf(page, "%u\n", opts->port_num); | 792 | return sprintf(page, "%u\n", to_f_serial_opts(item)->port_num); |
809 | } | 793 | } |
810 | 794 | ||
811 | static struct f_serial_opts_attribute f_acm_port_num = | 795 | CONFIGFS_ATTR_RO(f_acm_port_, num); |
812 | __CONFIGFS_ATTR_RO(port_num, f_acm_port_num_show); | ||
813 | |||
814 | 796 | ||
815 | static struct configfs_attribute *acm_attrs[] = { | 797 | static struct configfs_attribute *acm_attrs[] = { |
816 | &f_acm_port_num.attr, | 798 | &f_acm_port_attr_num, |
817 | NULL, | 799 | NULL, |
818 | }; | 800 | }; |
819 | 801 | ||