Skip to contentSkip to conversation

usb: typec: tcpm: Clear send_discover in tcpm_check_send_discover

PATCH In review Badhri Jagan Sridharan 3 participants 3 messages Dec 3, 2020 – Dec 8, 2020

Subsystems (3)
lore
Share & tools
lore

Badhri Jagan Sridharan

author maintainer
#0 lore raw

PATCH 1/1 usb: typec: tcpm: Clear send_discover in tcpm_check_send_discover

tcpm_check_send_discover does not clear the send_discover flag when any of the following conditions are not met.
1. data_role is TYPEC_HOST
2. link is pd_capable

Discovery indentity would anyways not be attempted during the current session anymore when the above conditions are not met. Hence clear the send_discover flag here to prevent tcpm_enable_frs_work from rescheduling indefinetly.

---
 drivers/usb/typec/tcpm/tcpm.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/usb/typec/tcpm/tcpm.c +2 -3
index 3bbc1f10af49..012135ade7b1 100644
@@ -3035,10 +3035,9 @@ static inline enum tcpm_state unattached_state(struct tcpm_port *port)
 static void tcpm_check_send_discover(struct tcpm_port *port)
 {
 	if (port->data_role == TYPEC_HOST && port->send_discover &&
-	    port->pd_capable) {
+	    port->pd_capable)
 		tcpm_send_vdm(port, USB_SID_PD, CMD_DISCOVER_IDENT, NULL, 0);
-		port->send_discover = false;
-	}
+	port->send_discover = false;
 }
 
 static void tcpm_swap_complete(struct tcpm_port *port, int result)
Signature · 1 line
2.29.2.576.ga3fc446d84-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Badhri Jagan Sridharan

tcpm_check_send_discover does not clear the send_discover flag when any of the following conditions are not met.
1. data_role is TYPEC_HOST
2. link is pd_capable

Discovery indentity would anyways not be attempted during the current session anymore when the above conditions are not met. Hence clear the send_discover flag here to prevent tcpm_enable_frs_work from rescheduling indefinetly.

Quoted 24 lines
---
 drivers/usb/typec/tcpm/tcpm.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/usb/typec/tcpm/tcpm.c +2 -3
index 3bbc1f10af49..012135ade7b1 100644
@@ -3035,10 +3035,9 @@ static inline enum tcpm_state unattached_state(struct tcpm_port *port)
 static void tcpm_check_send_discover(struct tcpm_port *port)
 {
 	if (port->data_role == TYPEC_HOST && port->send_discover &&
-	    port->pd_capable) {
+	    port->pd_capable)
 		tcpm_send_vdm(port, USB_SID_PD, CMD_DISCOVER_IDENT, NULL, 0);
-		port->send_discover = false;
-	}
+	port->send_discover = false;
 }
 
 static void tcpm_swap_complete(struct tcpm_port *port, int result)
Signature · 1 line
2.29.2.576.ga3fc446d84-goog
maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Badhri Jagan Sridharan
Quoted 11 lines · Badhri Jagan Sridharan

tcpm_check_send_discover does not clear the send_discover flag when any of the following conditions are not met.
1. data_role is TYPEC_HOST
2. link is pd_capable

Discovery indentity would anyways not be attempted during the current session anymore when the above conditions are not met. Hence clear the send_discover flag here to prevent tcpm_enable_frs_work from rescheduling indefinetly.

Quoted 23 lines
---
 drivers/usb/typec/tcpm/tcpm.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/usb/typec/tcpm/tcpm.c +2 -3
index 3bbc1f10af49..012135ade7b1 100644
@@ -3035,10 +3035,9 @@ static inline enum tcpm_state unattached_state(struct tcpm_port *port)
 static void tcpm_check_send_discover(struct tcpm_port *port)
 {
 	if (port->data_role == TYPEC_HOST && port->send_discover &&
-	    port->pd_capable) {
+	    port->pd_capable)
 		tcpm_send_vdm(port, USB_SID_PD, CMD_DISCOVER_IDENT, NULL, 0);
-		port->send_discover = false;
-	}
+	port->send_discover = false;
 }
 
 static void tcpm_swap_complete(struct tcpm_port *port, int result)
Signature · 1 line
2.29.2.576.ga3fc446d84-goog
Signature · 1 line
heikki