Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2123892pxb; Fri, 5 Mar 2021 07:49:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJyiTVyJ1AJSBBnTrk1u7U9LFEA5WA+PYrA7Ee5dRPQS9LqzT/+Tu57viPiXd4KEFTCjvuBt X-Received: by 2002:a17:907:3e8a:: with SMTP id hs10mr2768448ejc.267.1614959370133; Fri, 05 Mar 2021 07:49:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614959370; cv=none; d=google.com; s=arc-20160816; b=mwluZ9j0056BjiZ/JeJrR9YrTjeOuvKUQlWUOX9WuiQQILLazw1yPS+3pd9WiYV7xD F5Vi7ZFOVMWzE4sl8Yjy2jRpe/5XWPSubDvoRoBk1LCS6xXe25O3FkoS4+Wsi4PfRTO2 4sliCRfkCOG8Xa5tAnuXKtyiIMPpJK95aVaRng7Gcvx21yojOjHGEKhIElpQr3oynKif RGLE4x8e0UjhLrClo+IwOntDBpx5TwrLFbkCV0H/TvPgOU6V2IkK8M+0H+JzGguthSCl 00iUX70kzFVRG3V+LHZlUWmm5DIc8H/uRljnYVP6tr6o5FTHzdA1wxorC6VbJaUWpdr/ dkbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Un+XtqiMejzGEefL1jQ4PQbOBKPRR2GUJxOrKjdxSmQ=; b=YDPih4smT/tjSkMNhfYuhBQ4+kbKixarRx8w92ZUt9UdUo1t1Q43YKpmYA7rNgLwyg EDhA1xJ9NJalw2YC3J1woEDiXxDz5KSsOf9uQ0ywlXc2QoFeBVXJxDc4OlcdQXdZYQDH DDXbNquELQVxCH5vVePnI1cJnOoIMI4qZQPqOXd4s21ThE+lpxvH4vr6uOyUzCROrN1V ipI+54iwfX/Y7pAKE5a+w9SumVHuxZUP6fi/2oPesI8bGw+Rfj5EYQockXw5NIEN3VWc OBySoC5KMfFrA2VYyv4OtA4JwplKHr3l6hqldnpP3LpUTNx8u6KVLCyGIdIezx9YL9/T lWBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=omTvdzTY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (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 k6si1674882edo.113.2021.03.05.07.49.07; Fri, 05 Mar 2021 07:49:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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=@linuxfoundation.org header.s=korg header.b=omTvdzTY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230303AbhCEPsB (ORCPT + 99 others); Fri, 5 Mar 2021 10:48:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:54434 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231219AbhCEPrd (ORCPT ); Fri, 5 Mar 2021 10:47:33 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2287E65092; Fri, 5 Mar 2021 15:47:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614959253; bh=LZDg8chHQnKxfnvQXDeCl73wwlxc/LGrLyawbsjqJf4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=omTvdzTY3BcKun81+mXyUYLEpAeBVUVnSBThuBapVwZCkNmXK4WW8PkqxFhfHDmmw 8roqNBSvRa44hJVXudK5M1B55J5S9eTdcfoGDzXutRfkK2DaY5PKEEpa4GN7NcgBeK HJlkUnOoh+cwHrsB/zOgohz9hpzvD0tCIbkaDUyM= Date: Fri, 5 Mar 2021 16:47:24 +0100 From: Greg Kroah-Hartman To: Alan Stern Cc: Chunfeng Yun , Mathias Nyman , Ikjoon Jang , Matthias Brugger , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Nicolas Boichat , Eddie Hung Subject: Re: [PATCH 16/17] usb: common: add function to get interval expressed in us unit Message-ID: References: <1614934975-15188-1-git-send-email-chunfeng.yun@mediatek.com> <1614934975-15188-16-git-send-email-chunfeng.yun@mediatek.com> <20210305153312.GA38200@rowland.harvard.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210305153312.GA38200@rowland.harvard.edu> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 05, 2021 at 10:33:12AM -0500, Alan Stern wrote: > On Fri, Mar 05, 2021 at 05:02:54PM +0800, Chunfeng Yun wrote: > > Add a new function to convert bInterval into the time expressed > > in 1us unit. > > > > Signed-off-by: Chunfeng Yun > > --- > > > --- a/drivers/usb/common/common.c > > +++ b/drivers/usb/common/common.c > > @@ -165,6 +165,39 @@ enum usb_dr_mode usb_get_dr_mode(struct device *dev) > > } > > EXPORT_SYMBOL_GPL(usb_get_dr_mode); > > > > +unsigned int usb_decode_interval(const struct usb_endpoint_descriptor *epd, > > + enum usb_device_speed speed) > > +{ > > + unsigned int interval = 0; > > + > > + switch (usb_endpoint_type(epd)) { > > + case USB_ENDPOINT_XFER_CONTROL: > > + /* uframes per NAK */ > > + if (speed == USB_SPEED_HIGH) > > + interval = epd->bInterval; > > + break; > > + case USB_ENDPOINT_XFER_ISOC: > > + interval = 1 << (epd->bInterval - 1); > > + break; > > + case USB_ENDPOINT_XFER_BULK: > > + /* uframes per NAK */ > > + if (speed == USB_SPEED_HIGH && usb_endpoint_dir_out(epd)) > > + interval = epd->bInterval; > > + break; > > + case USB_ENDPOINT_XFER_INT: > > + if (speed >= USB_SPEED_HIGH) > > + interval = 1 << (epd->bInterval - 1); > > + else > > + interval = epd->bInterval; > > + break; > > + } > > + > > + interval *= (speed >= USB_SPEED_HIGH) ? 125 : 1000; > > + > > + return interval; > > +} > > +EXPORT_SYMBOL_GPL(usb_decode_interval); > > > --- a/include/linux/usb/ch9.h > > +++ b/include/linux/usb/ch9.h > > @@ -90,6 +90,17 @@ extern enum usb_ssp_rate usb_get_maximum_ssp_rate(struct device *dev); > > */ > > extern const char *usb_state_string(enum usb_device_state state); > > > > +/** > > + * usb_decode_interval - Decode bInterval into the time expressed in 1us unit > > + * @epd: The descriptor of the endpoint > > + * @speed: The speed that the endpoint works as > > + * > > + * Function returns the interval expressed in 1us unit for servicing > > + * endpoint for data transfers. > > + */ > > +unsigned int usb_decode_interval(const struct usb_endpoint_descriptor *epd, > > + enum usb_device_speed speed); > > As a general rule, I believe people expect to find the kerneldoc for a > function next to the function's definition, not next to the declaration > in a header file. I was going to make the same review comment, but if you look above this in that file, there's other kernel doc information in the .h file, so this does match with the style of the file :( We can fix that all up later. thanks, greg k-h