* [15/27] media: msi2500: use usb_fill_int_urb()
@ 2018-06-20 11:00 Sebastian Andrzej Siewior
0 siblings, 0 replies; only message in thread
From: Sebastian Andrzej Siewior @ 2018-06-20 11:00 UTC (permalink / raw)
To: linux-media
Cc: Mauro Carvalho Chehab, linux-usb, tglx, Sebastian Andrzej Siewior,
Antti Palosaari
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: Antti Palosaari <crope@iki.fi>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
drivers/media/usb/msi2500/msi2500.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/drivers/media/usb/msi2500/msi2500.c b/drivers/media/usb/msi2500/msi2500.c
index 65ef755adfdc..7ac6284248ce 100644
--- a/drivers/media/usb/msi2500/msi2500.c
+++ b/drivers/media/usb/msi2500/msi2500.c
@@ -507,6 +507,8 @@ static int msi2500_isoc_init(struct msi2500_dev *dev)
/* Allocate and init Isochronuous urbs */
for (i = 0; i < MAX_ISO_BUFS; i++) {
+ void *buf;
+
urb = usb_alloc_urb(ISO_FRAMES_PER_DESC, GFP_KERNEL);
if (urb == NULL) {
msi2500_isoc_cleanup(dev);
@@ -515,22 +517,19 @@ static int msi2500_isoc_init(struct msi2500_dev *dev)
dev->urbs[i] = urb;
dev_dbg(dev->dev, "Allocated URB at 0x%p\n", urb);
- urb->interval = 1;
- urb->dev = dev->udev;
- urb->pipe = usb_rcvisocpipe(dev->udev, 0x81);
- urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP;
- urb->transfer_buffer = usb_alloc_coherent(dev->udev,
- ISO_BUFFER_SIZE,
- GFP_KERNEL, &urb->transfer_dma);
- if (urb->transfer_buffer == NULL) {
+
+ buf = usb_alloc_coherent(dev->udev, ISO_BUFFER_SIZE, GFP_KERNEL,
+ &urb->transfer_dma);
+ if (buf == NULL) {
dev_err(dev->dev,
"Failed to allocate urb buffer %d\n", i);
msi2500_isoc_cleanup(dev);
return -ENOMEM;
}
- urb->transfer_buffer_length = ISO_BUFFER_SIZE;
- urb->complete = msi2500_isoc_handler;
- urb->context = dev;
+ usb_fill_int_urb(urb, dev->udev,
+ usb_rcvisocpipe(dev->udev, 0x81), buf,
+ ISO_BUFFER_SIZE, msi2500_isoc_handler, dev, 1);
+ urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP;
urb->start_frame = 0;
urb->number_of_packets = ISO_FRAMES_PER_DESC;
for (j = 0; j < ISO_FRAMES_PER_DESC; j++) {
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2018-06-20 11:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-20 11:00 [15/27] media: msi2500: use usb_fill_int_urb() 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).