Skip to content

Commit ea6bd6b

Browse files
Christoph HellwigNicholas Bellinger
authored andcommitted
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>
1 parent da4e527 commit ea6bd6b

File tree

1 file changed

+4
-22
lines changed

1 file changed

+4
-22
lines changed

drivers/usb/gadget/function/f_acm.c

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -776,21 +776,6 @@ static inline struct f_serial_opts *to_f_serial_opts(struct config_item *item)
776776
func_inst.group);
777777
}
778778

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-
794779
static void acm_attr_release(struct config_item *item)
795780
{
796781
struct f_serial_opts *opts = to_f_serial_opts(item);
@@ -800,20 +785,17 @@ static void acm_attr_release(struct config_item *item)
800785

801786
static struct configfs_item_operations acm_item_ops = {
802787
.release = acm_attr_release,
803-
.show_attribute = f_acm_attr_show,
804788
};
805789

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)
807791
{
808-
return sprintf(page, "%u\n", opts->port_num);
792+
return sprintf(page, "%u\n", to_f_serial_opts(item)->port_num);
809793
}
810794

811-
static struct f_serial_opts_attribute f_acm_port_num =
812-
__CONFIGFS_ATTR_RO(port_num, f_acm_port_num_show);
813-
795+
CONFIGFS_ATTR_RO(f_acm_port_, num);
814796

815797
static struct configfs_attribute *acm_attrs[] = {
816-
&f_acm_port_num.attr,
798+
&f_acm_port_attr_num,
817799
NULL,
818800
};
819801

0 commit comments

Comments
 (0)