From patchwork Wed Jun 20 11:01:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 10476961 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 423C860230 for ; Wed, 20 Jun 2018 11:01:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3324F28AD7 for ; Wed, 20 Jun 2018 11:01:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2809D28B99; Wed, 20 Jun 2018 11:01:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C79D328AD7 for ; Wed, 20 Jun 2018 11:01:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754200AbeFTLBq (ORCPT ); Wed, 20 Jun 2018 07:01:46 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:59940 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752914AbeFTLBo (ORCPT ); Wed, 20 Jun 2018 07:01:44 -0400 Received: from localhost ([127.0.0.1] helo=bazinga.breakpoint.cc) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1fVars-0003m6-KS; Wed, 20 Jun 2018 13:01:40 +0200 From: Sebastian Andrzej Siewior To: linux-media@vger.kernel.org Cc: Mauro Carvalho Chehab , linux-usb@vger.kernel.org, tglx@linutronix.de, Sebastian Andrzej Siewior , Hans Verkuil Subject: [PATCH 24/27] media: usbtv: use usb_fill_int_urb() Date: Wed, 20 Jun 2018 13:01:02 +0200 Message-Id: <20180620110105.19955-25-bigeasy@linutronix.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180620110105.19955-1-bigeasy@linutronix.de> References: <20180620110105.19955-1-bigeasy@linutronix.de> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Cc: Hans Verkuil Signed-off-by: Sebastian Andrzej Siewior --- 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;