linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [22/27] media: ttusbir: use usb_fill_int_urb()
@ 2018-06-20 11:01 Sebastian Andrzej Siewior
  0 siblings, 0 replies; 3+ messages in thread
From: Sebastian Andrzej Siewior @ 2018-06-20 11:01 UTC (permalink / raw)
  To: linux-media
  Cc: Mauro Carvalho Chehab, linux-usb, tglx, Sebastian Andrzej Siewior,
	Sean Young

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.

Cc: Sean Young <sean@mess.org>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/media/rc/ttusbir.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/media/rc/ttusbir.c b/drivers/media/rc/ttusbir.c
index aafea3c5170b..6a7c9b50ff5a 100644
--- a/drivers/media/rc/ttusbir.c
+++ b/drivers/media/rc/ttusbir.c
@@ -257,10 +257,6 @@ static int ttusbir_probe(struct usb_interface *intf,
 			goto out;
 		}
 
-		urb->dev = tt->udev;
-		urb->context = tt;
-		urb->pipe = usb_rcvisocpipe(tt->udev, tt->iso_in_endp);
-		urb->interval = 1;
 		buffer = usb_alloc_coherent(tt->udev, 128, GFP_KERNEL,
 						&urb->transfer_dma);
 		if (!buffer) {
@@ -268,11 +264,11 @@ static int ttusbir_probe(struct usb_interface *intf,
 			ret = -ENOMEM;
 			goto out;
 		}
+		usb_fill_int_urb(urb, tt->udev,
+				 usb_rcvisocpipe(tt->udev, tt->iso_in_endp),
+				 buffer, 128, ttusbir_urb_complete, tt, 1);
 		urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP | URB_ISO_ASAP;
-		urb->transfer_buffer = buffer;
-		urb->complete = ttusbir_urb_complete;
 		urb->number_of_packets = 8;
-		urb->transfer_buffer_length = 128;
 
 		for (j = 0; j < 8; j++) {
 			urb->iso_frame_desc[j].offset = j * 16;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [22/27] media: ttusbir: use usb_fill_int_urb()
@ 2018-06-20 20:50 Sean Young
  0 siblings, 0 replies; 3+ messages in thread
From: Sean Young @ 2018-06-20 20:50 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: linux-media, Mauro Carvalho Chehab, linux-usb, tglx

On Wed, Jun 20, 2018 at 01:01:00PM +0200, 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.

The reason I didn't use usb_fill_int_urb() is that is not an interrupt
urb, it's a iso urb. I'm not sure what affect the interval handling
in usb_fill_int_urb() will have on this.


Sean

> 
> Cc: Sean Young <sean@mess.org>
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
>  drivers/media/rc/ttusbir.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/media/rc/ttusbir.c b/drivers/media/rc/ttusbir.c
> index aafea3c5170b..6a7c9b50ff5a 100644
> --- a/drivers/media/rc/ttusbir.c
> +++ b/drivers/media/rc/ttusbir.c
> @@ -257,10 +257,6 @@ static int ttusbir_probe(struct usb_interface *intf,
>  			goto out;
>  		}
>  
> -		urb->dev = tt->udev;
> -		urb->context = tt;
> -		urb->pipe = usb_rcvisocpipe(tt->udev, tt->iso_in_endp);
> -		urb->interval = 1;
>  		buffer = usb_alloc_coherent(tt->udev, 128, GFP_KERNEL,
>  						&urb->transfer_dma);
>  		if (!buffer) {
> @@ -268,11 +264,11 @@ static int ttusbir_probe(struct usb_interface *intf,
>  			ret = -ENOMEM;
>  			goto out;
>  		}
> +		usb_fill_int_urb(urb, tt->udev,
> +				 usb_rcvisocpipe(tt->udev, tt->iso_in_endp),
> +				 buffer, 128, ttusbir_urb_complete, tt, 1);
>  		urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP | URB_ISO_ASAP;
> -		urb->transfer_buffer = buffer;
> -		urb->complete = ttusbir_urb_complete;
>  		urb->number_of_packets = 8;
> -		urb->transfer_buffer_length = 128;
>  
>  		for (j = 0; j < 8; j++) {
>  			urb->iso_frame_desc[j].offset = j * 16;
> -- 
> 2.17.1
---
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [22/27] media: ttusbir: use usb_fill_int_urb()
@ 2018-06-21  7:37 Sebastian Andrzej Siewior
  0 siblings, 0 replies; 3+ messages in thread
From: Sebastian Andrzej Siewior @ 2018-06-21  7:37 UTC (permalink / raw)
  To: Sean Young, Mauro Carvalho Chehab; +Cc: linux-media, linux-usb, tglx

On 2018-06-20 21:50:49 [+0100], Sean Young wrote:
> On Wed, Jun 20, 2018 at 01:01:00PM +0200, 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.
> 
> The reason I didn't use usb_fill_int_urb() is that is not an interrupt
> urb, it's a iso urb. I'm not sure what affect the interval handling
> in usb_fill_int_urb() will have on this.

It is wrong, I had false memory on regarding ISO/FS. There will be a
respin a of the usb_fill* patches once we have usb_fill_iso_urb().

Mauro, could you please consider only the !fill patches from the series:
  [PATCH 04/27] media: cx231xx: use irqsave() in USB's complete callback
  [PATCH 07/27] media: em28xx-audio: use GFP_KERNEL for memory allocation during init
  [PATCH 08/27] media: em28xx-audio: use irqsave() in USB's complete callback
  [PATCH 10/27] media: go7007: use irqsave() in USB's complete callback
  [PATCH 14/27] media: gspca: sq930x: use GFP_KERNEL in sd_dq_callback()
  [PATCH 19/27] media: tm6000: use irqsave() in USB's complete callback
  [PATCH 23/27] media: usbtv: use irqsave() in USB's complete callback
  [PATCH 25/27] media: usbvision: remove time_in_irq

> Sean

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-06-21  7:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-20 11:01 [22/27] media: ttusbir: use usb_fill_int_urb() Sebastian Andrzej Siewior
  -- strict thread matches above, loose matches on Subject: below --
2018-06-20 20:50 Sean Young
2018-06-21  7:37 Sebastian Andrzej Siewior

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).