Message ID | 20180620110105.19955-23-bigeasy@linutronix.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
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
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
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;
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(-)