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=-16.1 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 4DB50C47089 for ; Thu, 27 May 2021 07:28:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2C61361028 for ; Thu, 27 May 2021 07:28:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234589AbhE0HaI (ORCPT ); Thu, 27 May 2021 03:30:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:38268 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229753AbhE0HaD (ORCPT ); Thu, 27 May 2021 03:30:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 44EC861059; Thu, 27 May 2021 07:28:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622100509; bh=JaIyM9JOIaX8kTZxhm82AXcUEBSrdnzdxBrRGPKHC7w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kJJNGPzH150LOjO+txWMxQkpdLCxNFWP44M2DDeOl1Ya/ZpWgEBCANlKDUe6pkcu9 xr+gdroiMLX5ZWnPW7R24hgjWifhNm66keG2pHYqj0I8ITY2ES+agxLaZEnu7CwvEa Sztf9iqOlxqzfxX8SlSQmiOLa63PQID4fJD6/h70= Date: Thu, 27 May 2021 09:28:27 +0200 From: Greg Kroah-Hartman To: Chunfeng Yun Cc: Felipe Balbi , Matthias Brugger , Thinh Nguyen , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: Re: [PATCH 2/3] usb: common: add helper to get role-switch-default-mode Message-ID: References: <1621933165-9661-1-git-send-email-chunfeng.yun@mediatek.com> <1621933165-9661-2-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1621933165-9661-2-git-send-email-chunfeng.yun@mediatek.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 25, 2021 at 04:59:24PM +0800, Chunfeng Yun wrote: > Add helper to get "role-switch-default-mode", and convert it > to the corresponding enum usb_dr_mode > > Signed-off-by: Chunfeng Yun > --- > drivers/usb/common/common.c | 20 ++++++++++++++++++++ > include/linux/usb/otg.h | 1 + > 2 files changed, 21 insertions(+) > > diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c > index fff318597337..78a625a4e526 100644 > --- a/drivers/usb/common/common.c > +++ b/drivers/usb/common/common.c > @@ -207,6 +207,26 @@ enum usb_dr_mode usb_get_dr_mode(struct device *dev) > } > EXPORT_SYMBOL_GPL(usb_get_dr_mode); > > +/** > + * usb_get_role_switch_default_mode - Get default mode for given device > + * @dev: Pointer to the given device > + * > + * The function gets string from property 'role-switch-default-mode', > + * and returns the corresponding enum usb_dr_mode. > + */ > +enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev) > +{ > + const char *str; > + int ret; > + > + ret = device_property_read_string(dev, "role-switch-default-mode", &str); > + if (ret < 0) > + return USB_DR_MODE_UNKNOWN; > + > + return usb_get_dr_mode_from_string(str); > +} > +EXPORT_SYMBOL_GPL(usb_get_role_switch_default_mode); > + > /** > * usb_decode_interval - Decode bInterval into the time expressed in 1us unit > * @epd: The descriptor of the endpoint > diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h > index a86ee6aad51b..bde313c97fb6 100644 > --- a/include/linux/usb/otg.h > +++ b/include/linux/usb/otg.h > @@ -121,5 +121,6 @@ enum usb_dr_mode { > }; > > extern enum usb_dr_mode usb_get_dr_mode(struct device *dev); > +extern enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev); What other code outside of the dwc3 driver will ever need to call this? 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=-14.1 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=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 A2BDBC47089 for ; Thu, 27 May 2021 07:28:59 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 63AA861186 for ; Thu, 27 May 2021 07:28:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 63AA861186 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=bombadil.20210309; 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=Vdg7Bqif6+CO4k4hOjhRaBIMFbcZFKEWBcMzNryDKJg=; b=d7Mev/hEDaugTj TaLaVESzCKz1kdj7v2IT0uIFxWYFHAQmDz0/BepfAwujdaSOQhAk8ojWVIMSHAdmpqwEvrCfBjfw/ eidAnYcto3B+r9jc7Ltd/n7w8A7746ixoDZZUfbAfWdThT73yydKBdxKrYZPSML1rofClxkpqPBUJ GNAoV+j3NRzz+I7DpjNqLkOy0MPHa9rAfNXpJd0pp8mm3lvmYFHlfL919+3vV2TKkyA7rG4cgYUzu xxIWBTlKQeVbZWVvkEYl5S3IY45ACZI+XfnCiYXkUqECQ3u+hXr4qa038nLgYQLUIaicwTDncFxIC XVCxz+Lz0IUusNMLIWSA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lmARi-003MT0-Mt; Thu, 27 May 2021 07:28:46 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lmARS-003MNC-O7; Thu, 27 May 2021 07:28:32 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 44EC861059; Thu, 27 May 2021 07:28:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622100509; bh=JaIyM9JOIaX8kTZxhm82AXcUEBSrdnzdxBrRGPKHC7w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kJJNGPzH150LOjO+txWMxQkpdLCxNFWP44M2DDeOl1Ya/ZpWgEBCANlKDUe6pkcu9 xr+gdroiMLX5ZWnPW7R24hgjWifhNm66keG2pHYqj0I8ITY2ES+agxLaZEnu7CwvEa Sztf9iqOlxqzfxX8SlSQmiOLa63PQID4fJD6/h70= Date: Thu, 27 May 2021 09:28:27 +0200 From: Greg Kroah-Hartman To: Chunfeng Yun Cc: Felipe Balbi , Matthias Brugger , Thinh Nguyen , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: Re: [PATCH 2/3] usb: common: add helper to get role-switch-default-mode Message-ID: References: <1621933165-9661-1-git-send-email-chunfeng.yun@mediatek.com> <1621933165-9661-2-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1621933165-9661-2-git-send-email-chunfeng.yun@mediatek.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210527_002830_830265_D15FC8C0 X-CRM114-Status: GOOD ( 18.30 ) 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 Tue, May 25, 2021 at 04:59:24PM +0800, Chunfeng Yun wrote: > Add helper to get "role-switch-default-mode", and convert it > to the corresponding enum usb_dr_mode > > Signed-off-by: Chunfeng Yun > --- > drivers/usb/common/common.c | 20 ++++++++++++++++++++ > include/linux/usb/otg.h | 1 + > 2 files changed, 21 insertions(+) > > diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c > index fff318597337..78a625a4e526 100644 > --- a/drivers/usb/common/common.c > +++ b/drivers/usb/common/common.c > @@ -207,6 +207,26 @@ enum usb_dr_mode usb_get_dr_mode(struct device *dev) > } > EXPORT_SYMBOL_GPL(usb_get_dr_mode); > > +/** > + * usb_get_role_switch_default_mode - Get default mode for given device > + * @dev: Pointer to the given device > + * > + * The function gets string from property 'role-switch-default-mode', > + * and returns the corresponding enum usb_dr_mode. > + */ > +enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev) > +{ > + const char *str; > + int ret; > + > + ret = device_property_read_string(dev, "role-switch-default-mode", &str); > + if (ret < 0) > + return USB_DR_MODE_UNKNOWN; > + > + return usb_get_dr_mode_from_string(str); > +} > +EXPORT_SYMBOL_GPL(usb_get_role_switch_default_mode); > + > /** > * usb_decode_interval - Decode bInterval into the time expressed in 1us unit > * @epd: The descriptor of the endpoint > diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h > index a86ee6aad51b..bde313c97fb6 100644 > --- a/include/linux/usb/otg.h > +++ b/include/linux/usb/otg.h > @@ -121,5 +121,6 @@ enum usb_dr_mode { > }; > > extern enum usb_dr_mode usb_get_dr_mode(struct device *dev); > +extern enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev); What other code outside of the dwc3 driver will ever need to call this? 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=-14.1 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 553ABC47089 for ; Thu, 27 May 2021 07:30:20 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 17E5961059 for ; Thu, 27 May 2021 07:30:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 17E5961059 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=bombadil.20210309; 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=F56RTXQWP37VE6eI6Vx9lIrZF0n5Ga7f7cVhxkV/WQA=; b=VR4K2dP8Z5eWO0 yPAonS4k78VFT2WLx/w7SEjJrVzLi2GENq/remNo83bQokKLn9zLSfbbkmiVTEsMyjM/t7Zeug5+D HfWBG23vC7TQVB22rZcNo/wXR81/yaFCP1RctyCiSdB47Xnxyr+qXul20suRj8yrknsNeKgBPkghw m/YplrRvcBUd4eH9LocGslcVRkQnDr+XBS5xSHpLafrB5T8MrHrqepca7gbf4Mc4sX2m87dL4Ha7j J6jAw0i+hbt3CWn5bJ/JTX02+GkP6CaeZwhIBfM7dA0A0XsOcgr+ikNHdCSwkUwR3SEfjIWGV29AO kjCmWmLup0p/KxwSe04w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lmARX-003MP5-MQ; Thu, 27 May 2021 07:28:35 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lmARS-003MNC-O7; Thu, 27 May 2021 07:28:32 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 44EC861059; Thu, 27 May 2021 07:28:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622100509; bh=JaIyM9JOIaX8kTZxhm82AXcUEBSrdnzdxBrRGPKHC7w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kJJNGPzH150LOjO+txWMxQkpdLCxNFWP44M2DDeOl1Ya/ZpWgEBCANlKDUe6pkcu9 xr+gdroiMLX5ZWnPW7R24hgjWifhNm66keG2pHYqj0I8ITY2ES+agxLaZEnu7CwvEa Sztf9iqOlxqzfxX8SlSQmiOLa63PQID4fJD6/h70= Date: Thu, 27 May 2021 09:28:27 +0200 From: Greg Kroah-Hartman To: Chunfeng Yun Cc: Felipe Balbi , Matthias Brugger , Thinh Nguyen , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: Re: [PATCH 2/3] usb: common: add helper to get role-switch-default-mode Message-ID: References: <1621933165-9661-1-git-send-email-chunfeng.yun@mediatek.com> <1621933165-9661-2-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1621933165-9661-2-git-send-email-chunfeng.yun@mediatek.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210527_002830_830265_D15FC8C0 X-CRM114-Status: GOOD ( 18.30 ) 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 Tue, May 25, 2021 at 04:59:24PM +0800, Chunfeng Yun wrote: > Add helper to get "role-switch-default-mode", and convert it > to the corresponding enum usb_dr_mode > > Signed-off-by: Chunfeng Yun > --- > drivers/usb/common/common.c | 20 ++++++++++++++++++++ > include/linux/usb/otg.h | 1 + > 2 files changed, 21 insertions(+) > > diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c > index fff318597337..78a625a4e526 100644 > --- a/drivers/usb/common/common.c > +++ b/drivers/usb/common/common.c > @@ -207,6 +207,26 @@ enum usb_dr_mode usb_get_dr_mode(struct device *dev) > } > EXPORT_SYMBOL_GPL(usb_get_dr_mode); > > +/** > + * usb_get_role_switch_default_mode - Get default mode for given device > + * @dev: Pointer to the given device > + * > + * The function gets string from property 'role-switch-default-mode', > + * and returns the corresponding enum usb_dr_mode. > + */ > +enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev) > +{ > + const char *str; > + int ret; > + > + ret = device_property_read_string(dev, "role-switch-default-mode", &str); > + if (ret < 0) > + return USB_DR_MODE_UNKNOWN; > + > + return usb_get_dr_mode_from_string(str); > +} > +EXPORT_SYMBOL_GPL(usb_get_role_switch_default_mode); > + > /** > * usb_decode_interval - Decode bInterval into the time expressed in 1us unit > * @epd: The descriptor of the endpoint > diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h > index a86ee6aad51b..bde313c97fb6 100644 > --- a/include/linux/usb/otg.h > +++ b/include/linux/usb/otg.h > @@ -121,5 +121,6 @@ enum usb_dr_mode { > }; > > extern enum usb_dr_mode usb_get_dr_mode(struct device *dev); > +extern enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev); What other code outside of the dwc3 driver will ever need to call this? thanks, greg k-h _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel