diff mbox

[11/27] media: gspca: benq: use usb_fill_int_urb()

Message ID 20180620110105.19955-12-bigeasy@linutronix.de (mailing list archive)
State New, archived
Headers show

Commit Message

Sebastian Andrzej Siewior June 20, 2018, 11 a.m. UTC
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: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/media/usb/gspca/benq.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)
diff mbox

Patch

diff --git a/drivers/media/usb/gspca/benq.c b/drivers/media/usb/gspca/benq.c
index 8a8db5eb6d5f..a59c92cb6a3b 100644
--- a/drivers/media/usb/gspca/benq.c
+++ b/drivers/media/usb/gspca/benq.c
@@ -90,28 +90,27 @@  static int sd_start(struct gspca_dev *gspca_dev)
 #define SD_PKT_SZ 64
 #define SD_NPKT 32
 	for (n = 0; n < 4; n++) {
+		void *buf;
+
 		urb = usb_alloc_urb(SD_NPKT, GFP_KERNEL);
 		if (!urb)
 			return -ENOMEM;
 		gspca_dev->urb[n] = urb;
-		urb->transfer_buffer = usb_alloc_coherent(gspca_dev->dev,
-						SD_PKT_SZ * SD_NPKT,
-						GFP_KERNEL,
-						&urb->transfer_dma);
+		buf = usb_alloc_coherent(gspca_dev->dev, SD_PKT_SZ * SD_NPKT,
+					 GFP_KERNEL, &urb->transfer_dma);
 
-		if (urb->transfer_buffer == NULL) {
+		if (buf == NULL) {
 			pr_err("usb_alloc_coherent failed\n");
 			return -ENOMEM;
 		}
-		urb->dev = gspca_dev->dev;
-		urb->context = gspca_dev;
-		urb->transfer_buffer_length = SD_PKT_SZ * SD_NPKT;
-		urb->pipe = usb_rcvisocpipe(gspca_dev->dev,
-					n & 1 ? 0x82 : 0x83);
+		usb_fill_int_urb(urb, gspca_dev->dev,
+				 usb_rcvisocpipe(gspca_dev->dev,
+						 n & 1 ? 0x82 : 0x83),
+				 buf, SD_PKT_SZ * SD_NPKT, sd_isoc_irq,
+				 gspca_dev, 1);
+
 		urb->transfer_flags = URB_ISO_ASAP
 					| URB_NO_TRANSFER_DMA_MAP;
-		urb->interval = 1;
-		urb->complete = sd_isoc_irq;
 		urb->number_of_packets = SD_NPKT;
 		for (i = 0; i < SD_NPKT; i++) {
 			urb->iso_frame_desc[i].length = SD_PKT_SZ;