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: 447786 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.7 required=3.0 tests=BAYES_00, 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 5B43FC2B9F8 for ; Tue, 25 May 2021 08:59:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3C6516141C for ; Tue, 25 May 2021 08:59:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232171AbhEYJBF (ORCPT ); Tue, 25 May 2021 05:01:05 -0400 Received: from Mailgw01.mediatek.com ([1.203.163.78]:57123 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S231184AbhEYJBE (ORCPT ); Tue, 25 May 2021 05:01:04 -0400 X-UUID: c987d6d8341a412d90fa221540e1cdca-20210525 X-UUID: c987d6d8341a412d90fa221540e1cdca-20210525 Received: from mtkcas35.mediatek.inc [(172.27.4.253)] by mailgw01.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1550523048; Tue, 25 May 2021 16:59:32 +0800 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 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.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;