From: Dan Vacura <w36195@motorola.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Felipe Balbi <balbi@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: gadget: uvc: allow for application to cleanly shutdown
Date: Tue, 3 May 2022 14:02:58 -0500 [thread overview]
Message-ID: <YnF8YmKqFm5oONkB@p1g3> (raw)
In-Reply-To: <Ym/En8EjfkpIVm+a@kroah.com>
Hi Greg,
Thanks for the feedback.
On Mon, May 02, 2022 at 01:46:39PM +0200, Greg Kroah-Hartman wrote:
> On Sun, May 01, 2022 at 11:11:36PM -0500, Dan Vacura wrote:
> > On Sat, Apr 30, 2022 at 09:56:50AM +0200, Greg Kroah-Hartman wrote:
> > > On Fri, Apr 29, 2022 at 02:20:01PM -0500, Dan Vacura wrote:
> > > > diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c
> > > > index 50e6e7a58b41..3cc8cf24a7c7 100644
> > > > --- a/drivers/usb/gadget/function/f_uvc.c
> > > > +++ b/drivers/usb/gadget/function/f_uvc.c
> > > > @@ -892,13 +892,36 @@ static void uvc_function_unbind(struct usb_configuration *c,
> > > > {
> > > > struct usb_composite_dev *cdev = c->cdev;
> > > > struct uvc_device *uvc = to_uvc(f);
> > > > + int wait_ret = 1;
> > > >
> > > > uvcg_info(f, "%s()\n", __func__);
> > >
> > > Ick, wait, is that in the kernel? That needs to be removed, ftrace can
> > > do that for you.
> >
> > Yes, part of the kernel, and tbh, I find it to be quite helpful in
> > debugging field issues from customers, where enabling ftrace isn't
> > practical.
>
> Why isn't ftrace ok to enable in a running kernel?
ftrace is totally fine to enable. I should've said convenient instead of
practical, from my experience there's a bit more offline/developer
overhead for setup and integrating the trace logs with a panic or kmsg,
then bundling that with the bug reports we get.
>
> Worst case, this should be dev_dbg(), right?
>
> > If you still want to remove, there are other locations in
> > this gadget driver that log function entry. Perhaps it'd be better to
> > do a separate change that cleans up logging a bit or do you prefer to
> > just refactor this one now?
>
> This commit is fine, it's a separate issue, I just noticed it as it was
> in the context of this change.
>
> > > > + /* If we know we're connected via v4l2, then there should be a cleanup
> > > > + * of the device from userspace either via UVC_EVENT_DISCONNECT or
> > > > + * though the video device removal uevent. Allow some time for the
> > > > + * application to close out before things get deleted.
> > > > + */
> > > > + if (uvc->func_connected) {
> > > > + uvcg_info(f, "%s waiting for clean disconnect\n", __func__);
> > > > + wait_ret = wait_event_interruptible_timeout(uvc->func_connected_queue,
> > > > + uvc->func_connected == false, msecs_to_jiffies(500));
> > > > + uvcg_info(f, "%s done waiting with ret: %u\n", __func__, wait_ret);
> > >
> > > Please remove debugging code before submitting patches.
> >
> > Will do.
>
> But this should be removed :)
>
> Feel free to change it to dev_dbg(), which gives you the __func__
> automatically without anything extra needed.
Yes, I'll go with this approach, as it doesn't make sense to always
print, but is good to have when developing or debugging. The timeouts
seem reasonable to me and work for our setup, but I was expecting some
comments about them or a suggestion for a different approach.
Thanks,
Dan
prev parent reply other threads:[~2022-05-03 19:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-29 19:20 [PATCH] usb: gadget: uvc: allow for application to cleanly shutdown Dan Vacura
2022-04-30 7:56 ` Greg Kroah-Hartman
2022-05-02 4:11 ` Dan Vacura
2022-05-02 11:46 ` Greg Kroah-Hartman
2022-05-03 19:02 ` Dan Vacura [this message]
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=YnF8YmKqFm5oONkB@p1g3 \
--to=w36195@motorola.com \
--cc=balbi@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/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