diff options
author | Christoph Hellwig <hch@lst.de> | 2015-10-03 09:32:51 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2015-10-14 01:15:57 -0400 |
commit | 0736390bea65cac63bed9671a957031c068a60e7 (patch) | |
tree | 0fefcb54acfbe2167353b4e0a1878a39f63c3a69 | |
parent | 3da5e4c10cbacf5f3da043498299ae631a6dfc9c (diff) |
usb-gadget/f_phonet: 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>
-rw-r--r-- | drivers/usb/gadget/function/f_phonet.c | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/drivers/usb/gadget/function/f_phonet.c b/drivers/usb/gadget/function/f_phonet.c index c0c3ef272714..c029ef6ba419 100644 --- a/drivers/usb/gadget/function/f_phonet.c +++ b/drivers/usb/gadget/function/f_phonet.c | |||
@@ -589,21 +589,6 @@ static inline struct f_phonet_opts *to_f_phonet_opts(struct config_item *item) | |||
589 | func_inst.group); | 589 | func_inst.group); |
590 | } | 590 | } |
591 | 591 | ||
592 | CONFIGFS_ATTR_STRUCT(f_phonet_opts); | ||
593 | static ssize_t f_phonet_attr_show(struct config_item *item, | ||
594 | struct configfs_attribute *attr, | ||
595 | char *page) | ||
596 | { | ||
597 | struct f_phonet_opts *opts = to_f_phonet_opts(item); | ||
598 | struct f_phonet_opts_attribute *f_phonet_opts_attr = | ||
599 | container_of(attr, struct f_phonet_opts_attribute, attr); | ||
600 | ssize_t ret = 0; | ||
601 | |||
602 | if (f_phonet_opts_attr->show) | ||
603 | ret = f_phonet_opts_attr->show(opts, page); | ||
604 | return ret; | ||
605 | } | ||
606 | |||
607 | static void phonet_attr_release(struct config_item *item) | 592 | static void phonet_attr_release(struct config_item *item) |
608 | { | 593 | { |
609 | struct f_phonet_opts *opts = to_f_phonet_opts(item); | 594 | struct f_phonet_opts *opts = to_f_phonet_opts(item); |
@@ -613,19 +598,17 @@ static void phonet_attr_release(struct config_item *item) | |||
613 | 598 | ||
614 | static struct configfs_item_operations phonet_item_ops = { | 599 | static struct configfs_item_operations phonet_item_ops = { |
615 | .release = phonet_attr_release, | 600 | .release = phonet_attr_release, |
616 | .show_attribute = f_phonet_attr_show, | ||
617 | }; | 601 | }; |
618 | 602 | ||
619 | static ssize_t f_phonet_ifname_show(struct f_phonet_opts *opts, char *page) | 603 | static ssize_t f_phonet_ifname_show(struct config_item *item, char *page) |
620 | { | 604 | { |
621 | return gether_get_ifname(opts->net, page, PAGE_SIZE); | 605 | return gether_get_ifname(to_f_phonet_opts(item)->net, page, PAGE_SIZE); |
622 | } | 606 | } |
623 | 607 | ||
624 | static struct f_phonet_opts_attribute f_phonet_ifname = | 608 | CONFIGFS_ATTR_RO(f_phonet_, ifname); |
625 | __CONFIGFS_ATTR_RO(ifname, f_phonet_ifname_show); | ||
626 | 609 | ||
627 | static struct configfs_attribute *phonet_attrs[] = { | 610 | static struct configfs_attribute *phonet_attrs[] = { |
628 | &f_phonet_ifname.attr, | 611 | &f_phonet_attr_ifname, |
629 | NULL, | 612 | NULL, |
630 | }; | 613 | }; |
631 | 614 | ||