aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/chipidea/core.c
diff options
context:
space:
mode:
authorJun Li <jun.li@nxp.com>2020-01-22 01:46:59 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-01-22 07:54:26 +0100
commit27bf5be8fbe0b60b1f1aa13083198dac64fc4249 (patch)
treeb594686380ef4cc7ce43751ec6e2653737e0f424 /drivers/usb/chipidea/core.c
parentusb: musb: fix spelling mistake: "periperal" -> "peripheral" (diff)
downloadlinux-dev-27bf5be8fbe0b60b1f1aa13083198dac64fc4249.tar.xz
linux-dev-27bf5be8fbe0b60b1f1aa13083198dac64fc4249.zip
usb: chipidea: handle single role for usb role class
If usb port is configed to be single role, but usb role class is trying to set unavailable role, don't try to do role change. Signed-off-by: Jun Li <jun.li@nxp.com> Signed-off-by: Peter Chen <peter.chen@nxp.com> Link: https://lore.kernel.org/r/20200122014639.22667-2-peter.chen@nxp.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/chipidea/core.c')
-rw-r--r--drivers/usb/chipidea/core.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index dce5db41501c..52139c2a9924 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -618,9 +618,11 @@ static int ci_usb_role_switch_set(struct device *dev, enum usb_role role)
struct ci_hdrc *ci = dev_get_drvdata(dev);
struct ci_hdrc_cable *cable = NULL;
enum usb_role current_role = ci_role_to_usb_role(ci);
+ enum ci_role ci_role = usb_role_to_ci_role(role);
unsigned long flags;
- if (current_role == role)
+ if ((ci_role != CI_ROLE_END && !ci->roles[ci_role]) ||
+ (current_role == role))
return 0;
pm_runtime_get_sync(ci->dev);