diff options
author | Alex Elder | 2020-05-04 18:37:11 -0500 |
---|---|---|
committer | David S. Miller | 2020-05-06 17:37:42 -0700 |
commit | 4900bf341d963e9742365cd86bfab78d3d851f39 (patch) | |
tree | 101395c6ace2d0e42f3d9175fca22c08133cf845 /drivers/net/ipa | |
parent | 9c729e7484622b9fb2defa3c640ce141244c0a46 (diff) |
net: ipa: have ipa_endpoint_init_ctrl() return previous state
Change ipa_endpoint_init_ctrl() so it returns the previous state
(whether suspend or delay mode was enabled) rather than indicating
whether the request caused a change in state. This makes it easier
to understand what's happening where called.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ipa')
-rw-r--r-- | drivers/net/ipa/ipa_endpoint.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index db82ae48e402..447165e980ea 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -284,11 +284,12 @@ static struct gsi_trans *ipa_endpoint_trans_alloc(struct ipa_endpoint *endpoint, /* suspend_delay represents suspend for RX, delay for TX endpoints. * Note that suspend is not supported starting with IPA v4.0. */ -static int +static bool ipa_endpoint_init_ctrl(struct ipa_endpoint *endpoint, bool suspend_delay) { u32 offset = IPA_REG_ENDP_INIT_CTRL_N_OFFSET(endpoint->endpoint_id); struct ipa *ipa = endpoint->ipa; + bool state; u32 mask; u32 val; @@ -296,13 +297,14 @@ ipa_endpoint_init_ctrl(struct ipa_endpoint *endpoint, bool suspend_delay) mask = endpoint->toward_ipa ? ENDP_DELAY_FMASK : ENDP_SUSPEND_FMASK; val = ioread32(ipa->reg_virt + offset); - if (suspend_delay == !!(val & mask)) - return -EALREADY; /* Already set to desired state */ - - val ^= mask; - iowrite32(val, ipa->reg_virt + offset); + /* Don't bother if it's already in the requested state */ + state = !!(val & mask); + if (suspend_delay != state) { + val ^= mask; + iowrite32(val, ipa->reg_virt + offset); + } - return 0; + return state; } /* Enable or disable delay or suspend mode on all modem endpoints */ @@ -1164,8 +1166,7 @@ static int ipa_endpoint_reset_rx_aggr(struct ipa_endpoint *endpoint) /* Make sure the channel isn't suspended */ if (endpoint->ipa->version == IPA_VERSION_3_5_1) - if (!ipa_endpoint_init_ctrl(endpoint, false)) - endpoint_suspended = true; + endpoint_suspended = ipa_endpoint_init_ctrl(endpoint, false); /* Start channel and do a 1 byte read */ ret = gsi_channel_start(gsi, endpoint->channel_id); @@ -1318,21 +1319,20 @@ static void ipa_endpoint_program(struct ipa_endpoint *endpoint) if (endpoint->toward_ipa) { bool delay_mode = endpoint->data->tx.delay; - ret = ipa_endpoint_init_ctrl(endpoint, delay_mode); /* Endpoint is expected to not be in delay mode */ - if (!ret != delay_mode) { + if (ipa_endpoint_init_ctrl(endpoint, delay_mode)) dev_warn(dev, "TX endpoint %u was %sin delay mode\n", endpoint->endpoint_id, delay_mode ? "already " : ""); - } ipa_endpoint_init_hdr_ext(endpoint); ipa_endpoint_init_aggr(endpoint); ipa_endpoint_init_deaggr(endpoint); ipa_endpoint_init_seq(endpoint); } else { + /* Endpoint is expected to not be suspended */ if (endpoint->ipa->version == IPA_VERSION_3_5_1) { - if (!ipa_endpoint_init_ctrl(endpoint, false)) + if (ipa_endpoint_init_ctrl(endpoint, false)) dev_warn(dev, "RX endpoint %u was suspended\n", endpoint->endpoint_id); @@ -1471,7 +1471,7 @@ void ipa_endpoint_resume_one(struct ipa_endpoint *endpoint) /* IPA v3.5.1 doesn't use channel start for resume */ start_channel = endpoint->ipa->version != IPA_VERSION_3_5_1; if (!endpoint->toward_ipa && !start_channel) - WARN_ON(ipa_endpoint_init_ctrl(endpoint, false)); + WARN_ON(!ipa_endpoint_init_ctrl(endpoint, false)); ret = gsi_channel_resume(gsi, endpoint->channel_id, start_channel); if (ret) |