From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: linux-media@vger.kernel.org
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
linux-usb@vger.kernel.org, tglx@linutronix.de,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Subject: [27/27] media: uvcvideo: use usb_fill_int_urb()
Date: Wed, 20 Jun 2018 13:01:05 +0200 [thread overview]
Message-ID: <20180620110105.19955-28-bigeasy@linutronix.de> (raw)
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.
usb_fill_int_urb() also checks bInterval to be in the 1…16 range on
HS/SS.
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
drivers/media/usb/uvc/uvc_video.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
index a88b2e51a666..79e7a827ed44 100644
--- a/drivers/media/usb/uvc/uvc_video.c
+++ b/drivers/media/usb/uvc/uvc_video.c
@@ -1619,21 +1619,19 @@ static int uvc_init_video_isoc(struct uvc_streaming *stream,
return -ENOMEM;
}
- urb->dev = stream->dev->udev;
- urb->context = stream;
- urb->pipe = usb_rcvisocpipe(stream->dev->udev,
- ep->desc.bEndpointAddress);
+ usb_fill_int_urb(urb, stream->dev->udev,
+ usb_rcvisocpipe(stream->dev->udev,
+ ep->desc.bEndpointAddress),
+ stream->urb_buffer[i], size,
+ uvc_video_complete, stream,
+ ep->desc.bInterval);
#ifndef CONFIG_DMA_NONCOHERENT
urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP;
urb->transfer_dma = stream->urb_dma[i];
#else
urb->transfer_flags = URB_ISO_ASAP;
#endif
- urb->interval = ep->desc.bInterval;
- urb->transfer_buffer = stream->urb_buffer[i];
- urb->complete = uvc_video_complete;
urb->number_of_packets = npackets;
- urb->transfer_buffer_length = size;
for (j = 0; j < npackets; ++j) {
urb->iso_frame_desc[j].offset = j * psize;
next reply other threads:[~2018-06-20 11:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-20 11:01 Sebastian Andrzej Siewior [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-06-20 11:55 [27/27] media: uvcvideo: use usb_fill_int_urb() Laurent Pinchart
2018-06-20 13:21 Sebastian Andrzej Siewior
2018-06-20 14:14 Laurent Pinchart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180620110105.19955-28-bigeasy@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).