Commit 07c525a6 authored by Alex Elder's avatar Alex Elder Committed by David S. Miller

net: ipa: pass mem_id to ipa_filter_reset_table()

Pass a memory region ID rather than the address of a memory region
descriptor to ipa_filter_reset_table(), to simplify callers.

We can eliminate the check for a zero region size in this function
because ipa_table_reset_add() checks that before adding anything to
the transaction.

Note that here and in subsequent commits there is no need to check
whether a memory region exists, because we will have already
verified that during initialization.
Signed-off-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ce05a9f3
...@@ -282,16 +282,14 @@ static void ipa_table_reset_add(struct gsi_trans *trans, bool filter, ...@@ -282,16 +282,14 @@ static void ipa_table_reset_add(struct gsi_trans *trans, bool filter,
* for the IPv4 and IPv6 non-hashed and hashed filter tables. * for the IPv4 and IPv6 non-hashed and hashed filter tables.
*/ */
static int static int
ipa_filter_reset_table(struct ipa *ipa, const struct ipa_mem *mem, bool modem) ipa_filter_reset_table(struct ipa *ipa, enum ipa_mem_id mem_id, bool modem)
{ {
const struct ipa_mem *mem = &ipa->mem[mem_id];
u32 ep_mask = ipa->filter_map; u32 ep_mask = ipa->filter_map;
u32 count = hweight32(ep_mask); u32 count = hweight32(ep_mask);
struct gsi_trans *trans; struct gsi_trans *trans;
enum gsi_ee_id ee_id; enum gsi_ee_id ee_id;
if (!mem->size)
return 0;
trans = ipa_cmd_trans_alloc(ipa, count); trans = ipa_cmd_trans_alloc(ipa, count);
if (!trans) { if (!trans) {
dev_err(&ipa->pdev->dev, dev_err(&ipa->pdev->dev,
...@@ -327,20 +325,18 @@ static int ipa_filter_reset(struct ipa *ipa, bool modem) ...@@ -327,20 +325,18 @@ static int ipa_filter_reset(struct ipa *ipa, bool modem)
{ {
int ret; int ret;
ret = ipa_filter_reset_table(ipa, &ipa->mem[IPA_MEM_V4_FILTER], modem); ret = ipa_filter_reset_table(ipa, IPA_MEM_V4_FILTER, modem);
if (ret) if (ret)
return ret; return ret;
ret = ipa_filter_reset_table(ipa, &ipa->mem[IPA_MEM_V4_FILTER_HASHED], ret = ipa_filter_reset_table(ipa, IPA_MEM_V4_FILTER_HASHED, modem);
modem);
if (ret) if (ret)
return ret; return ret;
ret = ipa_filter_reset_table(ipa, &ipa->mem[IPA_MEM_V6_FILTER], modem); ret = ipa_filter_reset_table(ipa, IPA_MEM_V6_FILTER, modem);
if (ret) if (ret)
return ret; return ret;
ret = ipa_filter_reset_table(ipa, &ipa->mem[IPA_MEM_V6_FILTER_HASHED], ret = ipa_filter_reset_table(ipa, IPA_MEM_V6_FILTER_HASHED, modem);
modem);
return ret; return ret;
} }
......
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