From: Felipe Balbi <balbi@kernel.org>
To: Linyu Yuan <quic_linyyuan@quicinc.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org
Subject: Re: [PATCH V4 1/3] usb: gadget: configfs: add UDC trace entry
Date: Tue, 24 Aug 2021 11:15:34 +0300 [thread overview]
Message-ID: <8735qz8deg.fsf@kernel.org> (raw)
In-Reply-To: <1629777281-30188-2-git-send-email-quic_linyyuan@quicinc.com>
Hi,
Linyu Yuan <quic_linyyuan@quicinc.com> writes:
> add trace in function gadget_dev_desc_UDC_store()
> will show when user space enable/disable the gadget.
>
> Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com>
> ---
> drivers/usb/gadget/Makefile | 1 +
> drivers/usb/gadget/configfs.c | 3 +++
> drivers/usb/gadget/configfs_trace.c | 7 +++++++
> drivers/usb/gadget/configfs_trace.h | 39 +++++++++++++++++++++++++++++++++++++
> 4 files changed, 50 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 477e72a..f7f3af8 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)
> @@ -270,6 +271,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(config_item_name(item), name);
why tracing only the names? This gives us no insight into whatever bug
may happen and we may want to use trace events to debug. Rather, try to
think of trace events as tracking the lifetime of the UDC and
gadget. Trace values that may change over time.
I also think that all three patches could be combined into a single
commit, but that's up to discussion.
--
balbi
next prev parent reply other threads:[~2021-08-24 8:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-24 3:54 [PATCH V4 0/3] usb: gadget: configfs: add three trace entries Linyu Yuan
2021-08-24 3:54 ` [PATCH V4 1/3] usb: gadget: configfs: add UDC trace entry Linyu Yuan
2021-08-24 8:15 ` Felipe Balbi [this message]
2021-08-24 8:29 ` Felipe Balbi
2021-08-24 10:07 ` Linyu Yuan (QUIC)
2021-08-24 10:41 ` Felipe Balbi
2021-08-25 9:37 ` Linyu Yuan (QUIC)
2021-08-25 10:50 ` Felipe Balbi
2021-08-24 3:54 ` [PATCH V4 2/3] usb: gadget: configfs: add function link " Linyu Yuan
2021-08-24 3:54 ` [PATCH V4 3/3] usb: gadget: configfs: add function unlink " Linyu Yuan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8735qz8deg.fsf@kernel.org \
--to=balbi@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-usb@vger.kernel.org \
--cc=quic_linyyuan@quicinc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).