Skip to content

Commit ab7aa28

Browse files
svenpeter42gregkh
authored andcommitted
usb: dwc3: Try usb-role-switch first in dwc3_drd_init
If the PHY controller node has a "port" dwc3 tries to find an extcon device even when "usb-role-switch" is present. This happens because dwc3_get_extcon() sees that "port" node and then calls extcon_find_edev_by_node() which will always return EPROBE_DEFER in that case. On the other hand, even if an extcon was present and dwc3_get_extcon() was successful it would still be ignored in favor of "usb-role-switch". Let's just first check if "usb-role-switch" is configured in the device tree and directly use it instead and only try to look for an extcon device otherwise. Fixes: 8a0a137 ("usb: dwc3: Registering a role switch in the DRD code.") Cc: stable <[email protected]> Signed-off-by: Sven Peter <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent f28ad90 commit ab7aa28

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

drivers/usb/dwc3/drd.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -584,16 +584,15 @@ int dwc3_drd_init(struct dwc3 *dwc)
584584
{
585585
int ret, irq;
586586

587+
if (ROLE_SWITCH &&
588+
device_property_read_bool(dwc->dev, "usb-role-switch"))
589+
return dwc3_setup_role_switch(dwc);
590+
587591
dwc->edev = dwc3_get_extcon(dwc);
588592
if (IS_ERR(dwc->edev))
589593
return PTR_ERR(dwc->edev);
590594

591-
if (ROLE_SWITCH &&
592-
device_property_read_bool(dwc->dev, "usb-role-switch")) {
593-
ret = dwc3_setup_role_switch(dwc);
594-
if (ret < 0)
595-
return ret;
596-
} else if (dwc->edev) {
595+
if (dwc->edev) {
597596
dwc->edev_nb.notifier_call = dwc3_drd_notifier;
598597
ret = extcon_register_notifier(dwc->edev, EXTCON_USB_HOST,
599598
&dwc->edev_nb);

0 commit comments

Comments
 (0)