* [PATCH 0/5] usb: gadget: configfs: add some trace event
@ 2021-09-02 13:12 Linyu Yuan
2021-09-02 13:12 ` [PATCH 1/5] usb: gadget: configfs: expose some struct from configfs.c Linyu Yuan
` (4 more replies)
0 siblings, 5 replies; 10+ messages in thread
From: Linyu Yuan @ 2021-09-02 13:12 UTC (permalink / raw)
To: Felipe Balbi, Greg Kroah-Hartman; +Cc: linux-usb, Linyu Yuan
this series make some minor change to gadget configfs
which allow common trace from configfs layer.
follow suggestion from Felipe Balbi in link below,
https://lore.kernel.org/linux-usb/1629777281-30188-1-git-send-email-quic_linyyuan@quicinc.com/
Linyu Yuan (5):
usb: gadget: configfs: expose some struct from configfs.c
usb: gadget: configfs: change OS attributes operation
usb: gadget: configfs: avoid list move operation of usb_function
usb: gadget: configfs: add gadget_info for config group
usb: gadget: configfs: add some trace event
drivers/usb/gadget/Makefile | 1 +
drivers/usb/gadget/configfs.c | 157 ++++++++++++----------------------
drivers/usb/gadget/configfs.h | 71 ++++++++++++++++
drivers/usb/gadget/configfs_trace.c | 43 ++++++++++
drivers/usb/gadget/configfs_trace.h | 164 ++++++++++++++++++++++++++++++++++++
5 files changed, 333 insertions(+), 103 deletions(-)
create mode 100644 drivers/usb/gadget/configfs_trace.c
create mode 100644 drivers/usb/gadget/configfs_trace.h
--
2.7.4
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/5] usb: gadget: configfs: expose some struct from configfs.c
2021-09-02 13:12 [PATCH 0/5] usb: gadget: configfs: add some trace event Linyu Yuan
@ 2021-09-02 13:12 ` Linyu Yuan
2021-09-02 13:12 ` [PATCH 2/5] usb: gadget: configfs: change OS attributes operation Linyu Yuan
` (3 subsequent siblings)
4 siblings, 0 replies; 10+ messages in thread
From: Linyu Yuan @ 2021-09-02 13:12 UTC (permalink / raw)
To: Felipe Balbi, Greg Kroah-Hartman; +Cc: linux-usb, Linyu Yuan
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>
---
drivers/usb/gadget/configfs.c | 66 -----------------------------------------
drivers/usb/gadget/configfs.h | 68 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 68 insertions(+), 66 deletions(-)
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(
--
2.7.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/5] usb: gadget: configfs: change OS attributes operation
2021-09-02 13:12 [PATCH 0/5] usb: gadget: configfs: add some trace event Linyu Yuan
2021-09-02 13:12 ` [PATCH 1/5] usb: gadget: configfs: expose some struct from configfs.c Linyu Yuan
@ 2021-09-02 13:12 ` Linyu Yuan
2021-09-02 13:12 ` [PATCH 3/5] usb: gadget: configfs: avoid list move operation of usb_function Linyu Yuan
` (2 subsequent siblings)
4 siblings, 0 replies; 10+ messages in thread
From: Linyu Yuan @ 2021-09-02 13:12 UTC (permalink / raw)
To: Felipe Balbi, Greg Kroah-Hartman; +Cc: linux-usb, Linyu Yuan
OS decsriptor related attributes use,b_vendor_code,qw_sign
can removed from struct gadget_info, there are sames member in
struct usb_composite_dev.
Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com>
---
drivers/usb/gadget/configfs.c | 18 ++++++------------
drivers/usb/gadget/configfs.h | 3 ---
2 files changed, 6 insertions(+), 15 deletions(-)
diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
index 0f3a01f..39b916a 100644
--- a/drivers/usb/gadget/configfs.c
+++ b/drivers/usb/gadget/configfs.c
@@ -723,7 +723,7 @@ static inline struct gadget_info *os_desc_item_to_gadget_info(
static ssize_t os_desc_use_show(struct config_item *item, char *page)
{
return sprintf(page, "%d\n",
- os_desc_item_to_gadget_info(item)->use_os_desc);
+ os_desc_item_to_gadget_info(item)->cdev.use_os_string);
}
static ssize_t os_desc_use_store(struct config_item *item, const char *page,
@@ -736,7 +736,7 @@ static ssize_t os_desc_use_store(struct config_item *item, const char *page,
mutex_lock(&gi->lock);
ret = strtobool(page, &use);
if (!ret) {
- gi->use_os_desc = use;
+ gi->cdev.use_os_string = use;
ret = len;
}
mutex_unlock(&gi->lock);
@@ -747,7 +747,7 @@ static ssize_t os_desc_use_store(struct config_item *item, const char *page,
static ssize_t os_desc_b_vendor_code_show(struct config_item *item, char *page)
{
return sprintf(page, "0x%02x\n",
- os_desc_item_to_gadget_info(item)->b_vendor_code);
+ os_desc_item_to_gadget_info(item)->cdev.b_vendor_code);
}
static ssize_t os_desc_b_vendor_code_store(struct config_item *item,
@@ -760,7 +760,7 @@ static ssize_t os_desc_b_vendor_code_store(struct config_item *item,
mutex_lock(&gi->lock);
ret = kstrtou8(page, 0, &b_vendor_code);
if (!ret) {
- gi->b_vendor_code = b_vendor_code;
+ gi->cdev.b_vendor_code = b_vendor_code;
ret = len;
}
mutex_unlock(&gi->lock);
@@ -773,7 +773,7 @@ static ssize_t os_desc_qw_sign_show(struct config_item *item, char *page)
struct gadget_info *gi = os_desc_item_to_gadget_info(item);
int res;
- res = utf16s_to_utf8s((wchar_t *) gi->qw_sign, OS_STRING_QW_SIGN_LEN,
+ res = utf16s_to_utf8s((wchar_t *) gi->cdev.qw_sign, OS_STRING_QW_SIGN_LEN,
UTF16_LITTLE_ENDIAN, page, PAGE_SIZE - 1);
page[res++] = '\n';
@@ -792,7 +792,7 @@ static ssize_t os_desc_qw_sign_store(struct config_item *item, const char *page,
mutex_lock(&gi->lock);
res = utf8s_to_utf16s(page, l,
- UTF16_LITTLE_ENDIAN, (wchar_t *) gi->qw_sign,
+ UTF16_LITTLE_ENDIAN, (wchar_t *) gi->cdev.qw_sign,
OS_STRING_QW_SIGN_LEN);
if (res > 0)
res = len;
@@ -1283,12 +1283,6 @@ static int configfs_composite_bind(struct usb_gadget *gadget,
gi->cdev.desc.iSerialNumber = s[USB_GADGET_SERIAL_IDX].id;
}
- if (gi->use_os_desc) {
- cdev->use_os_string = true;
- cdev->b_vendor_code = gi->b_vendor_code;
- memcpy(cdev->qw_sign, gi->qw_sign, OS_STRING_QW_SIGN_LEN);
- }
-
if (gadget_is_otg(gadget) && !otg_desc[0]) {
struct usb_descriptor_header *usb_desc;
diff --git a/drivers/usb/gadget/configfs.h b/drivers/usb/gadget/configfs.h
index bae403f..a1dc513 100644
--- a/drivers/usb/gadget/configfs.h
+++ b/drivers/usb/gadget/configfs.h
@@ -20,9 +20,6 @@ struct gadget_info {
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;
};
--
2.7.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/5] usb: gadget: configfs: avoid list move operation of usb_function
2021-09-02 13:12 [PATCH 0/5] usb: gadget: configfs: add some trace event Linyu Yuan
2021-09-02 13:12 ` [PATCH 1/5] usb: gadget: configfs: expose some struct from configfs.c Linyu Yuan
2021-09-02 13:12 ` [PATCH 2/5] usb: gadget: configfs: change OS attributes operation Linyu Yuan
@ 2021-09-02 13:12 ` Linyu Yuan
2021-09-02 15:00 ` kernel test robot
2021-09-02 13:12 ` [PATCH 4/5] usb: gadget: configfs: add gadget_info for config group Linyu Yuan
2021-09-02 13:12 ` [PATCH 5/5] usb: gadget: configfs: add some trace event Linyu Yuan
4 siblings, 1 reply; 10+ messages in thread
From: Linyu Yuan @ 2021-09-02 13:12 UTC (permalink / raw)
To: Felipe Balbi, Greg Kroah-Hartman; +Cc: linux-usb, Linyu Yuan
add a new list which link all usb_function at configfs layers,
it means that after link a function a configuration,
from configfs layer, we can still found all functions,
it will allow trace all functions from configfs.
Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com>
---
drivers/usb/gadget/configfs.c | 47 ++++++++++++++++++++++++-------------------
drivers/usb/gadget/configfs.h | 5 +++++
2 files changed, 31 insertions(+), 21 deletions(-)
diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
index 39b916a..c5b5c2f 100644
--- a/drivers/usb/gadget/configfs.c
+++ b/drivers/usb/gadget/configfs.c
@@ -354,7 +354,7 @@ static int config_usb_cfg_link(
struct usb_function_instance *fi = container_of(group,
struct usb_function_instance, group);
struct usb_function_instance *a_fi;
- struct usb_function *f;
+ struct config_usb_function *cf;
int ret;
mutex_lock(&gi->lock);
@@ -372,21 +372,29 @@ static int config_usb_cfg_link(
goto out;
}
- list_for_each_entry(f, &cfg->func_list, list) {
- if (f->fi == fi) {
+ list_for_each_entry(cf, &cfg->func_list, list) {
+ if (cf->f->fi == fi) {
ret = -EEXIST;
goto out;
}
}
- f = usb_get_function(fi);
- if (IS_ERR(f)) {
- ret = PTR_ERR(f);
+ cf = kzalloc(sizeof(*cf), GFP_KERNEL);
+ if (!cf) {
+ ret = -ENOMEM;
+ goto out;
+ }
+ INIT_LIST_HEAD(&cf->list);
+
+ cf->f = usb_get_function(fi);
+ if (IS_ERR(cf->f)) {
+ ret = PTR_ERR(cf->f);
+ kfree(cf);
goto out;
}
/* stash the function until we bind it to the gadget */
- list_add_tail(&f->list, &cfg->func_list);
+ list_add_tail(&cf->list, &cfg->func_list);
ret = 0;
out:
mutex_unlock(&gi->lock);
@@ -404,7 +412,7 @@ static void config_usb_cfg_unlink(
struct config_group *group = to_config_group(usb_func_ci);
struct usb_function_instance *fi = container_of(group,
struct usb_function_instance, group);
- struct usb_function *f;
+ struct config_usb_function *cf;
/*
* ideally I would like to forbid to unlink functions while a gadget is
@@ -417,10 +425,11 @@ static void config_usb_cfg_unlink(
unregister_gadget(gi);
WARN_ON(gi->composite.gadget_driver.udc_name);
- list_for_each_entry(f, &cfg->func_list, list) {
- if (f->fi == fi) {
- list_del(&f->list);
- usb_put_function(f);
+ list_for_each_entry(cf, &cfg->func_list, list) {
+ if (cf->f->fi == fi) {
+ list_del(&cf->list);
+ usb_put_function(cf->f);
+ kfree(cf);
mutex_unlock(&gi->lock);
return;
}
@@ -1197,7 +1206,7 @@ static void purge_configs_funcs(struct gadget_info *gi)
list_for_each_entry_safe_reverse(f, tmp, &c->functions, list) {
- list_move(&f->list, &cfg->func_list);
+ list_del(&f->list);
if (f->unbind) {
dev_dbg(&gi->cdev.gadget->dev,
"unbind function '%s'/%p\n",
@@ -1299,8 +1308,7 @@ static int configfs_composite_bind(struct usb_gadget *gadget,
/* Go through all configs, attach all functions */
list_for_each_entry(c, &gi->cdev.configs, list) {
struct config_usb_cfg *cfg;
- struct usb_function *f;
- struct usb_function *tmp;
+ struct config_usb_function *cf, *tmp;
struct gadget_config_name *cn;
if (gadget_is_otg(gadget))
@@ -1324,13 +1332,10 @@ static int configfs_composite_bind(struct usb_gadget *gadget,
c->iConfiguration = s[0].id;
}
- list_for_each_entry_safe(f, tmp, &cfg->func_list, list) {
- list_del(&f->list);
- ret = usb_add_function(c, f);
- if (ret) {
- list_add(&f->list, &cfg->func_list);
+ list_for_each_entry_safe(cf, tmp, &cfg->func_list, list) {
+ ret = usb_add_function(c, cf->f);
+ if (ret)
goto err_purge_funcs;
- }
}
ret = usb_gadget_check_config(cdev->gadget);
if (ret)
diff --git a/drivers/usb/gadget/configfs.h b/drivers/usb/gadget/configfs.h
index a1dc513..103df1b 100644
--- a/drivers/usb/gadget/configfs.h
+++ b/drivers/usb/gadget/configfs.h
@@ -44,6 +44,11 @@ static inline struct config_usb_cfg *to_config_usb_cfg(struct config_item *item)
group);
}
+struct config_usb_function {
+ struct list_head list;
+ struct usb_function *f;
+};
+
struct gadget_strings {
struct usb_gadget_strings stringtab_dev;
struct usb_string strings[USB_GADGET_FIRST_AVAIL_IDX];
--
2.7.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 4/5] usb: gadget: configfs: add gadget_info for config group
2021-09-02 13:12 [PATCH 0/5] usb: gadget: configfs: add some trace event Linyu Yuan
` (2 preceding siblings ...)
2021-09-02 13:12 ` [PATCH 3/5] usb: gadget: configfs: avoid list move operation of usb_function Linyu Yuan
@ 2021-09-02 13:12 ` Linyu Yuan
2021-09-02 13:12 ` [PATCH 5/5] usb: gadget: configfs: add some trace event Linyu Yuan
4 siblings, 0 replies; 10+ messages in thread
From: Linyu Yuan @ 2021-09-02 13:12 UTC (permalink / raw)
To: Felipe Balbi, Greg Kroah-Hartman; +Cc: linux-usb, Linyu Yuan
add gadget_info pointer in struct config_usb_cfg
to allow common gadget info trace from configfs layer.
Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com>
---
drivers/usb/gadget/configfs.c | 7 +++----
drivers/usb/gadget/configfs.h | 1 +
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
index c5b5c2f..6b02e74 100644
--- a/drivers/usb/gadget/configfs.c
+++ b/drivers/usb/gadget/configfs.c
@@ -347,8 +347,7 @@ static int config_usb_cfg_link(
struct config_item *usb_func_ci)
{
struct config_usb_cfg *cfg = to_config_usb_cfg(usb_cfg_ci);
- struct usb_composite_dev *cdev = cfg->c.cdev;
- struct gadget_info *gi = container_of(cdev, struct gadget_info, cdev);
+ struct gadget_info *gi = cfg->gi;
struct config_group *group = to_config_group(usb_func_ci);
struct usb_function_instance *fi = container_of(group,
@@ -406,8 +405,7 @@ static void config_usb_cfg_unlink(
struct config_item *usb_func_ci)
{
struct config_usb_cfg *cfg = to_config_usb_cfg(usb_cfg_ci);
- struct usb_composite_dev *cdev = cfg->c.cdev;
- struct gadget_info *gi = container_of(cdev, struct gadget_info, cdev);
+ struct gadget_info *gi = cfg->gi;
struct config_group *group = to_config_group(usb_func_ci);
struct usb_function_instance *fi = container_of(group,
@@ -646,6 +644,7 @@ static struct config_group *config_desc_make(
cfg = kzalloc(sizeof(*cfg), GFP_KERNEL);
if (!cfg)
return ERR_PTR(-ENOMEM);
+ cfg->gi = gi;
cfg->c.label = kstrdup(buf, GFP_KERNEL);
if (!cfg->c.label) {
ret = -ENOMEM;
diff --git a/drivers/usb/gadget/configfs.h b/drivers/usb/gadget/configfs.h
index 103df1b..2fa2c3b 100644
--- a/drivers/usb/gadget/configfs.h
+++ b/drivers/usb/gadget/configfs.h
@@ -36,6 +36,7 @@ struct config_usb_cfg {
struct usb_configuration c;
struct list_head func_list;
struct usb_gadget_strings *gstrings[MAX_USB_STRING_LANGS + 1];
+ struct gadget_info *gi;
};
static inline struct config_usb_cfg *to_config_usb_cfg(struct config_item *item)
--
2.7.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 5/5] usb: gadget: configfs: add some trace event
2021-09-02 13:12 [PATCH 0/5] usb: gadget: configfs: add some trace event Linyu Yuan
` (3 preceding siblings ...)
2021-09-02 13:12 ` [PATCH 4/5] usb: gadget: configfs: add gadget_info for config group Linyu Yuan
@ 2021-09-02 13:12 ` Linyu Yuan
2021-09-02 19:27 ` kernel test robot
4 siblings, 1 reply; 10+ messages in thread
From: Linyu Yuan @ 2021-09-02 13:12 UTC (permalink / raw)
To: Felipe Balbi, Greg Kroah-Hartman; +Cc: linux-usb, Linyu Yuan
add UDC, cfg link/unlink and some attributes trace
to better trace gadget issues.
Suggested-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com>
---
drivers/usb/gadget/Makefile | 1 +
drivers/usb/gadget/configfs.c | 19 +++++
drivers/usb/gadget/configfs_trace.c | 43 ++++++++++
drivers/usb/gadget/configfs_trace.h | 164 ++++++++++++++++++++++++++++++++++++
4 files changed, 227 insertions(+)
create mode 100644 drivers/usb/gadget/configfs_trace.c
create mode 100644 drivers/usb/gadget/configfs_trace.h
diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile
index 130dad7..8e9c2b8 100644
--- a/drivers/usb/gadget/Makefile
+++ b/drivers/usb/gadget/Makefile
@@ -9,5 +9,6 @@ ccflags-y += -I$(srctree)/drivers/usb/gadget/udc
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
+libcomposite-y += configfs_trace.o
obj-$(CONFIG_USB_GADGET) += udc/ function/ legacy/
diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
index 6b02e74..d63fed2 100644
--- a/drivers/usb/gadget/configfs.c
+++ b/drivers/usb/gadget/configfs.c
@@ -9,6 +9,7 @@
#include "configfs.h"
#include "u_f.h"
#include "u_os_desc.h"
+#include "configfs_trace.h"
int check_user_usb_string(const char *name,
struct usb_gadget_strings *stringtab_dev)
@@ -138,6 +139,7 @@ static ssize_t gadget_dev_desc_bcdDevice_store(struct config_item *item,
if (ret)
return ret;
+ trace_gadget_dev_desc_bcdDevice_store(to_gadget_info(item));
to_gadget_info(item)->cdev.desc.bcdDevice = cpu_to_le16(bcdDevice);
return len;
}
@@ -156,6 +158,7 @@ static ssize_t gadget_dev_desc_bcdUSB_store(struct config_item *item,
return ret;
to_gadget_info(item)->cdev.desc.bcdUSB = cpu_to_le16(bcdUSB);
+ trace_gadget_dev_desc_bcdUSB_store(to_gadget_info(item));
return len;
}
@@ -168,6 +171,7 @@ static ssize_t gadget_dev_desc_UDC_show(struct config_item *item, char *page)
mutex_lock(&gi->lock);
udc_name = gi->composite.gadget_driver.udc_name;
ret = sprintf(page, "%s\n", udc_name ?: "");
+ trace_gadget_dev_desc_UDC_show(gi);
mutex_unlock(&gi->lock);
return ret;
@@ -177,6 +181,7 @@ static int unregister_gadget(struct gadget_info *gi)
{
int ret;
+ trace_unregister_gadget(gi);
if (!gi->composite.gadget_driver.udc_name)
return -ENODEV;
@@ -204,6 +209,8 @@ static ssize_t gadget_dev_desc_UDC_store(struct config_item *item,
if (name[len - 1] == '\n')
name[len - 1] = '\0';
+ trace_gadget_dev_desc_UDC_store(gi);
+
mutex_lock(&gi->lock);
if (!strlen(name)) {
@@ -224,6 +231,8 @@ static ssize_t gadget_dev_desc_UDC_store(struct config_item *item,
}
}
mutex_unlock(&gi->lock);
+
+ trace_gadget_dev_desc_UDC_store(gi);
return len;
err:
kfree(name);
@@ -236,6 +245,7 @@ static ssize_t gadget_dev_desc_max_speed_show(struct config_item *item,
{
enum usb_device_speed speed = to_gadget_info(item)->composite.max_speed;
+ trace_gadget_dev_desc_max_speed_show(to_gadget_info(item));
return sprintf(page, "%s\n", usb_speed_string(speed));
}
@@ -265,6 +275,8 @@ static ssize_t gadget_dev_desc_max_speed_store(struct config_item *item,
gi->composite.gadget_driver.max_speed = gi->composite.max_speed;
+ trace_gadget_dev_desc_max_speed_store(gi);
+
mutex_unlock(&gi->lock);
return len;
err:
@@ -396,6 +408,7 @@ static int config_usb_cfg_link(
list_add_tail(&cf->list, &cfg->func_list);
ret = 0;
out:
+ trace_config_usb_cfg_link(gi);
mutex_unlock(&gi->lock);
return ret;
}
@@ -428,10 +441,12 @@ static void config_usb_cfg_unlink(
list_del(&cf->list);
usb_put_function(cf->f);
kfree(cf);
+ trace_config_usb_cfg_unlink(gi);
mutex_unlock(&gi->lock);
return;
}
}
+ trace_config_usb_cfg_unlink(gi);
mutex_unlock(&gi->lock);
WARN(1, "Unable to locate function to unbind\n");
}
@@ -446,6 +461,7 @@ static struct configfs_item_operations gadget_config_item_ops = {
static ssize_t gadget_config_desc_MaxPower_show(struct config_item *item,
char *page)
{
+ trace_gadget_config_desc_MaxPower_show(to_config_usb_cfg(item)->gi);
return sprintf(page, "%u\n", to_config_usb_cfg(item)->c.MaxPower);
}
@@ -460,12 +476,14 @@ static ssize_t gadget_config_desc_MaxPower_store(struct config_item *item,
if (DIV_ROUND_UP(val, 8) > 0xff)
return -ERANGE;
to_config_usb_cfg(item)->c.MaxPower = val;
+ trace_gadget_config_desc_MaxPower_store(to_config_usb_cfg(item)->gi);
return len;
}
static ssize_t gadget_config_desc_bmAttributes_show(struct config_item *item,
char *page)
{
+ trace_gadget_config_desc_bmAttributes_show(to_config_usb_cfg(item)->gi);
return sprintf(page, "0x%02x\n",
to_config_usb_cfg(item)->c.bmAttributes);
}
@@ -484,6 +502,7 @@ static ssize_t gadget_config_desc_bmAttributes_store(struct config_item *item,
USB_CONFIG_ATT_WAKEUP))
return -EINVAL;
to_config_usb_cfg(item)->c.bmAttributes = val;
+ trace_gadget_config_desc_bmAttributes_store(to_config_usb_cfg(item)->gi);
return len;
}
diff --git a/drivers/usb/gadget/configfs_trace.c b/drivers/usb/gadget/configfs_trace.c
new file mode 100644
index 0000000..a39454f
--- /dev/null
+++ b/drivers/usb/gadget/configfs_trace.c
@@ -0,0 +1,43 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
+ */
+
+#include <linux/usb/composite.h>
+#include "configfs.h"
+
+#define MAX_CONFIGURAITON_STR_LEN 512
+
+static char *config_to_string(struct gadget_info *gi)
+{
+ struct usb_configuration *uc;
+ struct config_usb_cfg *cfg;
+ struct config_usb_function *cf;
+ static char cfg_str[MAX_CONFIGURAITON_STR_LEN];
+ size_t len = MAX_CONFIGURAITON_STR_LEN;
+ int n = 0;
+
+ cfg_str[0] = '\0';
+
+ list_for_each_entry(uc, &gi->cdev.configs, list) {
+ cfg = container_of(uc, struct config_usb_cfg, c);
+
+ n += scnprintf(cfg_str + n, len - n,
+ "group:%s,bConfigurationValue:%d,bmAttributes:%d,"
+ "MaxPower:%d,",
+ config_item_name(&cfg->group.cg_item),
+ uc->bConfigurationValue,
+ uc->bmAttributes,
+ uc->MaxPower);
+
+ n += scnprintf(cfg_str + n, len - n, "function:[");
+ list_for_each_entry(cf, &cfg->func_list, list)
+ n += scnprintf(cfg_str + n, len - n, "%s", cf->f->name);
+ n += scnprintf(cfg_str + n, len - n, "},");
+ }
+
+ return cfg_str;
+}
+
+#define CREATE_TRACE_POINTS
+#include "configfs_trace.h"
diff --git a/drivers/usb/gadget/configfs_trace.h b/drivers/usb/gadget/configfs_trace.h
new file mode 100644
index 0000000..c7d4856
--- /dev/null
+++ b/drivers/usb/gadget/configfs_trace.h
@@ -0,0 +1,164 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
+ */
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM configfs_gadget
+
+#if !defined(__GADGET_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
+#define __GADGET_TRACE_H
+
+#include <linux/tracepoint.h>
+
+DECLARE_EVENT_CLASS(log_gadget_info,
+ TP_PROTO(struct gadget_info *gi),
+ TP_ARGS(gi),
+ TP_STRUCT__entry(
+ /* gadget_info */
+ __string(gi_group, config_item_name(&gi->group.cg_item))
+ __field(bool, unbind)
+
+ /* usb_composite_dev */
+ __field(u8, b_vendor_code)
+ __field(bool, suspended)
+ __field(bool, setup_pending)
+ __field(bool, os_desc_pending)
+ __field(unsigned, deactivations)
+ __field(int, delayed_status)
+ __field(__le16, bcdUSB)
+ __field(__le16, bcdDevice)
+ __string(config, gi->cdev.config)
+
+ /* usb_composite_driver */
+ __field(unsigned, max_speed)
+ __field(bool, needs_serial)
+
+ /* usb_gadget_driver */
+ __string(udc_name, gi->composite.gadget_driver.udc_name)
+ ),
+ TP_fast_assign(
+ __assign_str(gi_group, config_item_name(&gi->group.cg_item));
+ __entry->unbind = gi->unbind;
+
+ __entry->b_vendor_code = gi->cdev.b_vendor_code;
+ __entry->suspended = gi->cdev.suspended;
+ __entry->setup_pending = gi->cdev.setup_pending;
+ __entry->os_desc_pending = gi->cdev.os_desc_pending;
+ __entry->deactivations = gi->cdev.deactivations;
+ __entry->delayed_status = gi->cdev.delayed_status;
+ __entry->bcdUSB = gi->cdev.desc.bcdUSB;
+ __entry->bcdDevice = gi->cdev.desc.bcdDevice;
+ __assign_str(config, config_to_string(gi));
+
+ __entry->max_speed = gi->composite.max_speed;
+ __entry->needs_serial = gi->composite.needs_serial;
+
+ __assign_str(udc_name, gi->composite.gadget_driver.udc_name);
+ ),
+ TP_printk("gi_group:%s,unbind:%d,"
+ " - "
+ "b_vendor_code:%d,suspended:%d,setup_pending:%d,"
+ "os_desc_pending:%d,deactivations:%d,delayed_status:%d,"
+ "bcdUSB:%04x,bcdDevice:%04x,config:%s,"
+ " - "
+ "max_speed:%d,needs_serial:%d,"
+ " - "
+ "udc_name:%s",
+
+ __get_str(gi_group),
+ __entry->unbind,
+
+ __entry->b_vendor_code,
+ __entry->suspended,
+ __entry->setup_pending,
+ __entry->os_desc_pending,
+ __entry->deactivations,
+ __entry->delayed_status,
+ le16_to_cpu(__entry->bcdUSB),
+ le16_to_cpu(__entry->bcdDevice),
+ __get_str(config),
+
+ __entry->max_speed,
+ __entry->needs_serial,
+
+ __get_str(udc_name)
+ )
+);
+
+DEFINE_EVENT(log_gadget_info, gadget_dev_desc_bcdDevice_store,
+ TP_PROTO(struct gadget_info *gi),
+ TP_ARGS(gi)
+);
+
+DEFINE_EVENT(log_gadget_info, gadget_dev_desc_bcdUSB_store,
+ TP_PROTO(struct gadget_info *gi),
+ TP_ARGS(gi)
+);
+
+DEFINE_EVENT(log_gadget_info, gadget_dev_desc_UDC_show,
+ TP_PROTO(struct gadget_info *gi),
+ TP_ARGS(gi)
+);
+
+DEFINE_EVENT(log_gadget_info, unregister_gadget,
+ TP_PROTO(struct gadget_info *gi),
+ TP_ARGS(gi)
+);
+
+DEFINE_EVENT(log_gadget_info, gadget_dev_desc_UDC_store,
+ TP_PROTO(struct gadget_info *gi),
+ TP_ARGS(gi)
+);
+
+DEFINE_EVENT(log_gadget_info, gadget_dev_desc_max_speed_show,
+ TP_PROTO(struct gadget_info *gi),
+ TP_ARGS(gi)
+);
+
+DEFINE_EVENT(log_gadget_info, gadget_dev_desc_max_speed_store,
+ TP_PROTO(struct gadget_info *gi),
+ TP_ARGS(gi)
+);
+
+DEFINE_EVENT(log_gadget_info, config_usb_cfg_link,
+ TP_PROTO(struct gadget_info *gi),
+ TP_ARGS(gi)
+);
+
+DEFINE_EVENT(log_gadget_info, config_usb_cfg_unlink,
+ TP_PROTO(struct gadget_info *gi),
+ TP_ARGS(gi)
+);
+
+DEFINE_EVENT(log_gadget_info, gadget_config_desc_MaxPower_show,
+ TP_PROTO(struct gadget_info *gi),
+ TP_ARGS(gi)
+);
+
+DEFINE_EVENT(log_gadget_info, gadget_config_desc_MaxPower_store,
+ TP_PROTO(struct gadget_info *gi),
+ TP_ARGS(gi)
+);
+
+DEFINE_EVENT(log_gadget_info, gadget_config_desc_bmAttributes_show,
+ TP_PROTO(struct gadget_info *gi),
+ TP_ARGS(gi)
+);
+
+DEFINE_EVENT(log_gadget_info, gadget_config_desc_bmAttributes_store,
+ TP_PROTO(struct gadget_info *gi),
+ TP_ARGS(gi)
+);
+
+#endif /* __GADGET_TRACE_H */
+
+/* this part has to be here */
+
+#undef TRACE_INCLUDE_PATH
+#define TRACE_INCLUDE_PATH ../../drivers/usb/gadget
+
+#undef TRACE_INCLUDE_FILE
+#define TRACE_INCLUDE_FILE configfs_trace
+
+#include <trace/define_trace.h>
--
2.7.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 3/5] usb: gadget: configfs: avoid list move operation of usb_function
2021-09-02 13:12 ` [PATCH 3/5] usb: gadget: configfs: avoid list move operation of usb_function Linyu Yuan
@ 2021-09-02 15:00 ` kernel test robot
0 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2021-09-02 15:00 UTC (permalink / raw)
To: Linyu Yuan, Felipe Balbi, Greg Kroah-Hartman
Cc: llvm, kbuild-all, linux-usb, Linyu Yuan
[-- Attachment #1: Type: text/plain, Size: 4981 bytes --]
Hi Linyu,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on usb/usb-testing]
[also build test WARNING on peter.chen-usb/for-usb-next next-20210902]
[cannot apply to balbi-usb/testing/next v5.14]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Linyu-Yuan/usb-gadget-configfs-add-some-trace-event/20210902-211519
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: hexagon-randconfig-r045-20210901 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project c9948e9254fbb6ea00f66c7b4542311d21e060be)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/855bbfeebfb8ad0859f690047753221b635d391a
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Linyu-Yuan/usb-gadget-configfs-add-some-trace-event/20210902-211519
git checkout 855bbfeebfb8ad0859f690047753221b635d391a
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=hexagon
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/usb/gadget/configfs.c:1203:26: warning: variable 'cfg' set but not used [-Wunused-but-set-variable]
struct config_usb_cfg *cfg;
^
1 warning generated.
vim +/cfg +1203 drivers/usb/gadget/configfs.c
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1190
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1191 int composite_dev_prepare(struct usb_composite_driver *composite,
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1192 struct usb_composite_dev *dev);
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1193
da4243145fb197 Andrzej Pietrasiewicz 2014-05-08 1194 int composite_os_desc_req_prepare(struct usb_composite_dev *cdev,
da4243145fb197 Andrzej Pietrasiewicz 2014-05-08 1195 struct usb_ep *ep0);
da4243145fb197 Andrzej Pietrasiewicz 2014-05-08 1196
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1197 static void purge_configs_funcs(struct gadget_info *gi)
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1198 {
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1199 struct usb_configuration *c;
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1200
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1201 list_for_each_entry(c, &gi->cdev.configs, list) {
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1202 struct usb_function *f, *tmp;
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 @1203 struct config_usb_cfg *cfg;
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1204
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1205 cfg = container_of(c, struct config_usb_cfg, c);
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1206
6cd0fe91387917 Chandana Kishori Chiluveru 2020-12-29 1207 list_for_each_entry_safe_reverse(f, tmp, &c->functions, list) {
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1208
855bbfeebfb8ad Linyu Yuan 2021-09-02 1209 list_del(&f->list);
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1210 if (f->unbind) {
da7b895d518cc1 Romain Izard 2016-08-29 1211 dev_dbg(&gi->cdev.gadget->dev,
a08f5dbf877a45 Romain Izard 2016-07-26 1212 "unbind function '%s'/%p\n",
a08f5dbf877a45 Romain Izard 2016-07-26 1213 f->name, f);
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1214 f->unbind(c, f);
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1215 }
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1216 }
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1217 c->next_interface_id = 0;
903124fe1aa284 Krzysztof Opasiak 2015-03-20 1218 memset(c->interface, 0, sizeof(c->interface));
554eead5436401 John Youn 2016-02-05 1219 c->superspeed_plus = 0;
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1220 c->superspeed = 0;
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1221 c->highspeed = 0;
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1222 c->fullspeed = 0;
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1223 }
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1224 }
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1225
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 20810 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/5] usb: gadget: configfs: avoid list move operation of usb_function
@ 2021-09-02 15:00 ` kernel test robot
0 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2021-09-02 15:00 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 5061 bytes --]
Hi Linyu,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on usb/usb-testing]
[also build test WARNING on peter.chen-usb/for-usb-next next-20210902]
[cannot apply to balbi-usb/testing/next v5.14]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Linyu-Yuan/usb-gadget-configfs-add-some-trace-event/20210902-211519
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: hexagon-randconfig-r045-20210901 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project c9948e9254fbb6ea00f66c7b4542311d21e060be)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/855bbfeebfb8ad0859f690047753221b635d391a
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Linyu-Yuan/usb-gadget-configfs-add-some-trace-event/20210902-211519
git checkout 855bbfeebfb8ad0859f690047753221b635d391a
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=hexagon
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/usb/gadget/configfs.c:1203:26: warning: variable 'cfg' set but not used [-Wunused-but-set-variable]
struct config_usb_cfg *cfg;
^
1 warning generated.
vim +/cfg +1203 drivers/usb/gadget/configfs.c
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1190
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1191 int composite_dev_prepare(struct usb_composite_driver *composite,
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1192 struct usb_composite_dev *dev);
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1193
da4243145fb197 Andrzej Pietrasiewicz 2014-05-08 1194 int composite_os_desc_req_prepare(struct usb_composite_dev *cdev,
da4243145fb197 Andrzej Pietrasiewicz 2014-05-08 1195 struct usb_ep *ep0);
da4243145fb197 Andrzej Pietrasiewicz 2014-05-08 1196
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1197 static void purge_configs_funcs(struct gadget_info *gi)
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1198 {
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1199 struct usb_configuration *c;
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1200
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1201 list_for_each_entry(c, &gi->cdev.configs, list) {
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1202 struct usb_function *f, *tmp;
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 @1203 struct config_usb_cfg *cfg;
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1204
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1205 cfg = container_of(c, struct config_usb_cfg, c);
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1206
6cd0fe91387917 Chandana Kishori Chiluveru 2020-12-29 1207 list_for_each_entry_safe_reverse(f, tmp, &c->functions, list) {
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1208
855bbfeebfb8ad Linyu Yuan 2021-09-02 1209 list_del(&f->list);
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1210 if (f->unbind) {
da7b895d518cc1 Romain Izard 2016-08-29 1211 dev_dbg(&gi->cdev.gadget->dev,
a08f5dbf877a45 Romain Izard 2016-07-26 1212 "unbind function '%s'/%p\n",
a08f5dbf877a45 Romain Izard 2016-07-26 1213 f->name, f);
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1214 f->unbind(c, f);
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1215 }
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1216 }
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1217 c->next_interface_id = 0;
903124fe1aa284 Krzysztof Opasiak 2015-03-20 1218 memset(c->interface, 0, sizeof(c->interface));
554eead5436401 John Youn 2016-02-05 1219 c->superspeed_plus = 0;
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1220 c->superspeed = 0;
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1221 c->highspeed = 0;
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1222 c->fullspeed = 0;
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1223 }
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1224 }
88af8bbe4ef781 Sebastian Andrzej Siewior 2012-12-23 1225
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 20810 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 5/5] usb: gadget: configfs: add some trace event
2021-09-02 13:12 ` [PATCH 5/5] usb: gadget: configfs: add some trace event Linyu Yuan
@ 2021-09-02 19:27 ` kernel test robot
0 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2021-09-02 19:27 UTC (permalink / raw)
To: Linyu Yuan, Felipe Balbi, Greg Kroah-Hartman
Cc: kbuild-all, linux-usb, Linyu Yuan
[-- Attachment #1: Type: text/plain, Size: 5302 bytes --]
Hi Linyu,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on usb/usb-testing]
[also build test WARNING on peter.chen-usb/for-usb-next next-20210902]
[cannot apply to balbi-usb/testing/next v5.14]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Linyu-Yuan/usb-gadget-configfs-add-some-trace-event/20210902-211519
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: x86_64-randconfig-s021-20210902 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-rc1-dirty
# https://github.com/0day-ci/linux/commit/f173b8a0bbf4b051a79b533539e4469cfe050fc1
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Linyu-Yuan/usb-gadget-configfs-add-some-trace-event/20210902-211519
git checkout f173b8a0bbf4b051a79b533539e4469cfe050fc1
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/usb/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
sparse warnings: (new ones prefixed by >>)
drivers/usb/gadget/configfs_trace.c: note: in included file (through include/trace/trace_events.h, include/trace/define_trace.h, drivers/usb/gadget/configfs_trace.h):
>> include/trace/../../drivers/usb/gadget/configfs_trace.h:14:1: sparse: sparse: cast to restricted __le16
>> include/trace/../../drivers/usb/gadget/configfs_trace.h:14:1: sparse: sparse: cast to restricted __le16
>> include/trace/../../drivers/usb/gadget/configfs_trace.h:14:1: sparse: sparse: restricted __le16 degrades to integer
>> include/trace/../../drivers/usb/gadget/configfs_trace.h:14:1: sparse: sparse: restricted __le16 degrades to integer
>> include/trace/../../drivers/usb/gadget/configfs_trace.h:14:1: sparse: sparse: cast to restricted __le16
>> include/trace/../../drivers/usb/gadget/configfs_trace.h:14:1: sparse: sparse: cast to restricted __le16
>> include/trace/../../drivers/usb/gadget/configfs_trace.h:14:1: sparse: sparse: restricted __le16 degrades to integer
>> include/trace/../../drivers/usb/gadget/configfs_trace.h:14:1: sparse: sparse: restricted __le16 degrades to integer
vim +14 include/trace/../../drivers/usb/gadget/configfs_trace.h
13
> 14 DECLARE_EVENT_CLASS(log_gadget_info,
15 TP_PROTO(struct gadget_info *gi),
16 TP_ARGS(gi),
17 TP_STRUCT__entry(
18 /* gadget_info */
19 __string(gi_group, config_item_name(&gi->group.cg_item))
20 __field(bool, unbind)
21
22 /* usb_composite_dev */
23 __field(u8, b_vendor_code)
24 __field(bool, suspended)
25 __field(bool, setup_pending)
26 __field(bool, os_desc_pending)
27 __field(unsigned, deactivations)
28 __field(int, delayed_status)
29 __field(__le16, bcdUSB)
30 __field(__le16, bcdDevice)
31 __string(config, gi->cdev.config)
32
33 /* usb_composite_driver */
34 __field(unsigned, max_speed)
35 __field(bool, needs_serial)
36
37 /* usb_gadget_driver */
38 __string(udc_name, gi->composite.gadget_driver.udc_name)
39 ),
40 TP_fast_assign(
41 __assign_str(gi_group, config_item_name(&gi->group.cg_item));
42 __entry->unbind = gi->unbind;
43
44 __entry->b_vendor_code = gi->cdev.b_vendor_code;
45 __entry->suspended = gi->cdev.suspended;
46 __entry->setup_pending = gi->cdev.setup_pending;
47 __entry->os_desc_pending = gi->cdev.os_desc_pending;
48 __entry->deactivations = gi->cdev.deactivations;
49 __entry->delayed_status = gi->cdev.delayed_status;
50 __entry->bcdUSB = gi->cdev.desc.bcdUSB;
51 __entry->bcdDevice = gi->cdev.desc.bcdDevice;
52 __assign_str(config, config_to_string(gi));
53
54 __entry->max_speed = gi->composite.max_speed;
55 __entry->needs_serial = gi->composite.needs_serial;
56
57 __assign_str(udc_name, gi->composite.gadget_driver.udc_name);
58 ),
59 TP_printk("gi_group:%s,unbind:%d,"
60 " - "
61 "b_vendor_code:%d,suspended:%d,setup_pending:%d,"
62 "os_desc_pending:%d,deactivations:%d,delayed_status:%d,"
63 "bcdUSB:%04x,bcdDevice:%04x,config:%s,"
64 " - "
65 "max_speed:%d,needs_serial:%d,"
66 " - "
67 "udc_name:%s",
68
69 __get_str(gi_group),
70 __entry->unbind,
71
72 __entry->b_vendor_code,
73 __entry->suspended,
74 __entry->setup_pending,
75 __entry->os_desc_pending,
76 __entry->deactivations,
77 __entry->delayed_status,
78 le16_to_cpu(__entry->bcdUSB),
79 le16_to_cpu(__entry->bcdDevice),
80 __get_str(config),
81
82 __entry->max_speed,
83 __entry->needs_serial,
84
85 __get_str(udc_name)
86 )
87 );
88
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 42625 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 5/5] usb: gadget: configfs: add some trace event
@ 2021-09-02 19:27 ` kernel test robot
0 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2021-09-02 19:27 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 5426 bytes --]
Hi Linyu,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on usb/usb-testing]
[also build test WARNING on peter.chen-usb/for-usb-next next-20210902]
[cannot apply to balbi-usb/testing/next v5.14]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Linyu-Yuan/usb-gadget-configfs-add-some-trace-event/20210902-211519
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: x86_64-randconfig-s021-20210902 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-rc1-dirty
# https://github.com/0day-ci/linux/commit/f173b8a0bbf4b051a79b533539e4469cfe050fc1
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Linyu-Yuan/usb-gadget-configfs-add-some-trace-event/20210902-211519
git checkout f173b8a0bbf4b051a79b533539e4469cfe050fc1
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/usb/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
sparse warnings: (new ones prefixed by >>)
drivers/usb/gadget/configfs_trace.c: note: in included file (through include/trace/trace_events.h, include/trace/define_trace.h, drivers/usb/gadget/configfs_trace.h):
>> include/trace/../../drivers/usb/gadget/configfs_trace.h:14:1: sparse: sparse: cast to restricted __le16
>> include/trace/../../drivers/usb/gadget/configfs_trace.h:14:1: sparse: sparse: cast to restricted __le16
>> include/trace/../../drivers/usb/gadget/configfs_trace.h:14:1: sparse: sparse: restricted __le16 degrades to integer
>> include/trace/../../drivers/usb/gadget/configfs_trace.h:14:1: sparse: sparse: restricted __le16 degrades to integer
>> include/trace/../../drivers/usb/gadget/configfs_trace.h:14:1: sparse: sparse: cast to restricted __le16
>> include/trace/../../drivers/usb/gadget/configfs_trace.h:14:1: sparse: sparse: cast to restricted __le16
>> include/trace/../../drivers/usb/gadget/configfs_trace.h:14:1: sparse: sparse: restricted __le16 degrades to integer
>> include/trace/../../drivers/usb/gadget/configfs_trace.h:14:1: sparse: sparse: restricted __le16 degrades to integer
vim +14 include/trace/../../drivers/usb/gadget/configfs_trace.h
13
> 14 DECLARE_EVENT_CLASS(log_gadget_info,
15 TP_PROTO(struct gadget_info *gi),
16 TP_ARGS(gi),
17 TP_STRUCT__entry(
18 /* gadget_info */
19 __string(gi_group, config_item_name(&gi->group.cg_item))
20 __field(bool, unbind)
21
22 /* usb_composite_dev */
23 __field(u8, b_vendor_code)
24 __field(bool, suspended)
25 __field(bool, setup_pending)
26 __field(bool, os_desc_pending)
27 __field(unsigned, deactivations)
28 __field(int, delayed_status)
29 __field(__le16, bcdUSB)
30 __field(__le16, bcdDevice)
31 __string(config, gi->cdev.config)
32
33 /* usb_composite_driver */
34 __field(unsigned, max_speed)
35 __field(bool, needs_serial)
36
37 /* usb_gadget_driver */
38 __string(udc_name, gi->composite.gadget_driver.udc_name)
39 ),
40 TP_fast_assign(
41 __assign_str(gi_group, config_item_name(&gi->group.cg_item));
42 __entry->unbind = gi->unbind;
43
44 __entry->b_vendor_code = gi->cdev.b_vendor_code;
45 __entry->suspended = gi->cdev.suspended;
46 __entry->setup_pending = gi->cdev.setup_pending;
47 __entry->os_desc_pending = gi->cdev.os_desc_pending;
48 __entry->deactivations = gi->cdev.deactivations;
49 __entry->delayed_status = gi->cdev.delayed_status;
50 __entry->bcdUSB = gi->cdev.desc.bcdUSB;
51 __entry->bcdDevice = gi->cdev.desc.bcdDevice;
52 __assign_str(config, config_to_string(gi));
53
54 __entry->max_speed = gi->composite.max_speed;
55 __entry->needs_serial = gi->composite.needs_serial;
56
57 __assign_str(udc_name, gi->composite.gadget_driver.udc_name);
58 ),
59 TP_printk("gi_group:%s,unbind:%d,"
60 " - "
61 "b_vendor_code:%d,suspended:%d,setup_pending:%d,"
62 "os_desc_pending:%d,deactivations:%d,delayed_status:%d,"
63 "bcdUSB:%04x,bcdDevice:%04x,config:%s,"
64 " - "
65 "max_speed:%d,needs_serial:%d,"
66 " - "
67 "udc_name:%s",
68
69 __get_str(gi_group),
70 __entry->unbind,
71
72 __entry->b_vendor_code,
73 __entry->suspended,
74 __entry->setup_pending,
75 __entry->os_desc_pending,
76 __entry->deactivations,
77 __entry->delayed_status,
78 le16_to_cpu(__entry->bcdUSB),
79 le16_to_cpu(__entry->bcdDevice),
80 __get_str(config),
81
82 __entry->max_speed,
83 __entry->needs_serial,
84
85 __get_str(udc_name)
86 )
87 );
88
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 42625 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2021-09-02 19:28 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-02 13:12 [PATCH 0/5] usb: gadget: configfs: add some trace event Linyu Yuan
2021-09-02 13:12 ` [PATCH 1/5] usb: gadget: configfs: expose some struct from configfs.c Linyu Yuan
2021-09-02 13:12 ` [PATCH 2/5] usb: gadget: configfs: change OS attributes operation Linyu Yuan
2021-09-02 13:12 ` [PATCH 3/5] usb: gadget: configfs: avoid list move operation of usb_function Linyu Yuan
2021-09-02 15:00 ` kernel test robot
2021-09-02 15:00 ` kernel test robot
2021-09-02 13:12 ` [PATCH 4/5] usb: gadget: configfs: add gadget_info for config group Linyu Yuan
2021-09-02 13:12 ` [PATCH 5/5] usb: gadget: configfs: add some trace event Linyu Yuan
2021-09-02 19:27 ` kernel test robot
2021-09-02 19:27 ` kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.