diff mbox

[03/27] media: cx231xx: use usb_fill_XXX_urb()

Message ID 20180620110105.19955-4-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_XXX_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: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/media/usb/cx231xx/cx231xx-audio.c | 30 ++++++++---------------
 1 file changed, 10 insertions(+), 20 deletions(-)
diff mbox

Patch

diff --git a/drivers/media/usb/cx231xx/cx231xx-audio.c b/drivers/media/usb/cx231xx/cx231xx-audio.c
index c4a84fb930b6..5d7a0c085902 100644
--- a/drivers/media/usb/cx231xx/cx231xx-audio.c
+++ b/drivers/media/usb/cx231xx/cx231xx-audio.c
@@ -281,6 +281,7 @@  static int cx231xx_init_audio_isoc(struct cx231xx *dev)
 	for (i = 0; i < CX231XX_AUDIO_BUFS; i++) {
 		struct urb *urb;
 		int j, k;
+		unsigned int pipe;
 
 		dev->adev.transfer_buffer[i] = kmalloc(sb_size, GFP_ATOMIC);
 		if (!dev->adev.transfer_buffer[i])
@@ -295,17 +296,12 @@  static int cx231xx_init_audio_isoc(struct cx231xx *dev)
 			}
 			return -ENOMEM;
 		}
-
-		urb->dev = dev->udev;
-		urb->context = dev;
-		urb->pipe = usb_rcvisocpipe(dev->udev,
-						dev->adev.end_point_addr);
+		pipe = usb_rcvisocpipe(dev->udev, dev->adev.end_point_addr);
+		usb_fill_int_urb(urb, dev->udev, pipe,
+				 dev->adev.transfer_buffer[i], sb_size,
+				 cx231xx_audio_isocirq, dev, 1);
 		urb->transfer_flags = URB_ISO_ASAP;
-		urb->transfer_buffer = dev->adev.transfer_buffer[i];
-		urb->interval = 1;
-		urb->complete = cx231xx_audio_isocirq;
 		urb->number_of_packets = CX231XX_ISO_NUM_AUDIO_PACKETS;
-		urb->transfer_buffer_length = sb_size;
 
 		for (j = k = 0; j < CX231XX_ISO_NUM_AUDIO_PACKETS;
 			j++, k += dev->adev.max_pkt_size) {
@@ -356,18 +352,12 @@  static int cx231xx_init_audio_bulk(struct cx231xx *dev)
 			}
 			return -ENOMEM;
 		}
-
-		urb->dev = dev->udev;
-		urb->context = dev;
-		urb->pipe = usb_rcvbulkpipe(dev->udev,
-						dev->adev.end_point_addr);
-		urb->transfer_flags = 0;
-		urb->transfer_buffer = dev->adev.transfer_buffer[i];
-		urb->complete = cx231xx_audio_bulkirq;
-		urb->transfer_buffer_length = sb_size;
-
+		usb_fill_bulk_urb(urb, dev->udev,
+				  usb_rcvbulkpipe(dev->udev,
+						  dev->adev.end_point_addr),
+				  dev->adev.transfer_buffer[i], sb_size,
+				  cx231xx_audio_bulkirq, dev);
 		dev->adev.urb[i] = urb;
-
 	}
 
 	for (i = 0; i < CX231XX_AUDIO_BUFS; i++) {