From patchwork Wed Jun 20 11:01:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 10476963 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 E596460383 for ; Wed, 20 Jun 2018 11:01:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D709D28AD7 for ; Wed, 20 Jun 2018 11:01:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CBD0528B99; Wed, 20 Jun 2018 11:01:50 +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 704AE28AD7 for ; Wed, 20 Jun 2018 11:01:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754210AbeFTLBr convert rfc822-to-8bit (ORCPT ); Wed, 20 Jun 2018 07:01:47 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:59948 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754173AbeFTLBq (ORCPT ); Wed, 20 Jun 2018 07:01:46 -0400 Received: from localhost ([127.0.0.1] helo=bazinga.breakpoint.cc) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1fVarv-0003m6-7C; Wed, 20 Jun 2018 13:01:43 +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 , Laurent Pinchart Subject: [PATCH 27/27] media: uvcvideo: use usb_fill_int_urb() Date: Wed, 20 Jun 2018 13:01:05 +0200 Message-Id: <20180620110105.19955-28-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. usb_fill_int_urb() also checks bInterval to be in the 1…16 range on HS/SS. Cc: Laurent Pinchart Cc: Mauro Carvalho Chehab Signed-off-by: Sebastian Andrzej Siewior --- 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;