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=-15.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=unavailable 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 6BE30C433E0 for ; Fri, 5 Mar 2021 15:48:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2E97165093 for ; Fri, 5 Mar 2021 15:48:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229563AbhCEPsC (ORCPT ); Fri, 5 Mar 2021 10:48:02 -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 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=-13.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 6A3EDC433DB for ; Fri, 5 Mar 2021 15:48:20 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 084566508D for ; Fri, 5 Mar 2021 15:48:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 084566508D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=NRiWTkbHHVxmj4KR/fhEAGHDurpQf9CXTh+qbbmDzD8=; b=N9cDiaVupz4UXXfxEckAO9iMu g3xAEFy5jzdPhWabXAHL9mC7k8ZVJlNwIxci9qmUxPwlLEGdfpkEgjFN16oYeNyXiGlPG8w/55S/G lGF9GkqtGvFblEL5XFIguEX/58avcorMjZSclAvao4WFtLXYz63AdzEghDUSmZs83ECWRK4O7qvW6 MAZ5ztoXv+6eC1nIl1sXsohjbqRrs2mF8TagXBvkyPhehcPAPIV2bDyCJM6VlPB35VfhectHH8xzv JGEDsZfnuwL7BYMb4jc80R86jr2rFV6jNvW3KlA19GOhnNO+yHjSA0sLcLUWNrED33LPo6g5oCvG6 PEcjSi6iw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lICgJ-00FVef-4n; Fri, 05 Mar 2021 15:47:59 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lICfw-00FVYu-9x; Fri, 05 Mar 2021 15:47:43 +0000 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-Disposition: inline In-Reply-To: <20210305153312.GA38200@rowland.harvard.edu> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210305_154739_550928_C3458314 X-CRM114-Status: GOOD ( 20.21 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.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 _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek 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=-13.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 ADDEBC433E0 for ; Fri, 5 Mar 2021 15:49:59 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 374AB6507A for ; Fri, 5 Mar 2021 15:49:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 374AB6507A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=DPM/KJsI7nER55E+jlyKUJkhrM/bN6N8YOn4yzjPgSs=; b=hOA4Tc/Hte4WTKvMY0bZbmaNR CCqw/FJKpnCtFvNaPO6fkRm+z25gNjcdhZoJtrVSfkBik++Y89DRSlJz+IuFOstRnplXN4OZjWbno lK+01yN/dgFT3W1VRj1UPsTE0yHwES8rTyKGUHsT/McSn8EiL2zuxplpCsAGpXe4ZrQSnUF1G6/Tb XP0yu8ThTgLkQY0Tp/hZcoqpF95ebGG1q3KcxuLEdgvOyvHkcZnEXWLuebc7XdaVfpV9npjtHdsQh AgiZRwR5vIKENrck7BxmfQ/btoX8TbnE0IKzPfzOVM57J74HrCc8RfdM3rhqRb9AuTiG5JwIWsXU1 +zCb+zGUw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lICg8-00FVbs-0N; Fri, 05 Mar 2021 15:47:49 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lICfw-00FVYu-9x; Fri, 05 Mar 2021 15:47:43 +0000 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-Disposition: inline In-Reply-To: <20210305153312.GA38200@rowland.harvard.edu> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210305_154739_550928_C3458314 X-CRM114-Status: GOOD ( 20.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel