@@ -289,12 +289,11 @@ void pe_snk_select_capability_run(void *obj)
289289 }
290290
291291 pe_set_state (dev , PE_SNK_READY );
292- }
293- /*
294- * No previous explicit contract, so transition
295- * to PE_SNK_Wait_For_Capabilities
296- */
297- else {
292+ } else {
293+ /*
294+ * No previous explicit contract, so transition
295+ * to PE_SNK_Wait_For_Capabilities
296+ */
298297 pe_set_state (dev , PE_SNK_WAIT_FOR_CAPABILITIES );
299298 }
300299 } else {
@@ -426,9 +425,8 @@ void pe_snk_ready_run(void *obj)
426425 if (header .extended ) {
427426 extended_message_not_supported (dev );
428427 return ;
429- }
430- /* Data Messages */
431- else if (header .number_of_data_objects > 0 ) {
428+ } else if (header .number_of_data_objects > 0 ) {
429+ /* Data Messages */
432430 switch (header .message_type ) {
433431 case PD_DATA_SOURCE_CAP :
434432 pe_set_state (dev , PE_SNK_EVALUATE_CAPABILITY );
@@ -437,9 +435,8 @@ void pe_snk_ready_run(void *obj)
437435 pe_set_state (dev , PE_SEND_NOT_SUPPORTED );
438436 }
439437 return ;
440- }
441- /* Control Messages */
442- else {
438+ } else {
439+ /* Control Messages */
443440 switch (header .message_type ) {
444441 case PD_CTRL_GOOD_CRC :
445442 /* Do nothing */
@@ -632,25 +629,23 @@ void pe_snk_get_source_cap_run(void *obj)
632629 if (atomic_test_and_clear_bit (pe -> flags , PE_FLAGS_TX_COMPLETE )) {
633630 /* The Policy Engine Shall then start the SenderResponseTimer. */
634631 usbc_timer_start (& pe -> pd_t_sender_response );
635- }
636- /*
637- * The Policy Engine Shall transition to the PE_SNK_Evaluate_Capability
638- * State when:
639- * 1: In SPR Mode and SPR Source Capabilities were requested and
640- * a Source_Capabilities Message is received
641- */
642- else if (atomic_test_and_clear_bit (pe -> flags , PE_FLAGS_MSG_RECEIVED )) {
632+ } else if (atomic_test_and_clear_bit (pe -> flags , PE_FLAGS_MSG_RECEIVED )) {
633+ /*
634+ * The Policy Engine Shall transition to the PE_SNK_Evaluate_Capability
635+ * State when:
636+ * 1: In SPR Mode and SPR Source Capabilities were requested and
637+ * a Source_Capabilities Message is received
638+ */
643639 header = prl_rx -> emsg .header ;
644640
645641 if (received_control_message (dev , header , PD_DATA_SOURCE_CAP )) {
646642 pe_set_state (dev , PE_SNK_EVALUATE_CAPABILITY );
647643 }
648- }
649- /*
650- * The Policy Engine Shall transition to the PE_SNK_Ready state when:
651- * 1: The SenderResponseTimer times out.
652- */
653- else if (usbc_timer_expired (& pe -> pd_t_sender_response )) {
644+ } else if (usbc_timer_expired (& pe -> pd_t_sender_response )) {
645+ /*
646+ * The Policy Engine Shall transition to the PE_SNK_Ready state when:
647+ * 1: The SenderResponseTimer times out.
648+ */
654649 pe_set_state (dev , PE_SNK_READY );
655650 /* Inform the DPM of the sender response timeout */
656651 policy_notify (dev , SENDER_RESPONSE_TIMEOUT );
@@ -710,26 +705,24 @@ void pe_send_soft_reset_run(void *obj)
710705 } else if (atomic_test_and_clear_bit (pe -> flags , PE_FLAGS_TX_COMPLETE )) {
711706 /* Start SenderResponse timer */
712707 usbc_timer_start (& pe -> pd_t_sender_response );
713- }
714- /*
715- * The Policy Engine Shall transition to the PE_SNK_Wait_for_Capabilities
716- * state when:
717- * 1: An Accept Message has been received on SOP
718- */
719- else if (atomic_test_and_clear_bit (pe -> flags , PE_FLAGS_MSG_RECEIVED )) {
708+ } else if (atomic_test_and_clear_bit (pe -> flags , PE_FLAGS_MSG_RECEIVED )) {
709+ /*
710+ * The Policy Engine Shall transition to the PE_SNK_Wait_for_Capabilities
711+ * state when:
712+ * 1: An Accept Message has been received on SOP
713+ */
720714 header = prl_rx -> emsg .header ;
721715
722716 if (received_control_message (dev , header , PD_CTRL_ACCEPT )) {
723717 pe_set_state (dev , PE_SNK_WAIT_FOR_CAPABILITIES );
724718 }
725- }
726- /*
727- * The Policy Engine Shall transition to the PE_SNK_Hard_Reset state when:
728- * 1: A SenderResponseTimer timeout occurs
729- * 2: Or the Protocol Layer indicates that a transmission error has occurred
730- */
731- else if (usbc_timer_expired (& pe -> pd_t_sender_response ) ||
732- atomic_test_and_clear_bit (pe -> flags , PE_FLAGS_PROTOCOL_ERROR )) {
719+ } else if (usbc_timer_expired (& pe -> pd_t_sender_response ) ||
720+ atomic_test_and_clear_bit (pe -> flags , PE_FLAGS_PROTOCOL_ERROR )) {
721+ /*
722+ * The Policy Engine Shall transition to the PE_SNK_Hard_Reset state when:
723+ * 1: A SenderResponseTimer timeout occurs
724+ * 2: Or the Protocol Layer indicates that a transmission error has occurred
725+ */
733726 pe_set_state (dev , PE_SNK_HARD_RESET );
734727 }
735728}
@@ -775,22 +768,20 @@ void pe_soft_reset_run(void *obj)
775768 if (atomic_test_and_clear_bit (pe -> flags , PE_FLAGS_SEND_SOFT_RESET )) {
776769 /* Send Accept message */
777770 pe_send_ctrl_msg (dev , PD_PACKET_SOP , PD_CTRL_ACCEPT );
778- }
779- /*
780- * The Policy Engine Shall transition to the PE_SNK_Wait_for_Capabilities
781- * state when:
782- * 1: The Accept Message has been sent on SOP.
783- */
784- else if (atomic_test_and_clear_bit (pe -> flags , PE_FLAGS_TX_COMPLETE )) {
771+ } else if (atomic_test_and_clear_bit (pe -> flags , PE_FLAGS_TX_COMPLETE )) {
772+ /*
773+ * The Policy Engine Shall transition to the PE_SNK_Wait_for_Capabilities
774+ * state when:
775+ * 1: The Accept Message has been sent on SOP.
776+ */
785777 pe_set_state (dev , PE_SNK_WAIT_FOR_CAPABILITIES );
786- }
787- /*
788- * The Policy Engine Shall transition to the PE_SNK_Hard_Reset
789- * state when:
790- * 1: The Protocol Layer indicates that a transmission error
791- * has occurred.
792- */
793- else if (atomic_test_and_clear_bit (pe -> flags , PE_FLAGS_PROTOCOL_ERROR )) {
778+ } else if (atomic_test_and_clear_bit (pe -> flags , PE_FLAGS_PROTOCOL_ERROR )) {
779+ /*
780+ * The Policy Engine Shall transition to the PE_SNK_Hard_Reset
781+ * state when:
782+ * 1: The Protocol Layer indicates that a transmission error
783+ * has occurred.
784+ */
794785 pe_set_state (dev , PE_SNK_HARD_RESET );
795786 }
796787}
0 commit comments