[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1626340078-29111-7-git-send-email-chunfeng.yun@mediatek.com>
Date: Thu, 15 Jul 2021 17:07:51 +0800
From: Chunfeng Yun <chunfeng.yun@...iatek.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Rob Herring <robh+dt@...nel.org>,
Felipe Balbi <balbi@...nel.org>
CC: Chunfeng Yun <chunfeng.yun@...iatek.com>,
Matthias Brugger <matthias.bgg@...il.com>,
Thinh Nguyen <Thinh.Nguyen@...opsys.com>,
<linux-usb@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-mediatek@...ts.infradead.org>, <devicetree@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, Yuwen Ng <yuwen.ng@...iatek.com>,
Eddie Hung <eddie.hung@...iatek.com>
Subject: [PATCH v3 06/13] usb: dwc3: drd: use helper to get role-switch-default-mode
Use the new helper usb_get_role_switch_default_mode() to
get property of "role-switch-default-mode"
Signed-off-by: Chunfeng Yun <chunfeng.yun@...iatek.com>
---
v2~3: no changes
---
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 8fcbac10510c..d7f76835137f 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;
--
2.18.0
Powered by blists - more mailing lists