Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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@mediatek.com>
Link: https://lore.kernel.org/r/1626340078-29111-7-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Chunfeng Yun and committed by
Greg Kroah-Hartman
26f94fe8 2037f299

+2 -6
+2 -6
drivers/usb/dwc3/drd.c
··· 541 541 static int dwc3_setup_role_switch(struct dwc3 *dwc) 542 542 { 543 543 struct usb_role_switch_desc dwc3_role_switch = {NULL}; 544 - const char *str; 545 544 u32 mode; 546 - int ret; 547 545 548 - ret = device_property_read_string(dwc->dev, "role-switch-default-mode", 549 - &str); 550 - if (ret >= 0 && !strncmp(str, "host", strlen("host"))) { 551 - dwc->role_switch_default_mode = USB_DR_MODE_HOST; 546 + dwc->role_switch_default_mode = usb_get_role_switch_default_mode(dwc->dev); 547 + if (dwc->role_switch_default_mode == USB_DR_MODE_HOST) { 552 548 mode = DWC3_GCTL_PRTCAP_HOST; 553 549 } else { 554 550 dwc->role_switch_default_mode = USB_DR_MODE_PERIPHERAL;