net: ipa: pass channel pointer to gsi_channel_state()
authorAlex Elder <elder@linaro.org>
Thu, 30 Apr 2020 22:13:22 +0000 (17:13 -0500)
committerDavid S. Miller <davem@davemloft.net>
Fri, 1 May 2020 22:53:33 +0000 (15:53 -0700)
Pass a channel pointer rather than a GSI pointer and channel ID to
gsi_channel_state().

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ipa/gsi.c

index 845478a19a4f46b30fd448f8b852a5ae5bb2e8c2..6946c39b664ac64dfc01bdcd71f8b06221c4c1f5 100644 (file)
@@ -416,12 +416,13 @@ static void gsi_evt_ring_de_alloc_command(struct gsi *gsi, u32 evt_ring_id)
 }
 
 /* Return the hardware's notion of the current state of a channel */
-static enum gsi_channel_state
-gsi_channel_state(struct gsi *gsi, u32 channel_id)
+static enum gsi_channel_state gsi_channel_state(struct gsi_channel *channel)
 {
+       u32 channel_id = gsi_channel_id(channel);
+       void *virt = channel->gsi->virt;
        u32 val;
 
-       val = ioread32(gsi->virt + GSI_CH_C_CNTXT_0_OFFSET(channel_id));
+       val = ioread32(virt + GSI_CH_C_CNTXT_0_OFFSET(channel_id));
 
        return u32_get_bits(val, CHSTATE_FMASK);
 }
@@ -453,7 +454,7 @@ static int gsi_channel_alloc_command(struct gsi *gsi, u32 channel_id)
        int ret;
 
        /* Get initial channel state */
-       channel->state = gsi_channel_state(gsi, channel_id);
+       channel->state = gsi_channel_state(channel);
 
        if (channel->state != GSI_CHANNEL_STATE_NOT_ALLOCATED)
                return -EINVAL;
@@ -940,7 +941,7 @@ static void gsi_isr_chan_ctrl(struct gsi *gsi)
                channel_mask ^= BIT(channel_id);
 
                channel = &gsi->channel[channel_id];
-               channel->state = gsi_channel_state(gsi, channel_id);
+               channel->state = gsi_channel_state(channel);
 
                complete(&channel->completion);
        }