aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb/gadget_configfs.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/usb/gadget_configfs.h')
-rw-r--r--include/linux/usb/gadget_configfs.h19
1 files changed, 5 insertions, 14 deletions
diff --git a/include/linux/usb/gadget_configfs.h b/include/linux/usb/gadget_configfs.h
index d74c0ae989d5..c36e95730de1 100644
--- a/include/linux/usb/gadget_configfs.h
+++ b/include/linux/usb/gadget_configfs.h
@@ -7,9 +7,10 @@ int check_user_usb_string(const char *name,
7 struct usb_gadget_strings *stringtab_dev); 7 struct usb_gadget_strings *stringtab_dev);
8 8
9#define GS_STRINGS_W(__struct, __name) \ 9#define GS_STRINGS_W(__struct, __name) \
10 static ssize_t __struct##_##__name##_store(struct __struct *gs, \ 10static ssize_t __struct##_##__name##_store(struct config_item *item, \
11 const char *page, size_t len) \ 11 const char *page, size_t len) \
12{ \ 12{ \
13 struct __struct *gs = to_##__struct(item); \
13 int ret; \ 14 int ret; \
14 \ 15 \
15 ret = usb_string_copy(page, &gs->__name); \ 16 ret = usb_string_copy(page, &gs->__name); \
@@ -19,30 +20,20 @@ int check_user_usb_string(const char *name,
19} 20}
20 21
21#define GS_STRINGS_R(__struct, __name) \ 22#define GS_STRINGS_R(__struct, __name) \
22 static ssize_t __struct##_##__name##_show(struct __struct *gs, \ 23static ssize_t __struct##_##__name##_show(struct config_item *item, char *page) \
23 char *page) \
24{ \ 24{ \
25 struct __struct *gs = to_##__struct(item); \
25 return sprintf(page, "%s\n", gs->__name ?: ""); \ 26 return sprintf(page, "%s\n", gs->__name ?: ""); \
26} 27}
27 28
28#define GS_STRING_ITEM_ATTR(struct_name, name) \
29 static struct struct_name##_attribute struct_name##_##name = \
30 __CONFIGFS_ATTR(name, S_IRUGO | S_IWUSR, \
31 struct_name##_##name##_show, \
32 struct_name##_##name##_store)
33
34#define GS_STRINGS_RW(struct_name, _name) \ 29#define GS_STRINGS_RW(struct_name, _name) \
35 GS_STRINGS_R(struct_name, _name) \ 30 GS_STRINGS_R(struct_name, _name) \
36 GS_STRINGS_W(struct_name, _name) \ 31 GS_STRINGS_W(struct_name, _name) \
37 GS_STRING_ITEM_ATTR(struct_name, _name) 32 CONFIGFS_ATTR(struct_name##_, _name)
38 33
39#define USB_CONFIG_STRING_RW_OPS(struct_in) \ 34#define USB_CONFIG_STRING_RW_OPS(struct_in) \
40 CONFIGFS_ATTR_OPS(struct_in); \
41 \
42static struct configfs_item_operations struct_in##_langid_item_ops = { \ 35static struct configfs_item_operations struct_in##_langid_item_ops = { \
43 .release = struct_in##_attr_release, \ 36 .release = struct_in##_attr_release, \
44 .show_attribute = struct_in##_attr_show, \
45 .store_attribute = struct_in##_attr_store, \
46}; \ 37}; \
47 \ 38 \
48static struct config_item_type struct_in##_langid_type = { \ 39static struct config_item_type struct_in##_langid_type = { \