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 <hverkuil@xs4all.nl>
Subject: [13/27] media: gspca: konica: use usb_fill_int_urb()
Date: Wed, 20 Jun 2018 13:00:51 +0200	[thread overview]
Message-ID: <20180620110105.19955-14-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: 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/konica.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/drivers/media/usb/gspca/konica.c b/drivers/media/usb/gspca/konica.c
index 989ae997f66d..6ab96bcb338f 100644
--- a/drivers/media/usb/gspca/konica.c
+++ b/drivers/media/usb/gspca/konica.c
@@ -203,6 +203,8 @@ static int sd_start(struct gspca_dev *gspca_dev)
 #endif
 #define SD_NPKT 32
 	for (n = 0; n < 4; n++) {
+		void *buf;
+
 		i = n & 1 ? 0 : 1;
 		packet_size =
 			le16_to_cpu(alt->endpoint[i].desc.wMaxPacketSize);
@@ -210,24 +212,21 @@ static int sd_start(struct gspca_dev *gspca_dev)
 		if (!urb)
 			return -ENOMEM;
 		gspca_dev->urb[n] = urb;
-		urb->transfer_buffer = usb_alloc_coherent(gspca_dev->dev,
-						packet_size * SD_NPKT,
-						GFP_KERNEL,
-						&urb->transfer_dma);
-		if (urb->transfer_buffer == NULL) {
+		buf = usb_alloc_coherent(gspca_dev->dev, packet_size * SD_NPKT,
+					 GFP_KERNEL, &urb->transfer_dma);
+		if (buf == NULL) {
 			pr_err("usb_buffer_alloc failed\n");
 			return -ENOMEM;
 		}
 
-		urb->dev = gspca_dev->dev;
-		urb->context = gspca_dev;
-		urb->transfer_buffer_length = packet_size * SD_NPKT;
-		urb->pipe = usb_rcvisocpipe(gspca_dev->dev,
-					n & 1 ? 0x81 : 0x82);
+		usb_fill_int_urb(urb, gspca_dev->dev,
+				 usb_rcvisocpipe(gspca_dev->dev,
+						 n & 1 ? 0x81 : 0x82),
+				 buf, packet_size * 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 = packet_size;

                 reply	other threads:[~2018-06-20 11:00 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-14-bigeasy@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=hverkuil@xs4all.nl \
    --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).