@@ -5,6 +5,7 @@
subdir-ccflags-$(CONFIG_USB_GADGET_DEBUG) := -DDEBUG
subdir-ccflags-$(CONFIG_USB_GADGET_VERBOSE) += -DVERBOSE_DEBUG
+CFLAGS_configfs.o := -I$(src)
obj-$(CONFIG_USB_LIBCOMPOSITE) += libcomposite.o
libcomposite-y := usbstring.o config.o epautoconf.o
libcomposite-y += composite.o functions.o configfs.o u_f.o
@@ -123,6 +123,9 @@ static int usb_string_copy(const char *s, char **s_copy)
return 0;
}
+#define CREATE_TRACE_POINTS
+#include "trace.h"
+
#define GI_DEVICE_DESC_SIMPLE_R_u8(__name) \
static ssize_t gadget_dev_desc_##__name##_show(struct config_item *item, \
char *page) \
new file mode 100644
@@ -0,0 +1,39 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ */
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM gadget_configfs
+
+
+#if !defined(_GADGET_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _GADGET_TRACE_H
+
+#include <linux/tracepoint.h>
+
+TRACE_EVENT(gadget_configfs,
+ TP_PROTO(char *info),
+ TP_ARGS(info),
+ TP_STRUCT__entry(
+ __string(info, info)
+ ),
+
+ TP_fast_assign(
+ __assign_str(info, info);
+ ),
+
+ TP_printk("%s", __get_str(info))
+);
+
+#endif /* _GADGET_TRACE_H */
+
+/* this part has to be here */
+
+#undef TRACE_INCLUDE_PATH
+#define TRACE_INCLUDE_PATH .
+
+#undef TRACE_INCLUDE_FILE
+#define TRACE_INCLUDE_FILE trace
+
+#include <trace/define_trace.h>
Add a common trace event entry which have only one __string field, the following patch will add global function base on it to allow usb gadget and function layer use them, it will cover all user input like make configfs group/item, drop item, write attribute, allow/drop link. Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com> --- drivers/usb/gadget/Makefile | 1 + drivers/usb/gadget/configfs.c | 3 +++ drivers/usb/gadget/trace.h | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 drivers/usb/gadget/trace.h