Commit a40d3e42 authored by Kalle Valo's avatar Kalle Valo

ath10k: clean up ath10k_ce_completed_send_next_nolock()

The error handling was just weird, simplify it.
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent e479ed43
...@@ -594,8 +594,8 @@ static int ath10k_ce_completed_send_next_nolock(struct ath10k_ce_pipe *ce_state, ...@@ -594,8 +594,8 @@ static int ath10k_ce_completed_send_next_nolock(struct ath10k_ce_pipe *ce_state,
struct ath10k *ar = ce_state->ar; struct ath10k *ar = ce_state->ar;
unsigned int nentries_mask = src_ring->nentries_mask; unsigned int nentries_mask = src_ring->nentries_mask;
unsigned int sw_index = src_ring->sw_index; unsigned int sw_index = src_ring->sw_index;
struct ce_desc *sdesc, *sbase;
unsigned int read_index; unsigned int read_index;
int ret = -EIO;
if (src_ring->hw_index == sw_index) { if (src_ring->hw_index == sw_index) {
/* /*
...@@ -611,32 +611,33 @@ static int ath10k_ce_completed_send_next_nolock(struct ath10k_ce_pipe *ce_state, ...@@ -611,32 +611,33 @@ static int ath10k_ce_completed_send_next_nolock(struct ath10k_ce_pipe *ce_state,
src_ring->hw_index &= nentries_mask; src_ring->hw_index &= nentries_mask;
ath10k_pci_sleep(ar); ath10k_pci_sleep(ar);
} }
read_index = src_ring->hw_index; read_index = src_ring->hw_index;
if ((read_index != sw_index) && (read_index != 0xffffffff)) { if ((read_index == sw_index) || (read_index == 0xffffffff))
struct ce_desc *sbase = src_ring->shadow_base; return -EIO;
struct ce_desc *sdesc = CE_SRC_RING_TO_DESC(sbase, sw_index);
/* Return data from completed source descriptor */ sbase = src_ring->shadow_base;
*bufferp = __le32_to_cpu(sdesc->addr); sdesc = CE_SRC_RING_TO_DESC(sbase, sw_index);
*nbytesp = __le16_to_cpu(sdesc->nbytes);
*transfer_idp = MS(__le16_to_cpu(sdesc->flags),
CE_DESC_FLAGS_META_DATA);
if (per_transfer_contextp) /* Return data from completed source descriptor */
*per_transfer_contextp = *bufferp = __le32_to_cpu(sdesc->addr);
src_ring->per_transfer_context[sw_index]; *nbytesp = __le16_to_cpu(sdesc->nbytes);
*transfer_idp = MS(__le16_to_cpu(sdesc->flags),
CE_DESC_FLAGS_META_DATA);
/* sanity */ if (per_transfer_contextp)
src_ring->per_transfer_context[sw_index] = NULL; *per_transfer_contextp =
src_ring->per_transfer_context[sw_index];
/* Update sw_index */ /* sanity */
sw_index = CE_RING_IDX_INCR(nentries_mask, sw_index); src_ring->per_transfer_context[sw_index] = NULL;
src_ring->sw_index = sw_index;
ret = 0;
}
return ret; /* Update sw_index */
sw_index = CE_RING_IDX_INCR(nentries_mask, sw_index);
src_ring->sw_index = sw_index;
return 0;
} }
/* NB: Modeled after ath10k_ce_completed_send_next */ /* NB: Modeled after ath10k_ce_completed_send_next */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment