Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3244317pxk; Mon, 7 Sep 2020 07:22:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQWeqfZu7hOYLC9Bbi74BJt3SUiKCUfe8Kz0D+Q7PTVrAauvHMxekLu9uZdAxWflDyAeKQ X-Received: by 2002:a05:6402:17b5:: with SMTP id j21mr21338542edy.276.1599488551994; Mon, 07 Sep 2020 07:22:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599488551; cv=none; d=google.com; s=arc-20160816; b=QKyTGXYPdmY3aI1yvRjSFNCE4ed0ioiVVTlNlhjwJdeV7S7ZPYiRlhncuF44JKlIMH dZkw08BHaJzTP0lS2g2vJa9rzFZv9QOHTuSMlcM30aEK16cqUhN3/bSV5gHKBvfXnRzc FNLdh4TTKfuJHrXcmoA8Qohs0n13Xaf6Bdqwua2n8eGcroSvhFSs+PDE6KwuB/coE3/l QO7+HVrszfF7c5ce5Rt8RwaoIX6ktPx6MjS5xnXQyFq2sc2tJB+/OGZ9Zm87Fk3C6nZR OJxWcQvRLqae+3dPMP083H+ftKYp245sv8NIjSyQDNZksxtyefvM1XeLWrpJIEmCi7ne TKYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=/E7WiMZYrK/1cH7QEmFgnRMqAdOIUEBwkhasnIJMWjk=; b=cH4mMVOyZenJjs2u83y8Y006orkTHrujXkt8II0Mm5n+6SDUZ3PBS3Pw4ZLn7uOvr5 oqnCnUBTiEaY8Veb2X6+RaVBat5gMx60sv6FK8rxZFx2Npcv/ddl1tIe6Aa8xWVfeyVt lu8c5pWj83uE4nOSLWTVUZ1L6HKWDB4BDRHz7ExPDtQG81W/GC+Weuowooqfg+9DZeY0 FnNku8g3GFMPhHd+kpBsZ5cJtqPzye7Pv8fLFTaoDhBrTw23qDrOifrrQPTGml5lOsUx z1xbmfq1MAx2r3BSBSJVw9I/XHkEBDxM3YsKRDO94X9FSz9ZU+EWKAvWh2JxkbAwW68R wnHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ubElOFB8; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y102si10534891ede.258.2020.09.07.07.21.51; Mon, 07 Sep 2020 07:22:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ubElOFB8; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729800AbgIGOVX (ORCPT + 99 others); Mon, 7 Sep 2020 10:21:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:49280 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729594AbgIGOSz (ORCPT ); Mon, 7 Sep 2020 10:18:55 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8F2292064B; Mon, 7 Sep 2020 14:16:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599488180; bh=+hBkQu9s4/gMzHCxciSjjnQi2QtLKwBklfRKGdDcWQs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ubElOFB8q/iIS1SIkvwxPAzakDy+zGpi/JPWEGV+l+oSadsydiBT5sTCirXySPLqt uFcwgKNn3JXhKu8BvcomGRstBQE9qN2SN/qJLdtwM9id25z1Lv/0d/Bbt72IA2dTay GkXCdq92evvVCma8kdDninKnSyiW/ZPpouX25gls= Date: Mon, 7 Sep 2020 16:16:34 +0200 From: Greg Kroah-Hartman To: Alan Stern Cc: himadrispandya@gmail.com, dvyukov@google.com, linux-usb@vger.kernel.org, perex@perex.cz, tiwai@suse.com, linux-kernel@vger.kernel.org, marcel@holtmann.org, johan.hedberg@gmail.com, linux-bluetooth@vger.kernel.org, alsa-devel@alsa-project.org, "Gustavo A. R. Silva" , Eli Billauer , Emiliano Ingrassia , Alexander Tsoy , "Geoffrey D. Bennett" , Jussi Laako , Nick Kossifidis , Dmitry Panchenko , Chris Wulff , Jesus Ramos Subject: Re: [PATCH 01/10] USB: move snd_usb_pipe_sanity_check into the USB core Message-ID: <20200907141634.GA3733019@kroah.com> References: <20200902110115.1994491-1-gregkh@linuxfoundation.org> <20200902110115.1994491-2-gregkh@linuxfoundation.org> <20200903004553.GA642955@rowland.harvard.edu> <20200903073230.GA162335@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200903073230.GA162335@kroah.com> Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org On Thu, Sep 03, 2020 at 09:32:30AM +0200, Greg Kroah-Hartman wrote: > On Wed, Sep 02, 2020 at 08:45:53PM -0400, Alan Stern wrote: > > On Wed, Sep 02, 2020 at 01:01:03PM +0200, Greg Kroah-Hartman wrote: > > > snd_usb_pipe_sanity_check() is a great function, so let's move it into > > > the USB core so that other parts of the kernel, including the USB core, > > > can call it. > > > > > > Name it usb_pipe_type_check() to match the existing > > > usb_urb_ep_type_check() call, which now uses this function. > > > > > > Cc: Jaroslav Kysela > > > Cc: Takashi Iwai > > > Cc: "Gustavo A. R. Silva" > > > Cc: Eli Billauer > > > Cc: Emiliano Ingrassia > > > Cc: Alan Stern > > > Cc: Alexander Tsoy > > > Cc: "Geoffrey D. Bennett" > > > Cc: Jussi Laako > > > Cc: Nick Kossifidis > > > Cc: Dmitry Panchenko > > > Cc: Chris Wulff > > > Cc: Jesus Ramos > > > Cc: linux-usb@vger.kernel.org > > > Cc: linux-kernel@vger.kernel.org > > > Cc: alsa-devel@alsa-project.org > > > Signed-off-by: Greg Kroah-Hartman > > > --- > > > > > diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c > > > index 27e83e55a590..45bc2914c1ba 100644 > > > --- a/drivers/usb/core/urb.c > > > +++ b/drivers/usb/core/urb.c > > > @@ -192,24 +192,39 @@ static const int pipetypes[4] = { > > > }; > > > > > > /** > > > - * usb_urb_ep_type_check - sanity check of endpoint in the given urb > > > - * @urb: urb to be checked > > > + * usb_pipe_type_check - sanity check of a specific pipe for a usb device > > > + * @dev: struct usb_device to be checked > > > + * @pipe: pipe to check > > > * > > > * This performs a light-weight sanity check for the endpoint in the > > > - * given urb. It returns 0 if the urb contains a valid endpoint, otherwise > > > - * a negative error code. > > > + * given usb device. It returns 0 if the pipe is a valid for the specific usb > > -----------------------------------------------------^ > > Typo. > > Oops, will fix, thanks. > > > > > > > + * device, otherwise a negative error code. > > > */ > > > -int usb_urb_ep_type_check(const struct urb *urb) > > > +int usb_pipe_type_check(struct usb_device *dev, unsigned int pipe) > > > { > > > const struct usb_host_endpoint *ep; > > > > > > - ep = usb_pipe_endpoint(urb->dev, urb->pipe); > > > + ep = usb_pipe_endpoint(dev, pipe); > > > if (!ep) > > > return -EINVAL; > > > - if (usb_pipetype(urb->pipe) != pipetypes[usb_endpoint_type(&ep->desc)]) > > > + if (usb_pipetype(pipe) != pipetypes[usb_endpoint_type(&ep->desc)]) > > > return -EINVAL; > > > return 0; > > > } > > > +EXPORT_SYMBOL_GPL(usb_pipe_type_check); > > > + > > > +/** > > > + * usb_urb_ep_type_check - sanity check of endpoint in the given urb > > > + * @urb: urb to be checked > > > + * > > > + * This performs a light-weight sanity check for the endpoint in the > > > + * given urb. It returns 0 if the urb contains a valid endpoint, otherwise > > > + * a negative error code. > > > + */ > > > +int usb_urb_ep_type_check(const struct urb *urb) > > > +{ > > > + return usb_pipe_type_check(urb->dev, urb->pipe); > > > +} > > > EXPORT_SYMBOL_GPL(usb_urb_ep_type_check); > > > > Since this routine is used in only one place in the entire kernel, you > > might as well inline the code there and get rid of the function > > entirely. > > Good idea, will do. No, wait, the USB sound drivers call it a lot, so it needs to stick around for now until we clean that up. thanks, greg k-h