From: Li Jun Date: Fri, 28 Jul 2017 10:01:06 +0000 (+0800) Subject: MLK-16013-35 staging: typec: Move to SRC_ATTACHED if condition is met X-Git-Tag: C0P2-H0.0--20200415~1898 X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=dae56a931a44b3542b83ec672be02563f3bff3d1;p=linux.git MLK-16013-35 staging: typec: Move to SRC_ATTACHED if condition is met If the other end is trying to be a sink and not driving vbus, we should move to SRC_ATTACHED directly. Reviewed-by: Peter Chen Signed-off-by: Li Jun --- diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c index 3a70f70a43f2..aa2206fe4577 100644 --- a/drivers/staging/typec/tcpm.c +++ b/drivers/staging/typec/tcpm.c @@ -2904,11 +2904,8 @@ static void _tcpm_cc_change(struct tcpm_port *port, enum typec_cc_status cc1, case SRC_TRYWAIT: /* Hand over to state machine if needed */ if (!port->vbus_present && tcpm_port_is_source(port)) - new_state = SRC_ATTACHED; - else - new_state = SRC_TRYWAIT_UNATTACHED; - - if (new_state != port->delayed_state) + tcpm_set_state(port, SRC_ATTACHED, 0); + else if (port->delayed_state != SRC_TRYWAIT_UNATTACHED) tcpm_set_state(port, SRC_TRYWAIT, 0); break; case SNK_TRY_WAIT: