From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Linyu Yuan <quic_linyyuan@quicinc.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH v2 3/3] usb: gadget: f_fs: add dev name as prefix for pr_vdebug()
Date: Mon, 27 Mar 2023 07:46:45 +0200 [thread overview]
Message-ID: <ZCEtxdztUHWMMQXg@kroah.com> (raw)
In-Reply-To: <951911a6-4ef7-00c8-a442-31336f472980@quicinc.com>
On Mon, Mar 27, 2023 at 09:54:11AM +0800, Linyu Yuan wrote:
>
> On 3/26/2023 2:29 PM, Greg Kroah-Hartman wrote:
> > On Sun, Mar 26, 2023 at 10:55:18AM +0800, Linyu Yuan wrote:
> > > On 3/25/2023 5:00 PM, Greg Kroah-Hartman wrote:
> > > > On Fri, Mar 24, 2023 at 02:10:27PM +0800, Linyu Yuan wrote:
> > > > > when multiple instances in use, the debug message is hard to understand
> > > > > as there is no instance name show.
> > > > >
> > > > > this change will show each instance name for debug messages.
> > > > >
> > > > > Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com>
> > > > > ---
> > > > > v2: split to several changes according to v1 comments
> > > > > v1: https://lore.kernel.org/linux-usb/1679481369-30094-1-git-send-email-quic_linyyuan@quicinc.com/
> > > > >
> > > > > drivers/usb/gadget/function/f_fs.c | 136 +++++++++++++++++++------------------
> > > > > 1 file changed, 69 insertions(+), 67 deletions(-)
> > > > >
> > > > > diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
> > > > > index a4051c8..df67ab5 100644
> > > > > --- a/drivers/usb/gadget/function/f_fs.c
> > > > > +++ b/drivers/usb/gadget/function/f_fs.c
> > > > > @@ -317,12 +317,12 @@ static int __ffs_ep0_queue_wait(struct ffs_data *ffs, char *data, size_t len)
> > > > > static int __ffs_ep0_stall(struct ffs_data *ffs)
> > > > > {
> > > > > if (ffs->ev.can_stall) {
> > > > > - pr_vdebug("ep0 stall\n");
> > > > > + pr_vdebug("%s: ep0 stall\n", ffs->dev_name);
> > > > Again, no, please use dev_dbg() instead. Do NOT roll your own debugging
> > > > macros. You have access to a struct device pointer for this device that
> > > > the driver is controlling, so please always use that instead.
> > >
> > > thanks for your suggestion, i didn't know dev_dbg can accept NULL dev
> > > pointer
> > >
> > > as this driver have no real struct device.
> > That is not true, you have access to a struct usb_gadget, which is a
> > struct device. Use that please.
>
> but this is not good, as for gadget/udc, from my view, there are two layer,
>
> one configfs driver, one lower UDC, only after bind, there will be a
> reference to usb_gadget.
>
> but configuration to driver can happen before bind, if so the usb_gadget
> will be NULL.
But is that where this debug message is being called? This is a
function while the driver is bound to a device, so you have a usb_gadget
pointer here.
If you have messages that could happen before the device is bound, sure,
don't use the device there.
thanks,
greg k-h
next prev parent reply other threads:[~2023-03-27 5:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-24 6:10 [PATCH v2 1/3] usb: gadget: f_fs: remove ENTER() macro Linyu Yuan
2023-03-24 6:10 ` [PATCH v2 2/3] usb: gadget: f_fs: add more function with struct ffs_data *ffs parameter Linyu Yuan
2023-03-25 9:01 ` Greg Kroah-Hartman
2023-03-24 6:10 ` [PATCH v2 3/3] usb: gadget: f_fs: add dev name as prefix for pr_vdebug() Linyu Yuan
2023-03-25 9:00 ` Greg Kroah-Hartman
2023-03-26 2:55 ` Linyu Yuan
2023-03-26 6:29 ` Greg Kroah-Hartman
2023-03-27 1:54 ` Linyu Yuan
2023-03-27 5:46 ` Greg Kroah-Hartman [this message]
2023-03-24 16:03 ` [PATCH v2 1/3] usb: gadget: f_fs: remove ENTER() macro kernel test robot
2023-03-24 16:03 ` kernel test robot
2023-03-25 9:02 ` Greg Kroah-Hartman
2023-03-26 2:48 ` 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=ZCEtxdztUHWMMQXg@kroah.com \
--to=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 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.