@@ -1024,8 +1024,7 @@ static int xhci_invalidate_cancelled_tds(struct xhci_virt_ep *ep)
1024
1024
td -> urb -> stream_id );
1025
1025
hw_deq &= ~0xf ;
1026
1026
1027
- if (td -> cancel_status == TD_HALTED ||
1028
- trb_in_td (xhci , td -> start_seg , td -> first_trb , td -> last_trb , hw_deq , false)) {
1027
+ if (td -> cancel_status == TD_HALTED || trb_in_td (xhci , td , hw_deq , false)) {
1029
1028
switch (td -> cancel_status ) {
1030
1029
case TD_CLEARED : /* TD is already no-op */
1031
1030
case TD_CLEARING_CACHE : /* set TR deq command already queued */
@@ -1082,8 +1081,7 @@ static struct xhci_td *find_halted_td(struct xhci_virt_ep *ep)
1082
1081
hw_deq = xhci_get_hw_deq (ep -> xhci , ep -> vdev , ep -> ep_index , 0 );
1083
1082
hw_deq &= ~0xf ;
1084
1083
td = list_first_entry (& ep -> ring -> td_list , struct xhci_td , td_list );
1085
- if (trb_in_td (ep -> xhci , td -> start_seg , td -> first_trb ,
1086
- td -> last_trb , hw_deq , false))
1084
+ if (trb_in_td (ep -> xhci , td , hw_deq , false))
1087
1085
return td ;
1088
1086
}
1089
1087
return NULL ;
@@ -2049,25 +2047,19 @@ static void handle_port_status(struct xhci_hcd *xhci,
2049
2047
}
2050
2048
2051
2049
/*
2052
- * This TD is defined by the TRBs starting at start_trb in start_seg and ending
2053
- * at end_trb, which may be in another segment. If the suspect DMA address is a
2054
- * TRB in this TD, this function returns that TRB's segment. Otherwise it
2055
- * returns 0.
2050
+ * If the suspect DMA address is a TRB in this TD, this function returns that
2051
+ * TRB's segment. Otherwise it returns 0.
2056
2052
*/
2057
- struct xhci_segment * trb_in_td (struct xhci_hcd * xhci ,
2058
- struct xhci_segment * start_seg ,
2059
- union xhci_trb * start_trb ,
2060
- union xhci_trb * end_trb ,
2061
- dma_addr_t suspect_dma ,
2062
- bool debug )
2053
+ struct xhci_segment * trb_in_td (struct xhci_hcd * xhci , struct xhci_td * td , dma_addr_t suspect_dma ,
2054
+ bool debug )
2063
2055
{
2064
2056
dma_addr_t start_dma ;
2065
2057
dma_addr_t end_seg_dma ;
2066
2058
dma_addr_t end_trb_dma ;
2067
2059
struct xhci_segment * cur_seg ;
2068
2060
2069
- start_dma = xhci_trb_virt_to_dma (start_seg , start_trb );
2070
- cur_seg = start_seg ;
2061
+ start_dma = xhci_trb_virt_to_dma (td -> start_seg , td -> first_trb );
2062
+ cur_seg = td -> start_seg ;
2071
2063
2072
2064
do {
2073
2065
if (start_dma == 0 )
@@ -2076,7 +2068,7 @@ struct xhci_segment *trb_in_td(struct xhci_hcd *xhci,
2076
2068
end_seg_dma = xhci_trb_virt_to_dma (cur_seg ,
2077
2069
& cur_seg -> trbs [TRBS_PER_SEGMENT - 1 ]);
2078
2070
/* If the end TRB isn't in this segment, this is set to 0 */
2079
- end_trb_dma = xhci_trb_virt_to_dma (cur_seg , end_trb );
2071
+ end_trb_dma = xhci_trb_virt_to_dma (cur_seg , td -> last_trb );
2080
2072
2081
2073
if (debug )
2082
2074
xhci_warn (xhci ,
@@ -2110,7 +2102,7 @@ struct xhci_segment *trb_in_td(struct xhci_hcd *xhci,
2110
2102
}
2111
2103
cur_seg = cur_seg -> next ;
2112
2104
start_dma = xhci_trb_virt_to_dma (cur_seg , & cur_seg -> trbs [0 ]);
2113
- } while (cur_seg != start_seg );
2105
+ } while (cur_seg != td -> start_seg );
2114
2106
2115
2107
return NULL ;
2116
2108
}
@@ -2822,8 +2814,7 @@ static int handle_tx_event(struct xhci_hcd *xhci,
2822
2814
td_num -- ;
2823
2815
2824
2816
/* Is this a TRB in the currently executing TD? */
2825
- ep_seg = trb_in_td (xhci , td -> start_seg , td -> first_trb ,
2826
- td -> last_trb , ep_trb_dma , false);
2817
+ ep_seg = trb_in_td (xhci , td , ep_trb_dma , false);
2827
2818
2828
2819
/*
2829
2820
* Skip the Force Stopped Event. The event_trb(event_dma) of FSE
@@ -2870,8 +2861,7 @@ static int handle_tx_event(struct xhci_hcd *xhci,
2870
2861
!list_is_last (& td -> td_list , & ep_ring -> td_list )) {
2871
2862
struct xhci_td * td_next = list_next_entry (td , td_list );
2872
2863
2873
- ep_seg = trb_in_td (xhci , td_next -> start_seg , td_next -> first_trb ,
2874
- td_next -> last_trb , ep_trb_dma , false);
2864
+ ep_seg = trb_in_td (xhci , td_next , ep_trb_dma , false);
2875
2865
if (ep_seg ) {
2876
2866
/* give back previous TD, start handling new */
2877
2867
xhci_dbg (xhci , "Missing TD completion event after mid TD error\n" );
@@ -2890,8 +2880,8 @@ static int handle_tx_event(struct xhci_hcd *xhci,
2890
2880
"part of current TD ep_index %d "
2891
2881
"comp_code %u\n" , ep_index ,
2892
2882
trb_comp_code );
2893
- trb_in_td (xhci , td -> start_seg , td -> first_trb ,
2894
- td -> last_trb , ep_trb_dma , true);
2883
+ trb_in_td (xhci , td , ep_trb_dma , true);
2884
+
2895
2885
return - ESHUTDOWN ;
2896
2886
}
2897
2887
}
0 commit comments