From patchwork Tue May 25 08:59:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?Q2h1bmZlbmcgWXVuICjkupHmmKXls7Ap?= X-Patchwork-Id: 12278215 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=-17.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,UNPARSEABLE_RELAY, URIBL_BLOCKED,USER_AGENT_GIT 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 EDBD1C2B9F8 for ; Tue, 25 May 2021 09:01:38 +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 B3236610A5 for ; Tue, 25 May 2021 09:01:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B3236610A5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com 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:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=gmo0hfFOPmVTfTQ6fDNkkZ1wlZychQ41HW5DdCtzRz0=; b=Xy31aE8qkEBJAc y4vrncQseJCQFEADfzKe9vtvjuOUKpS/zjlzJK6HEn5aZ1k+UyUe4M5TC7GIIUifVn56Zec3No/zl No7Kx1nW5pZHmK7qCNi7SM3AmC+vlHyEzMkF2ntpR5ycJoKk9lsi+S+890Bp0DdNJCYeapfO2j6Ov dOYaFdTRClSoh9I1XMz0NMqzToogXzYQvhqnuDBsMBXcz0jk93edVI9JkwMj/CD1TkxdJ+W5KdQpE T5v0EN/Jji41FkN4mtEhQWpXHILJJbK9JBy/m8EELSqz/iIfcfjfPKsuRSoUzH0wQ07s7FzPc9u9c IiFQqTh6L22CLWEHCYIg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1llSug-004Ep2-NI; Tue, 25 May 2021 08:59:47 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1llSuW-004ElA-QA; Tue, 25 May 2021 08:59:38 +0000 X-UUID: 42457dab3ff349359f821e4149af1c3d-20210525 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=TfNlcLUA2ZIU63dXxswsfjCNfMJap0carwNNiCaUKzg=; b=uVIs7gGadEN7ZJs1Y1UAGsscVSJAkcu+uabLqCjx31RLC43vB7o/xV4+8q7KP9ly+SVXGNdy2GkADZY8RIt1ZQ8KbYEN9JBcxsFpShUZbn2JK8QkoCGMlA/BHmgoQcnVPgXZOsTkIjv3EEfUwejh93rEDxCx1bG5MyjWq9ozKvo=; X-UUID: 42457dab3ff349359f821e4149af1c3d-20210525 Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1708606250; Tue, 25 May 2021 01:59:35 -0700 Received: from MTKMBS31N2.mediatek.inc (172.27.4.87) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 25 May 2021 01:59:34 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by MTKMBS31N2.mediatek.inc (172.27.4.87) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 25 May 2021 16:59:27 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 25 May 2021 16:59:26 +0800 From: Chunfeng Yun To: Greg Kroah-Hartman , Felipe Balbi CC: Matthias Brugger , Chunfeng Yun , Thinh Nguyen , , , , Subject: [PATCH 1/3] usb: common: move usb_get_dr_mode() kerneldoc next to its definition Date: Tue, 25 May 2021 16:59:23 +0800 Message-ID: <1621933165-9661-1-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty MIME-Version: 1.0 X-TM-SNTS-SMTP: 2977430AD55DCCDB2143F58A4BF46AD99FC6668D274A0FBE524214208E31C2FE2000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210525_015936_893324_E664EE5D X-CRM114-Status: GOOD ( 13.20 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Following a general rule, add the kerneldoc for a function next to it's definition, but not next to its declaration in a header file, meanwhile fix typo 'correspondig' Signed-off-by: Chunfeng Yun --- drivers/usb/common/common.c | 7 +++++++ include/linux/usb/otg.h | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c index 347fb3d3894a..fff318597337 100644 --- a/drivers/usb/common/common.c +++ b/drivers/usb/common/common.c @@ -187,6 +187,13 @@ static enum usb_dr_mode usb_get_dr_mode_from_string(const char *str) return (ret < 0) ? USB_DR_MODE_UNKNOWN : ret; } +/** + * usb_get_dr_mode - Get dual role mode for given device + * @dev: Pointer to the given device + * + * The function gets phy interface string from property 'dr_mode', + * and returns the corresponding enum usb_dr_mode + */ enum usb_dr_mode usb_get_dr_mode(struct device *dev) { const char *dr_mode; diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h index 69f1b6328532..a86ee6aad51b 100644 --- a/include/linux/usb/otg.h +++ b/include/linux/usb/otg.h @@ -120,13 +120,6 @@ enum usb_dr_mode { USB_DR_MODE_OTG, }; -/** - * usb_get_dr_mode - Get dual role mode for given device - * @dev: Pointer to the given device - * - * The function gets phy interface string from property 'dr_mode', - * and returns the correspondig enum usb_dr_mode - */ extern enum usb_dr_mode usb_get_dr_mode(struct device *dev); #endif /* __LINUX_USB_OTG_H */ From patchwork Tue May 25 08:59:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?Q2h1bmZlbmcgWXVuICjkupHmmKXls7Ap?= X-Patchwork-Id: 12278241 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=-17.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,UNPARSEABLE_RELAY, URIBL_BLOCKED,USER_AGENT_GIT 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 63A4FC2B9F8 for ; Tue, 25 May 2021 09:11:33 +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 268BC60BBB for ; Tue, 25 May 2021 09:11:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 268BC60BBB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com 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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=t/HsHOx3hc5c8vbEINnUT9fXg52HAsgOetz3SLWCaL4=; b=y8oKIO117rPNYl yBt8yvPbZRCGdDuKc2nYMsZZpPA9XzipTmlvThoiIxTicLPOqTTO3Zi9NOnxXepdte5r9eqDRN5lq Y0/S/8I958zy7SRsQE+6iQnaQ+cZDxSK1tGPebP7ag7oN5HMF3INBDrrCps3JZfaQu2GLcaGSjC4c KYQoVC916muNOMJ/nFUwwsy42QNDQNr29FYeq4fhM97JOkd7EPhvzULjCwnbmJycO26RwGI7GHjeq GPFUu8q0qXFAB0PcA0O8rqqbyqSF+2v20bHeQsFmQsFHADvD4fAh3O6Bzriy8Dr1v0NMeunlel/VO YaTxATN34U+BGJ8ibwcQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1llT4R-004IOv-Mg; Tue, 25 May 2021 09:09:51 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1llT4M-004INU-0V; Tue, 25 May 2021 09:09:47 +0000 X-UUID: fa9889f41b5b4931a1cd2baadedf150d-20210525 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=SZBmohlW+oCyQmqTCevVeKGrdLwBwSKrOgpfPPoxoI8=; b=r6qqgkZFmw+D5mf4FOVEnSITw5RQIoMjqAqxIfB1aMXONYEdP/LdBqianVPDcO6+Z43LTl6lHOhhPGjEmg489BrQr8CHnQ21jwV8vW/dtBzDv5PD74fRhbHATbjO/G+y9+EoJQK8GISoPnw9ZUosPWoTu2xNVSEPld8Sa5md3Ig=; X-UUID: fa9889f41b5b4931a1cd2baadedf150d-20210525 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 121114503; Tue, 25 May 2021 02:09:37 -0700 Received: from MTKMBS31N1.mediatek.inc (172.27.4.69) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 25 May 2021 01:59:35 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by MTKMBS31N1.mediatek.inc (172.27.4.69) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 25 May 2021 16:59:29 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 25 May 2021 16:59:28 +0800 From: Chunfeng Yun To: Greg Kroah-Hartman , Felipe Balbi CC: Matthias Brugger , Chunfeng Yun , Thinh Nguyen , , , , Subject: [PATCH 2/3] usb: common: add helper to get role-switch-default-mode Date: Tue, 25 May 2021 16:59:24 +0800 Message-ID: <1621933165-9661-2-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1621933165-9661-1-git-send-email-chunfeng.yun@mediatek.com> References: <1621933165-9661-1-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: 8C0FE68DFA6589FCA3D9D34402D9CDF0EA656AD0BA301A1EC48A81BDD66D13B32000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210525_020946_097277_5CE41C2F X-CRM114-Status: GOOD ( 13.54 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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); #endif /* __LINUX_USB_OTG_H */ From patchwork Tue May 25 08:59:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?Q2h1bmZlbmcgWXVuICjkupHmmKXls7Ap?= X-Patchwork-Id: 12278217 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=-17.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,UNPARSEABLE_RELAY, URIBL_BLOCKED,USER_AGENT_GIT 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 61A52C2B9F8 for ; Tue, 25 May 2021 09:01:55 +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 210116100B for ; Tue, 25 May 2021 09:01:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 210116100B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com 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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XS+WuZ02EpV/vlh+EQRqs5XpMXi2GVvYh0+XEslrpQI=; b=nyTcrEMAPkCVUn pnB6QWXI3SJl4RfVlEI6kRPy/7xId6vKOac+1SnrvW2MsZ15Ug7mox0vmYapQ6dAqI4nenj2o7eDW nk8WpIbAonWz/Qklmz2Vm/A+uZnCi2D0vmTlQadb+UhlMbhgOjyxLeXSlrTgGrO1slf0+NQoA56bq D15pIxNwV744gUfiNOvbYLjmXAyMDqR7wRDpwJ4vwJibd04WwK0Y4d6nX/JhaFKNBlWAxe8fvcglW xtEukQE3Lluliy0bp9n7H1odDi+D3Y126+Ccm5dunaQ9tbUaBAQEUW+0Qw8Ah8/teJgja3FKtW46I DZsxhJvLDBC2q0ZmS7FQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1llSv8-004Exu-5r; Tue, 25 May 2021 09:00:14 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1llSuX-004Elr-NZ; Tue, 25 May 2021 08:59:39 +0000 X-UUID: d7d1fc3d29b646229fc5a1a04a256c53-20210525 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=FpLB1PdBFwxN4OWIFwyx6D6nL+MQsfr0lfqp7EJt2gE=; b=BMVYjTHYRwNUZxpgDSofBUdXi3gvp2VBPwIHQa3rDo3Ho/8dVkwzrYwv+xKJiwqlOQd9UN9GOK88r+8RqbLsG8WEMUjfsiQstU5N5WzYC3htx0iCdVVjtg6XxqCBCv3H6xIcezuhPcJPp7AOeVQxCm0eOYHxOqtRZlphEWStLBQ=; X-UUID: d7d1fc3d29b646229fc5a1a04a256c53-20210525 Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1958941939; Tue, 25 May 2021 01:59:35 -0700 Received: from MTKMBS31N2.mediatek.inc (172.27.4.87) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 25 May 2021 01:59:33 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by MTKMBS31N2.mediatek.inc (172.27.4.87) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 25 May 2021 16:59:30 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 25 May 2021 16:59:29 +0800 From: Chunfeng Yun To: Greg Kroah-Hartman , Felipe Balbi CC: Matthias Brugger , Chunfeng Yun , Thinh Nguyen , , , , Subject: [PATCH 3/3] usb: dwc3: drd: use helper to get role-switch-default-mode Date: Tue, 25 May 2021 16:59:25 +0800 Message-ID: <1621933165-9661-3-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1621933165-9661-1-git-send-email-chunfeng.yun@mediatek.com> References: <1621933165-9661-1-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: 77F36147C153D36AB4432C09A60A671036FE641E08A865D0AD794EA99D0C66E72000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210525_015937_812304_048F6BE2 X-CRM114-Status: GOOD ( 12.56 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use the new helper usb_get_role_switch_default_mode() to get property of "role-switch-default-mode" Signed-off-by: Chunfeng Yun --- drivers/usb/dwc3/drd.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/usb/dwc3/drd.c b/drivers/usb/dwc3/drd.c index e2b68bb770d1..4e0a26683b06 100644 --- a/drivers/usb/dwc3/drd.c +++ b/drivers/usb/dwc3/drd.c @@ -541,14 +541,10 @@ static enum usb_role dwc3_usb_role_switch_get(struct usb_role_switch *sw) static int dwc3_setup_role_switch(struct dwc3 *dwc) { struct usb_role_switch_desc dwc3_role_switch = {NULL}; - const char *str; u32 mode; - int ret; - ret = device_property_read_string(dwc->dev, "role-switch-default-mode", - &str); - if (ret >= 0 && !strncmp(str, "host", strlen("host"))) { - dwc->role_switch_default_mode = USB_DR_MODE_HOST; + dwc->role_switch_default_mode = usb_get_role_switch_default_mode(dwc->dev); + if (dwc->role_switch_default_mode == USB_DR_MODE_HOST) { mode = DWC3_GCTL_PRTCAP_HOST; } else { dwc->role_switch_default_mode = USB_DR_MODE_PERIPHERAL;