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

Revert "usb: common: usb-conn-gpio: Set last role to unknown before initial detection"

This reverts commit edd60d24bd858cef165274e4cd6cab43bdc58d15.

Heikki reports that this should not be a global flag just to work around
one broken driver and should be fixed differently, so revert it.

Reported-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Fixes: edd60d24bd85 ("usb: common: usb-conn-gpio: Set last role to unknown before initial detection")
Link: https://lore.kernel.org/r/ZImE4L3YgABnCIsP@kuha.fi.intel.com
Cc: Prashanth K <quic_prashk@quicinc.com>
Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

-10
-2
drivers/usb/cdns3/core.c
··· 252 252 if (!vbus) 253 253 role = USB_ROLE_NONE; 254 254 break; 255 - default: 256 - break; 257 255 } 258 256 259 257 dev_dbg(cdns->dev, "role %d -> %d\n", cdns->role, role);
-3
drivers/usb/common/usb-conn-gpio.c
··· 257 257 platform_set_drvdata(pdev, info); 258 258 device_set_wakeup_capable(&pdev->dev, true); 259 259 260 - /* Set last role to unknown before performing the initial detection */ 261 - info->last_role = USB_ROLE_UNKNOWN; 262 - 263 260 /* Perform initial detection */ 264 261 usb_conn_queue_dwork(info, 0); 265 262
-2
drivers/usb/musb/jz4740.c
··· 95 95 case USB_ROLE_HOST: 96 96 atomic_notifier_call_chain(&phy->notifier, USB_EVENT_ID, phy); 97 97 break; 98 - default: 99 - break; 100 98 } 101 99 102 100 return 0;
-2
drivers/usb/roles/intel-xhci-usb-role-switch.c
··· 97 97 val |= SW_VBUS_VALID; 98 98 drd_config = DRD_CONFIG_STATIC_DEVICE; 99 99 break; 100 - default: 101 - break; 102 100 } 103 101 val |= SW_IDPIN_EN; 104 102 if (data->enable_sw_switch) {
-1
include/linux/usb/role.h
··· 11 11 USB_ROLE_NONE, 12 12 USB_ROLE_HOST, 13 13 USB_ROLE_DEVICE, 14 - USB_ROLE_UNKNOWN, 15 14 }; 16 15 17 16 typedef int (*usb_role_switch_set_t)(struct usb_role_switch *sw,