From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 767FDC352A2 for ; Fri, 7 Feb 2020 08:55:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5426A2082E for ; Fri, 7 Feb 2020 08:55:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726901AbgBGIzs (ORCPT ); Fri, 7 Feb 2020 03:55:48 -0500 Received: from mx2.suse.de ([195.135.220.15]:50356 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726417AbgBGIzs (ORCPT ); Fri, 7 Feb 2020 03:55:48 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 99CF1AED6; Fri, 7 Feb 2020 08:55:46 +0000 (UTC) Date: Fri, 07 Feb 2020 09:55:46 +0100 Message-ID: From: Takashi Iwai To: Mauro Carvalho Chehab Cc: Takashi Iwai , Hans Verkuil , Josef =?UTF-8?B?TcO2bGxlcnM=?= , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] media: go7007: Fix URB type for interrupt handling In-Reply-To: <20200207094909.7d5b744d@kernel.org> References: <20200206154527.18171-1-tiwai@suse.de> <20200207094909.7d5b744d@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 07 Feb 2020 09:49:09 +0100, Mauro Carvalho Chehab wrote: > > Em Thu, 6 Feb 2020 16:45:27 +0100 > Takashi Iwai escreveu: > > > Josef reported that his old-and-good Plextor ConvertX M402U video > > converter spews lots of WARNINGs on the recent kernels, and it turned > > out that the device uses a bulk endpoint for interrupt handling just > > like 2250 board. > > > > For fixing it, generalize the check with the proper verification of > > the endpoint instead of hard-coded board type check. > > > > Fixes: 7e5219d18e93 ("[media] go7007: Fix 2250 urb type") > > Reported-and-tested-by: Josef Möllers > > BugLink: https://bugzilla.suse.com/show_bug.cgi?id=1162583 > > BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=206427 > > Signed-off-by: Takashi Iwai > > > > --- > > drivers/media/usb/go7007/go7007-usb.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/media/usb/go7007/go7007-usb.c b/drivers/media/usb/go7007/go7007-usb.c > > index ff2aa057c1fb..f889c9d740cd 100644 > > --- a/drivers/media/usb/go7007/go7007-usb.c > > +++ b/drivers/media/usb/go7007/go7007-usb.c > > @@ -1044,6 +1044,7 @@ static int go7007_usb_probe(struct usb_interface *intf, > > struct go7007_usb *usb; > > const struct go7007_usb_board *board; > > struct usb_device *usbdev = interface_to_usbdev(intf); > > + struct usb_host_endpoint *ep; > > unsigned num_i2c_devs; > > char *name; > > int video_pipe, i, v_urb_len; > > @@ -1140,7 +1141,8 @@ static int go7007_usb_probe(struct usb_interface *intf, > > if (usb->intr_urb->transfer_buffer == NULL) > > goto allocfail; > > > > - if (go->board_id == GO7007_BOARDID_SENSORAY_2250) > > + ep = usb->usbdev->ep_in[4]; > > Hmm... why [4] above? > > I mean, what other drivers do is something like: > > for (i = 0; i < intf->num_altsetting; i++) { > for (j = 0; j < intf->altsetting[i].desc.bNumEndpoints; j++) { > ep = &intf->altsetting[i].endpoint[j].desc; > /* some logic to check ep and change alt if needed */ > } > } > It corresponds to the endpoint for the created URB will be associated with; i.e. > > + if (usb_endpoint_type(&ep->desc) == USB_ENDPOINT_XFER_BULK) > > usb_fill_bulk_urb(usb->intr_urb, usb->usbdev, > > usb_rcvbulkpipe(usb->usbdev, 4), here it's usb_rcvbulkpipe(dev, 4) or usb_rcvintpipe(dev, 4) indicating the endpoint 4. If it matters, it can be changed to usb_pipe_endpoint(usb->usbdev, usb_rcvbulkpipe(usb->usbdev, 4)) too. thanks, Takashi