diff mbox

[2/8,media] au0828: Improve debug messages for urb_completion

Message ID 1400696402-1805-3-git-send-email-m.chehab@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mauro Carvalho Chehab May 21, 2014, 6:19 p.m. UTC
Sometimes, it helps to know how much data was received by
urb_completion. Add that information to the optional debug
log.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
---
 drivers/media/usb/au0828/au0828-dvb.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Comments

Ricardo Ribalda Delgado May 22, 2014, 8:36 a.m. UTC | #1
Hello Mauro

Are you aware that using dynamic printk you can decide to print
__func__ on demand?

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/dynamic-debug-howto.txt#n213


Perhaps it is better to not add __func__

Regards!

On Wed, May 21, 2014 at 8:19 PM, Mauro Carvalho Chehab
<m.chehab@samsung.com> wrote:
> Sometimes, it helps to know how much data was received by
> urb_completion. Add that information to the optional debug
> log.
>
> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
> ---
>  drivers/media/usb/au0828/au0828-dvb.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/media/usb/au0828/au0828-dvb.c b/drivers/media/usb/au0828/au0828-dvb.c
> index 2019e4a168b2..ab5f93643021 100755
> --- a/drivers/media/usb/au0828/au0828-dvb.c
> +++ b/drivers/media/usb/au0828/au0828-dvb.c
> @@ -114,16 +114,20 @@ static void urb_completion(struct urb *purb)
>         int ptype = usb_pipetype(purb->pipe);
>         unsigned char *ptr;
>
> -       dprintk(2, "%s()\n", __func__);
> +       dprintk(2, "%s: %d\n", __func__, purb->actual_length);
>
> -       if (!dev)
> +       if (!dev) {
> +               dprintk(2, "%s: no dev!\n", __func__);
>                 return;
> +       }
>
> -       if (dev->urb_streaming == 0)
> +       if (dev->urb_streaming == 0) {
> +               dprintk(2, "%s: not streaming!\n", __func__);
>                 return;
> +       }
>
>         if (ptype != PIPE_BULK) {
> -               printk(KERN_ERR "%s() Unsupported URB type %d\n",
> +               printk(KERN_ERR "%s: Unsupported URB type %d\n",
>                        __func__, ptype);
>                 return;
>         }
> --
> 1.9.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mauro Carvalho Chehab May 22, 2014, 10:15 a.m. UTC | #2
Em Thu, 22 May 2014 10:36:24 +0200
Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> escreveu:

> Hello Mauro
> 
> Are you aware that using dynamic printk you can decide to print
> __func__ on demand?
> 
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/dynamic-debug-howto.txt#n213

Yes, I'm aware.

Yet, but changing the driver to use the dynamic printk's should
be done on a separate patch that would convert all printks to use the
dev_* printk macros. 

The goal of this specific patch is just to make the already existing
debug macros more useful, allowing to see when the DMA stuck, like:

[  248.733896] au0828/0: urb_completion: 0
[  248.733900] au0828/0: urb_completion: not streaming!
[  248.733998] au0828/0: urb_completion: 0
[  248.734005] au0828/0: urb_completion: not streaming!
[  248.734042] au0828/0: urb_completion: 0
[  248.734045] au0828/0: urb_completion: not streaming!
[  248.734097] au0828/0: urb_completion: 1536
[  248.734101] au0828/0: urb_completion: not streaming!
[  248.734164] au0828/0: urb_completion: 2048
[  248.734168] au0828/0: urb_completion: not streaming!
[  248.734200] au0828/0: urb_completion: 514
[  248.734204] au0828/0: urb_completion: not streaming!
...
> 
> 
> Perhaps it is better to not add __func__
> 
> Regards!
> 
> On Wed, May 21, 2014 at 8:19 PM, Mauro Carvalho Chehab
> <m.chehab@samsung.com> wrote:
> > Sometimes, it helps to know how much data was received by
> > urb_completion. Add that information to the optional debug
> > log.
> >
> > Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
> > ---
> >  drivers/media/usb/au0828/au0828-dvb.c | 12 ++++++++----
> >  1 file changed, 8 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/media/usb/au0828/au0828-dvb.c b/drivers/media/usb/au0828/au0828-dvb.c
> > index 2019e4a168b2..ab5f93643021 100755
> > --- a/drivers/media/usb/au0828/au0828-dvb.c
> > +++ b/drivers/media/usb/au0828/au0828-dvb.c
> > @@ -114,16 +114,20 @@ static void urb_completion(struct urb *purb)
> >         int ptype = usb_pipetype(purb->pipe);
> >         unsigned char *ptr;
> >
> > -       dprintk(2, "%s()\n", __func__);
> > +       dprintk(2, "%s: %d\n", __func__, purb->actual_length);
> >
> > -       if (!dev)
> > +       if (!dev) {
> > +               dprintk(2, "%s: no dev!\n", __func__);
> >                 return;
> > +       }
> >
> > -       if (dev->urb_streaming == 0)
> > +       if (dev->urb_streaming == 0) {
> > +               dprintk(2, "%s: not streaming!\n", __func__);
> >                 return;
> > +       }
> >
> >         if (ptype != PIPE_BULK) {
> > -               printk(KERN_ERR "%s() Unsupported URB type %d\n",
> > +               printk(KERN_ERR "%s: Unsupported URB type %d\n",
> >                        __func__, ptype);
> >                 return;
> >         }
> > --
> > 1.9.0
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-media" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/media/usb/au0828/au0828-dvb.c b/drivers/media/usb/au0828/au0828-dvb.c
index 2019e4a168b2..ab5f93643021 100755
--- a/drivers/media/usb/au0828/au0828-dvb.c
+++ b/drivers/media/usb/au0828/au0828-dvb.c
@@ -114,16 +114,20 @@  static void urb_completion(struct urb *purb)
 	int ptype = usb_pipetype(purb->pipe);
 	unsigned char *ptr;
 
-	dprintk(2, "%s()\n", __func__);
+	dprintk(2, "%s: %d\n", __func__, purb->actual_length);
 
-	if (!dev)
+	if (!dev) {
+		dprintk(2, "%s: no dev!\n", __func__);
 		return;
+	}
 
-	if (dev->urb_streaming == 0)
+	if (dev->urb_streaming == 0) {
+		dprintk(2, "%s: not streaming!\n", __func__);
 		return;
+	}
 
 	if (ptype != PIPE_BULK) {
-		printk(KERN_ERR "%s() Unsupported URB type %d\n",
+		printk(KERN_ERR "%s: Unsupported URB type %d\n",
 		       __func__, ptype);
 		return;
 	}