summaryrefslogtreecommitdiff
path: root/drivers/net/ipa/ipa_endpoint.c
diff options
context:
space:
mode:
authorAlex Elder <elder@linaro.org>2022-10-27 15:26:32 +0300
committerJakub Kicinski <kuba@kernel.org>2022-10-29 08:06:48 +0300
commitb7aaff0b010ede619bdea22118d4a2f9aa966867 (patch)
tree5f75414aab52e7c77f64ab8c5b420e67bb42f009 /drivers/net/ipa/ipa_endpoint.c
parent5274c7158b2b6661f43883617ce638200312412b (diff)
downloadlinux-b7aaff0b010ede619bdea22118d4a2f9aa966867.tar.xz
net: ipa: record and use the number of defined endpoint IDs
Define a new field in the IPA structure that records the maximum number of entries that will be used in the IPA endpoint array. Use that value rather than IPA_ENDPOINT_MAX to determine the end condition for two loops that iterate over all endpoints. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/ipa/ipa_endpoint.c')
-rw-r--r--drivers/net/ipa/ipa_endpoint.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c
index 9fd72ba149af..2a6184ea8f5c 100644
--- a/drivers/net/ipa/ipa_endpoint.c
+++ b/drivers/net/ipa/ipa_endpoint.c
@@ -433,7 +433,7 @@ void ipa_endpoint_modem_pause_all(struct ipa *ipa, bool enable)
{
u32 endpoint_id = 0;
- while (endpoint_id < IPA_ENDPOINT_MAX) {
+ while (endpoint_id < ipa->endpoint_count) {
struct ipa_endpoint *endpoint = &ipa->endpoint[endpoint_id++];
if (endpoint->ee_id != GSI_EE_MODEM)
@@ -1015,7 +1015,7 @@ void ipa_endpoint_modem_hol_block_clear_all(struct ipa *ipa)
{
u32 endpoint_id = 0;
- while (endpoint_id < IPA_ENDPOINT_MAX) {
+ while (endpoint_id < ipa->endpoint_count) {
struct ipa_endpoint *endpoint = &ipa->endpoint[endpoint_id++];
if (endpoint->toward_ipa || endpoint->ee_id != GSI_EE_MODEM)
@@ -1982,7 +1982,9 @@ u32 ipa_endpoint_init(struct ipa *ipa, u32 count,
BUILD_BUG_ON(!IPA_REPLENISH_BATCH);
- if (!ipa_endpoint_max(ipa, count, data))
+ /* Number of endpoints is one more than the maximum ID */
+ ipa->endpoint_count = ipa_endpoint_max(ipa, count, data) + 1;
+ if (!ipa->endpoint_count)
return 0; /* Error */
ipa->defined = 0;