diff mbox series

[v2,1/5] usb: gadget: configfs: expose some struct from configfs.c

Message ID 1630637092-30230-2-git-send-email-quic_linyyuan@quicinc.com
State New
Headers show
Series usb: gadget: configfs: add some trace event | expand

Commit Message

Linyu Yuan Sept. 3, 2021, 2:44 a.m. UTC
some private struct in configfs.c maybe used by outside file
when we add ftrace for gadget configfs.

Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com>
---
v2: no change

 drivers/usb/gadget/configfs.c | 66 -----------------------------------------
 drivers/usb/gadget/configfs.h | 68 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+), 66 deletions(-)
diff mbox series

Patch

diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
index 477e72a..0f3a01f 100644
--- a/drivers/usb/gadget/configfs.c
+++ b/drivers/usb/gadget/configfs.c
@@ -28,75 +28,9 @@  int check_user_usb_string(const char *name,
 }
 
 #define MAX_NAME_LEN	40
-#define MAX_USB_STRING_LANGS 2
 
 static const struct usb_descriptor_header *otg_desc[2];
 
-struct gadget_info {
-	struct config_group group;
-	struct config_group functions_group;
-	struct config_group configs_group;
-	struct config_group strings_group;
-	struct config_group os_desc_group;
-
-	struct mutex lock;
-	struct usb_gadget_strings *gstrings[MAX_USB_STRING_LANGS + 1];
-	struct list_head string_list;
-	struct list_head available_func;
-
-	struct usb_composite_driver composite;
-	struct usb_composite_dev cdev;
-	bool use_os_desc;
-	char b_vendor_code;
-	char qw_sign[OS_STRING_QW_SIGN_LEN];
-	spinlock_t spinlock;
-	bool unbind;
-};
-
-static inline struct gadget_info *to_gadget_info(struct config_item *item)
-{
-	return container_of(to_config_group(item), struct gadget_info, group);
-}
-
-struct config_usb_cfg {
-	struct config_group group;
-	struct config_group strings_group;
-	struct list_head string_list;
-	struct usb_configuration c;
-	struct list_head func_list;
-	struct usb_gadget_strings *gstrings[MAX_USB_STRING_LANGS + 1];
-};
-
-static inline struct config_usb_cfg *to_config_usb_cfg(struct config_item *item)
-{
-	return container_of(to_config_group(item), struct config_usb_cfg,
-			group);
-}
-
-struct gadget_strings {
-	struct usb_gadget_strings stringtab_dev;
-	struct usb_string strings[USB_GADGET_FIRST_AVAIL_IDX];
-	char *manufacturer;
-	char *product;
-	char *serialnumber;
-
-	struct config_group group;
-	struct list_head list;
-};
-
-struct os_desc {
-	struct config_group group;
-};
-
-struct gadget_config_name {
-	struct usb_gadget_strings stringtab_dev;
-	struct usb_string strings;
-	char *configuration;
-
-	struct config_group group;
-	struct list_head list;
-};
-
 #define USB_MAX_STRING_WITH_NULL_LEN	(USB_MAX_STRING_LEN+1)
 
 static int usb_string_copy(const char *s, char **s_copy)
diff --git a/drivers/usb/gadget/configfs.h b/drivers/usb/gadget/configfs.h
index 3b6f529..bae403f 100644
--- a/drivers/usb/gadget/configfs.h
+++ b/drivers/usb/gadget/configfs.h
@@ -4,6 +4,74 @@ 
 
 #include <linux/configfs.h>
 
+#define MAX_USB_STRING_LANGS 2
+
+struct gadget_info {
+	struct config_group group;
+	struct config_group functions_group;
+	struct config_group configs_group;
+	struct config_group strings_group;
+	struct config_group os_desc_group;
+
+	struct mutex lock;
+	struct usb_gadget_strings *gstrings[MAX_USB_STRING_LANGS + 1];
+	struct list_head string_list;
+	struct list_head available_func;
+
+	struct usb_composite_driver composite;
+	struct usb_composite_dev cdev;
+	bool use_os_desc;
+	char b_vendor_code;
+	char qw_sign[OS_STRING_QW_SIGN_LEN];
+	spinlock_t spinlock;
+	bool unbind;
+};
+
+static inline struct gadget_info *to_gadget_info(struct config_item *item)
+{
+	return container_of(to_config_group(item), struct gadget_info, group);
+}
+
+struct config_usb_cfg {
+	struct config_group group;
+	struct config_group strings_group;
+	struct list_head string_list;
+	struct usb_configuration c;
+	struct list_head func_list;
+	struct usb_gadget_strings *gstrings[MAX_USB_STRING_LANGS + 1];
+};
+
+static inline struct config_usb_cfg *to_config_usb_cfg(struct config_item *item)
+{
+	return container_of(to_config_group(item), struct config_usb_cfg,
+			group);
+}
+
+struct gadget_strings {
+	struct usb_gadget_strings stringtab_dev;
+	struct usb_string strings[USB_GADGET_FIRST_AVAIL_IDX];
+	char *manufacturer;
+	char *product;
+	char *serialnumber;
+
+	struct config_group group;
+	struct list_head list;
+};
+
+struct os_desc {
+	struct config_group group;
+};
+
+struct gadget_config_name {
+	struct usb_gadget_strings stringtab_dev;
+	struct usb_string strings;
+	char *configuration;
+
+	struct config_group group;
+	struct list_head list;
+};
+
+
 void unregister_gadget_item(struct config_item *item);
 
 struct config_group *usb_os_desc_prepare_interf_dir(