All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: linux-media@vger.kernel.org,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-usb@vger.kernel.org, tglx@linutronix.de
Subject: Re: [PATCH 27/27] media: uvcvideo: use usb_fill_int_urb()
Date: Wed, 20 Jun 2018 15:21:44 +0200	[thread overview]
Message-ID: <20180620132144.5cdu2ydlqre4ijg6@linutronix.de> (raw)
In-Reply-To: <3925059.Md1u3KRT1n@avalon>

On 2018-06-20 14:55:23 [+0300], Laurent Pinchart wrote:
> Hi Sebastian,
Hi Laurent,

> Thank you for the patch.
> 
> On Wednesday, 20 June 2018 14:01:05 EEST Sebastian Andrzej Siewior wrote:
> > Using usb_fill_int_urb() helps to find code which initializes an
> > URB. A grep for members of the struct (like ->complete) reveal lots
> > of other things, too.
> > usb_fill_int_urb() also checks bInterval to be in the 1…16 range on
> > HS/SS.
> > 
> > Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> > ---
> >  drivers/media/usb/uvc/uvc_video.c | 14 ++++++--------
> >  1 file changed, 6 insertions(+), 8 deletions(-)
> > 
> > diff --git a/drivers/media/usb/uvc/uvc_video.c
> > b/drivers/media/usb/uvc/uvc_video.c index a88b2e51a666..79e7a827ed44 100644
> > --- a/drivers/media/usb/uvc/uvc_video.c
> > +++ b/drivers/media/usb/uvc/uvc_video.c
> > @@ -1619,21 +1619,19 @@ static int uvc_init_video_isoc(struct uvc_streaming
> > *stream, return -ENOMEM;
> >  		}
> > 
> > -		urb->dev = stream->dev->udev;
> > -		urb->context = stream;
> > -		urb->pipe = usb_rcvisocpipe(stream->dev->udev,
> > -				ep->desc.bEndpointAddress);
> > +		usb_fill_int_urb(urb, stream->dev->udev,
> > +				 usb_rcvisocpipe(stream->dev->udev,
> > +						 ep->desc.bEndpointAddress),
> > +				 stream->urb_buffer[i], size,
> > +				 uvc_video_complete, stream,
> > +				 ep->desc.bInterval);
> 
> You're filling an isoc URB with usb_fill_int_urb(), which is explicitly 
> documented as usable to fill an interrupt URB. Shouldn't we create a 
> usb_fill_isoc_urb() function ? It could just be an alias for 
> usb_fill_int_urb() if isoc and interrupt URBs don't need to be treated 
> differently. Alternatively, I'd be fine using usb_fill_int_urb() if the 
> function documentation's was updated to mention isoc URBs as well.

I thought I read it there but I couldn't find it. And then I found it in
Documentation/driver-api/usb/URB.rst:
| you specify. You can use the :c:func:`usb_fill_int_urb` macro to fill
| most ISO transfer fields.

So you simply asking that the kerneldoc of usb_fill_int_urb() is
extended to mention isoc, too?

> >  #ifndef CONFIG_DMA_NONCOHERENT
> >  		urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP;
> >  		urb->transfer_dma = stream->urb_dma[i];
> >  #else
> >  		urb->transfer_flags = URB_ISO_ASAP;
> >  #endif
> > -		urb->interval = ep->desc.bInterval;
> 
> Unless I'm mistaken this introduces a change in behaviour for HS and SS, and 
> should thus be documented in the commit message. 
I did:

| usb_fill_int_urb() also checks bInterval to be in the 1…16 range on
| HS/SS.

so this wasn't enough?

> I suspect that this is the 
> real reason for this patch. I'd thus update the subject line to describe this 
> fix, and the body of the message to explain why using usb_fill_int_urb() is 
> the proper fix.

Actually no. I was looking for all the ->complete handlers and most of
them used usb_fill_… except a few. And while moving to the function I
was checking if everything stays the same (and mentioned ->interval
since ->start_frame is documented as a return parameter).

So here you are asking for a description update which explicit says
bug-fix?

> > -		urb->transfer_buffer = stream->urb_buffer[i];
> > -		urb->complete = uvc_video_complete;
> >  		urb->number_of_packets = npackets;
> > -		urb->transfer_buffer_length = size;
> 
> usb_fill_int_urb() sets urb->start_frame to -1. Does that impact us in any way 
> ?

It should not. The documentation says:
|  * @start_frame: Returns the initial frame for isochronous transfers.

> >  		for (j = 0; j < npackets; ++j) {
> >  			urb->iso_frame_desc[j].offset = j * psize;

Sebastian

WARNING: multiple messages have this Message-ID (diff)
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: linux-media@vger.kernel.org,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-usb@vger.kernel.org, tglx@linutronix.de
Subject: [27/27] media: uvcvideo: use usb_fill_int_urb()
Date: Wed, 20 Jun 2018 15:21:44 +0200	[thread overview]
Message-ID: <20180620132144.5cdu2ydlqre4ijg6@linutronix.de> (raw)

On 2018-06-20 14:55:23 [+0300], Laurent Pinchart wrote:
> Hi Sebastian,
Hi Laurent,

> Thank you for the patch.
> 
> On Wednesday, 20 June 2018 14:01:05 EEST Sebastian Andrzej Siewior wrote:
> > Using usb_fill_int_urb() helps to find code which initializes an
> > URB. A grep for members of the struct (like ->complete) reveal lots
> > of other things, too.
> > usb_fill_int_urb() also checks bInterval to be in the 1…16 range on
> > HS/SS.
> > 
> > Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> > ---
> >  drivers/media/usb/uvc/uvc_video.c | 14 ++++++--------
> >  1 file changed, 6 insertions(+), 8 deletions(-)
> > 
> > diff --git a/drivers/media/usb/uvc/uvc_video.c
> > b/drivers/media/usb/uvc/uvc_video.c index a88b2e51a666..79e7a827ed44 100644
> > --- a/drivers/media/usb/uvc/uvc_video.c
> > +++ b/drivers/media/usb/uvc/uvc_video.c
> > @@ -1619,21 +1619,19 @@ static int uvc_init_video_isoc(struct uvc_streaming
> > *stream, return -ENOMEM;
> >  		}
> > 
> > -		urb->dev = stream->dev->udev;
> > -		urb->context = stream;
> > -		urb->pipe = usb_rcvisocpipe(stream->dev->udev,
> > -				ep->desc.bEndpointAddress);
> > +		usb_fill_int_urb(urb, stream->dev->udev,
> > +				 usb_rcvisocpipe(stream->dev->udev,
> > +						 ep->desc.bEndpointAddress),
> > +				 stream->urb_buffer[i], size,
> > +				 uvc_video_complete, stream,
> > +				 ep->desc.bInterval);
> 
> You're filling an isoc URB with usb_fill_int_urb(), which is explicitly 
> documented as usable to fill an interrupt URB. Shouldn't we create a 
> usb_fill_isoc_urb() function ? It could just be an alias for 
> usb_fill_int_urb() if isoc and interrupt URBs don't need to be treated 
> differently. Alternatively, I'd be fine using usb_fill_int_urb() if the 
> function documentation's was updated to mention isoc URBs as well.

I thought I read it there but I couldn't find it. And then I found it in
Documentation/driver-api/usb/URB.rst:
| you specify. You can use the :c:func:`usb_fill_int_urb` macro to fill
| most ISO transfer fields.

So you simply asking that the kerneldoc of usb_fill_int_urb() is
extended to mention isoc, too?

> >  #ifndef CONFIG_DMA_NONCOHERENT
> >  		urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP;
> >  		urb->transfer_dma = stream->urb_dma[i];
> >  #else
> >  		urb->transfer_flags = URB_ISO_ASAP;
> >  #endif
> > -		urb->interval = ep->desc.bInterval;
> 
> Unless I'm mistaken this introduces a change in behaviour for HS and SS, and 
> should thus be documented in the commit message. 
I did:

| usb_fill_int_urb() also checks bInterval to be in the 1…16 range on
| HS/SS.

so this wasn't enough?

> I suspect that this is the 
> real reason for this patch. I'd thus update the subject line to describe this 
> fix, and the body of the message to explain why using usb_fill_int_urb() is 
> the proper fix.

Actually no. I was looking for all the ->complete handlers and most of
them used usb_fill_… except a few. And while moving to the function I
was checking if everything stays the same (and mentioned ->interval
since ->start_frame is documented as a return parameter).

So here you are asking for a description update which explicit says
bug-fix?

> > -		urb->transfer_buffer = stream->urb_buffer[i];
> > -		urb->complete = uvc_video_complete;
> >  		urb->number_of_packets = npackets;
> > -		urb->transfer_buffer_length = size;
> 
> usb_fill_int_urb() sets urb->start_frame to -1. Does that impact us in any way 
> ?

It should not. The documentation says:
|  * @start_frame: Returns the initial frame for isochronous transfers.

> >  		for (j = 0; j < npackets; ++j) {
> >  			urb->iso_frame_desc[j].offset = j * psize;

Sebastian
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2018-06-20 13:21 UTC|newest]

Thread overview: 100+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-20 11:00 medial: use irqsave() in URB completion + usb_fill_int_urb Sebastian Andrzej Siewior
2018-06-20 11:00 ` [PATCH 01/27] media: b2c2: use usb_fill_int_urb() Sebastian Andrzej Siewior
2018-06-20 11:00   ` [01/27] " Sebastian Andrzej Siewior
2018-06-20 11:00 ` [PATCH 02/27] media: cpia2_usb: " Sebastian Andrzej Siewior
2018-06-20 11:00   ` [02/27] " Sebastian Andrzej Siewior
2018-06-20 11:00 ` [PATCH 03/27] media: cx231xx: use usb_fill_XXX_urb() Sebastian Andrzej Siewior
2018-06-20 11:00   ` [03/27] " Sebastian Andrzej Siewior
2018-06-20 11:00 ` [PATCH 04/27] media: cx231xx: use irqsave() in USB's complete callback Sebastian Andrzej Siewior
2018-06-20 11:00   ` [04/27] " Sebastian Andrzej Siewior
2018-06-20 11:00 ` [PATCH 05/27] media: dvb-usb: use usb_fill_int_urb() Sebastian Andrzej Siewior
2018-06-20 11:00   ` [05/27] " Sebastian Andrzej Siewior
2018-06-20 11:00 ` [PATCH 06/27] media: dvb_usb_v2: " Sebastian Andrzej Siewior
2018-06-20 11:00   ` [06/27] " Sebastian Andrzej Siewior
2018-06-20 11:00 ` [PATCH 07/27] media: em28xx-audio: use GFP_KERNEL for memory allocation during init Sebastian Andrzej Siewior
2018-06-20 11:00   ` [07/27] " Sebastian Andrzej Siewior
2018-06-20 11:00 ` [PATCH 08/27] media: em28xx-audio: use irqsave() in USB's complete callback Sebastian Andrzej Siewior
2018-06-20 11:00   ` [08/27] " Sebastian Andrzej Siewior
2018-06-20 11:00 ` [PATCH 09/27] media: em28xx-audio: use usb_fill_int_urb() Sebastian Andrzej Siewior
2018-06-20 11:00   ` [09/27] " Sebastian Andrzej Siewior
2018-06-20 11:00 ` [PATCH 10/27] media: go7007: use irqsave() in USB's complete callback Sebastian Andrzej Siewior
2018-06-20 11:00   ` [10/27] " Sebastian Andrzej Siewior
2018-06-20 11:00 ` [PATCH 11/27] media: gspca: benq: use usb_fill_int_urb() Sebastian Andrzej Siewior
2018-06-20 11:00   ` [11/27] " Sebastian Andrzej Siewior
2018-06-20 11:00 ` [PATCH 12/27] media: gspca: gspca: use usb_fill_XXX_urb() Sebastian Andrzej Siewior
2018-06-20 11:00   ` [12/27] " Sebastian Andrzej Siewior
2018-06-20 11:00 ` [PATCH 13/27] media: gspca: konica: use usb_fill_int_urb() Sebastian Andrzej Siewior
2018-06-20 11:00   ` [13/27] " Sebastian Andrzej Siewior
2018-06-20 11:00 ` [PATCH 14/27] media: gspca: sq930x: use GFP_KERNEL in sd_dq_callback() Sebastian Andrzej Siewior
2018-06-20 11:00   ` [14/27] " Sebastian Andrzej Siewior
2018-06-20 11:00 ` [PATCH 15/27] media: msi2500: use usb_fill_int_urb() Sebastian Andrzej Siewior
2018-06-20 11:00   ` [15/27] " Sebastian Andrzej Siewior
2018-06-20 11:00 ` [PATCH 16/27] media: pwc: " Sebastian Andrzej Siewior
2018-06-20 11:00   ` [16/27] " Sebastian Andrzej Siewior
2018-06-20 11:00 ` [PATCH 17/27] media: stk1160: " Sebastian Andrzej Siewior
2018-06-20 11:00   ` [17/27] " Sebastian Andrzej Siewior
2018-06-20 11:00 ` [PATCH 18/27] media: stkwebcam: " Sebastian Andrzej Siewior
2018-06-20 11:00   ` [18/27] " Sebastian Andrzej Siewior
2018-06-20 11:00 ` [PATCH 19/27] media: tm6000: use irqsave() in USB's complete callback Sebastian Andrzej Siewior
2018-06-20 11:00   ` [19/27] " Sebastian Andrzej Siewior
2018-06-20 11:00 ` [PATCH 20/27] media: ttusb-budget: use usb_fill_int_urb() Sebastian Andrzej Siewior
2018-06-20 11:00   ` [20/27] " Sebastian Andrzej Siewior
2018-06-20 11:00 ` [PATCH 21/27] media: ttusb-dec: " Sebastian Andrzej Siewior
2018-06-20 11:00   ` [21/27] " Sebastian Andrzej Siewior
2018-06-20 11:01 ` [PATCH 22/27] media: ttusbir: " Sebastian Andrzej Siewior
2018-06-20 11:01   ` [22/27] " Sebastian Andrzej Siewior
2018-06-20 20:50   ` [PATCH 22/27] " Sean Young
2018-06-20 20:50     ` [22/27] " Sean Young
2018-06-21  7:37     ` [PATCH 22/27] " Sebastian Andrzej Siewior
2018-06-21  7:37       ` [22/27] " Sebastian Andrzej Siewior
2018-06-20 11:01 ` [PATCH 23/27] media: usbtv: use irqsave() in USB's complete callback Sebastian Andrzej Siewior
2018-06-20 11:01   ` [23/27] " Sebastian Andrzej Siewior
2018-06-20 11:01 ` [PATCH 24/27] media: usbtv: use usb_fill_int_urb() Sebastian Andrzej Siewior
2018-06-20 11:01   ` [24/27] " Sebastian Andrzej Siewior
2018-06-20 11:01 ` [PATCH 25/27] media: usbvision: remove time_in_irq Sebastian Andrzej Siewior
2018-06-20 11:01   ` [25/27] " Sebastian Andrzej Siewior
2018-06-20 11:01 ` [PATCH 26/27] media: usbvision: use usb_fill_int_urb() Sebastian Andrzej Siewior
2018-06-20 11:01   ` [26/27] " Sebastian Andrzej Siewior
2018-06-20 11:01 ` [PATCH 27/27] media: uvcvideo: " Sebastian Andrzej Siewior
2018-06-20 11:01   ` [27/27] " Sebastian Andrzej Siewior
2018-06-20 11:55   ` [PATCH 27/27] " Laurent Pinchart
2018-06-20 11:55     ` [27/27] " Laurent Pinchart
2018-06-20 13:21     ` Sebastian Andrzej Siewior [this message]
2018-06-20 13:21       ` Sebastian Andrzej Siewior
2018-06-20 14:14       ` [PATCH 27/27] " Laurent Pinchart
2018-06-20 14:14         ` [27/27] " Laurent Pinchart
2018-06-20 15:20         ` [PATCH] USB: note that usb_fill_int_urb() can be used used for ISOC urbs Sebastian Andrzej Siewior
2018-06-20 15:20           ` Sebastian Andrzej Siewior
2018-06-20 15:35           ` [PATCH] " Alan Stern
2018-06-20 15:35             ` Alan Stern
2018-06-20 16:02             ` [PATCH] " Sebastian Andrzej Siewior
2018-06-20 16:02               ` Sebastian Andrzej Siewior
2018-06-20 16:21               ` [PATCH] " Alan Stern
2018-06-20 16:21                 ` Alan Stern
2018-06-20 16:49                 ` [PATCH] " Sebastian Andrzej Siewior
2018-06-20 16:49                   ` Sebastian Andrzej Siewior
2018-06-20 17:23                   ` [PATCH] " Alan Stern
2018-06-20 17:23                     ` Alan Stern
2018-07-12 22:35                     ` [PATCH RFC] usb: add usb_fill_iso_urb() Sebastian Andrzej Siewior
2018-07-12 22:35                       ` [RFC] " Sebastian Andrzej Siewior
2018-07-13  7:29                       ` [PATCH RFC] " Greg Kroah-Hartman
2018-07-13  7:29                         ` [RFC] " Greg Kroah-Hartman
2018-07-13  7:47                         ` [PATCH RFC] " Sebastian Andrzej Siewior
2018-07-13  7:47                           ` [RFC] " Sebastian Andrzej Siewior
2018-07-16 22:53                           ` [PATCH RFC] " Sebastian Andrzej Siewior
2018-07-16 22:53                             ` [RFC] " Sebastian Andrzej Siewior
2018-07-17  6:54                             ` [PATCH RFC] " Clemens Ladisch
2018-07-17  6:54                               ` Clemens Ladisch
2018-07-17  6:54                               ` [RFC] " Clemens Ladisch
2018-08-06 21:21                             ` [PATCH RFC] " Laurent Pinchart
2018-08-06 21:21                               ` [RFC] " Laurent Pinchart
2018-08-06 22:02                               ` [PATCH RFC] " Sebastian Andrzej Siewior
2018-08-06 22:02                                 ` [RFC] " Sebastian Andrzej Siewior
2018-07-13  8:01                       ` [PATCH RFC] " Laurent Pinchart
2018-07-13  8:01                         ` [RFC] " Laurent Pinchart
2018-07-13 20:12                       ` [PATCH RFC] " Alan Stern
2018-07-13 20:12                         ` [RFC] " Alan Stern
2018-06-20 15:21         ` [PATCH 27/27 v2] media: uvcvideo: use usb_fill_int_urb() for the ->intarval value Sebastian Andrzej Siewior
2018-06-20 15:21           ` [27/27,v2] " Sebastian Andrzej Siewior
2018-06-20 15:40           ` [PATCH 27/27 v2] " Alan Stern
2018-06-20 15:40             ` [27/27,v2] " Alan Stern

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=20180620132144.5cdu2ydlqre4ijg6@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=tglx@linutronix.de \
    /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.