linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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>,
	Hans Verkuil <hans.verkuil@cisco.com>
Subject: [24/27] media: usbtv: use usb_fill_int_urb()
Date: Wed, 20 Jun 2018 13:01:02 +0200	[thread overview]
Message-ID: <20180620110105.19955-25-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.

Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/media/usb/usbtv/usbtv-video.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/media/usb/usbtv/usbtv-video.c b/drivers/media/usb/usbtv/usbtv-video.c
index 36a9a4017185..2be4935b7afe 100644
--- a/drivers/media/usb/usbtv/usbtv-video.c
+++ b/drivers/media/usb/usbtv/usbtv-video.c
@@ -496,26 +496,24 @@ static struct urb *usbtv_setup_iso_transfer(struct usbtv *usbtv)
 {
 	struct urb *ip;
 	int size = usbtv->iso_size;
+	void *buf;
 	int i;
 
 	ip = usb_alloc_urb(USBTV_ISOC_PACKETS, GFP_KERNEL);
 	if (ip == NULL)
 		return NULL;
 
-	ip->dev = usbtv->udev;
-	ip->context = usbtv;
-	ip->pipe = usb_rcvisocpipe(usbtv->udev, USBTV_VIDEO_ENDP);
-	ip->interval = 1;
-	ip->transfer_flags = URB_ISO_ASAP;
-	ip->transfer_buffer = kcalloc(USBTV_ISOC_PACKETS, size,
-						GFP_KERNEL);
-	if (!ip->transfer_buffer) {
+	buf = kcalloc(USBTV_ISOC_PACKETS, size, GFP_KERNEL);
+	if (!buf) {
 		usb_free_urb(ip);
 		return NULL;
 	}
-	ip->complete = usbtv_iso_cb;
+	usb_fill_int_urb(ip, usbtv->udev,
+			 usb_rcvisocpipe(usbtv->udev, USBTV_VIDEO_ENDP),
+			 buf, size * USBTV_ISOC_PACKETS, usbtv_iso_cb,
+			 usbtv, 1);
+	ip->transfer_flags = URB_ISO_ASAP;
 	ip->number_of_packets = USBTV_ISOC_PACKETS;
-	ip->transfer_buffer_length = size * USBTV_ISOC_PACKETS;
 	for (i = 0; i < USBTV_ISOC_PACKETS; i++) {
 		ip->iso_frame_desc[i].offset = size * i;
 		ip->iso_frame_desc[i].length = size;

                 reply	other threads:[~2018-06-20 11:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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-25-bigeasy@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=hans.verkuil@cisco.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).