summaryrefslogtreecommitdiff
path: root/drivers/net/ipa/gsi_trans.c
diff options
context:
space:
mode:
authorAlex Elder <elder@linaro.org>2022-09-02 16:02:13 -0500
committerDavid S. Miller <davem@davemloft.net>2022-09-05 12:47:01 +0100
commitb2abe33d23cfaea6cd3f8335a1ee08c480512c6f (patch)
treef575eb1f75ac9e96e986ab188a729bc6d3df793e /drivers/net/ipa/gsi_trans.c
parent599566c1c369205286b1a22e1b3c2e9dea0e3744 (diff)
net: ipa: rework last transaction determination
When quiescing a channel, we find the "last" transaction, which is the latest one to have been allocated. (New transaction allocation will have been prevented by the time this is called.) Currently we do this by looking for the first non-empty transaction list in each state, then return the last entry from that last. Instead, determine the last entry in each list (if any) and return that entry if found. Temporarily (locally) introduce list_last_entry_or_null() as a helper for this, mirroring list_first_entry_or_null(). This macro definition will be removed by an upcoming patch. Remove the temporary warnings added by the previous commit. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ipa/gsi_trans.c')
-rw-r--r--drivers/net/ipa/gsi_trans.c22
1 files changed, 0 insertions, 22 deletions
diff --git a/drivers/net/ipa/gsi_trans.c b/drivers/net/ipa/gsi_trans.c
index 4eef1480c200..b4a6f2b56356 100644
--- a/drivers/net/ipa/gsi_trans.c
+++ b/drivers/net/ipa/gsi_trans.c
@@ -309,23 +309,15 @@ void gsi_trans_move_polled(struct gsi_trans *trans)
{
struct gsi_channel *channel = &trans->gsi->channel[trans->channel_id];
struct gsi_trans_info *trans_info = &channel->trans_info;
- u16 trans_index;
spin_lock_bh(&trans_info->spinlock);
list_move_tail(&trans->links, &trans_info->polled);
- trans = list_first_entry(&trans_info->polled,
- struct gsi_trans, links);
-
spin_unlock_bh(&trans_info->spinlock);
/* This completed transaction is now polled */
trans_info->completed_id++;
-
- WARN_ON(trans_info->polled_id == trans_info->completed_id);
- trans_index = trans_info->polled_id % channel->tre_count;
- WARN_ON(trans != &trans_info->trans[trans_index]);
}
/* Reserve some number of TREs on a channel. Returns true if successful */
@@ -413,11 +405,8 @@ struct gsi_trans *gsi_channel_trans_alloc(struct gsi *gsi, u32 channel_id,
/* Free a previously-allocated transaction */
void gsi_trans_free(struct gsi_trans *trans)
{
- struct gsi_channel *channel = &trans->gsi->channel[trans->channel_id];
refcount_t *refcount = &trans->refcount;
struct gsi_trans_info *trans_info;
- struct gsi_trans *polled;
- u16 trans_index;
bool last;
/* We must hold the lock to release the last reference */
@@ -433,9 +422,6 @@ void gsi_trans_free(struct gsi_trans *trans)
if (last)
list_del(&trans->links);
- polled = list_first_entry_or_null(&trans_info->polled,
- struct gsi_trans, links);
-
spin_unlock_bh(&trans_info->spinlock);
if (!last)
@@ -456,14 +442,6 @@ void gsi_trans_free(struct gsi_trans *trans)
/* This transaction is now free */
trans_info->polled_id++;
- if (polled) {
- trans_index = trans_info->polled_id % channel->tre_count;
- WARN_ON(polled != &trans_info->trans[trans_index]);
- } else {
- WARN_ON(trans_info->polled_id !=
- trans_info->completed_id);
- }
-
/* Releasing the reserved TREs implicitly frees the sgl[] and
* (if present) info[] arrays, plus the transaction itself.
*/