[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210319042923.1584593-5-elder@linaro.org>
Date: Thu, 18 Mar 2021 23:29:23 -0500
From: Alex Elder <elder@...aro.org>
To: davem@...emloft.net, kuba@...nel.org
Cc: bjorn.andersson@...aro.org, evgreen@...omium.org,
cpratapa@...eaurora.org, elder@...nel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH net-next 4/4] net: ipa: activate some commented assertions
Convert some commented assertion statements into real calls to
ipa_assert(). If the IPA device pointer is available, provide it,
otherwise pass NULL for that.
There are lots more places to convert, but this serves as an initial
verification of the new mechanism. The assertions here implement
both runtime and build-time assertions, both with and without the
device pointer.
Signed-off-by: Alex Elder <elder@...aro.org>
---
drivers/net/ipa/ipa_reg.h | 7 ++++---
drivers/net/ipa/ipa_table.c | 5 ++++-
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ipa/ipa_reg.h b/drivers/net/ipa/ipa_reg.h
index 732e691e9aa62..d0de85de9f08d 100644
--- a/drivers/net/ipa/ipa_reg.h
+++ b/drivers/net/ipa/ipa_reg.h
@@ -9,6 +9,7 @@
#include <linux/bitfield.h>
#include "ipa_version.h"
+#include "ipa_assert.h"
struct ipa;
@@ -212,7 +213,7 @@ static inline u32 ipa_reg_bcr_val(enum ipa_version version)
BCR_HOLB_DROP_L2_IRQ_FMASK |
BCR_DUAL_TX_FMASK;
- /* assert(version != IPA_VERSION_4_5); */
+ ipa_assert(NULL, version != IPA_VERSION_4_5);
return 0x00000000;
}
@@ -413,7 +414,7 @@ static inline u32 ipa_header_size_encoded(enum ipa_version version,
val = u32_encode_bits(size, HDR_LEN_FMASK);
if (version < IPA_VERSION_4_5) {
- /* ipa_assert(header_size == size); */
+ ipa_assert(NULL, header_size == size);
return val;
}
@@ -433,7 +434,7 @@ static inline u32 ipa_metadata_offset_encoded(enum ipa_version version,
val = u32_encode_bits(off, HDR_OFST_METADATA_FMASK);
if (version < IPA_VERSION_4_5) {
- /* ipa_assert(offset == off); */
+ ipa_assert(NULL, offset == off);
return val;
}
diff --git a/drivers/net/ipa/ipa_table.c b/drivers/net/ipa/ipa_table.c
index aa8b3ce7e21d9..7784b42fbaccc 100644
--- a/drivers/net/ipa/ipa_table.c
+++ b/drivers/net/ipa/ipa_table.c
@@ -23,6 +23,7 @@
#include "ipa_cmd.h"
#include "gsi.h"
#include "gsi_trans.h"
+#include "ipa_assert.h"
/**
* DOC: IPA Filter and Route Tables
@@ -237,11 +238,13 @@ static void ipa_table_validate_build(void)
static dma_addr_t ipa_table_addr(struct ipa *ipa, bool filter_mask, u16 count)
{
u32 skip;
+ u32 max;
if (!count)
return 0;
-/* assert(count <= max_t(u32, IPA_FILTER_COUNT_MAX, IPA_ROUTE_COUNT_MAX)); */
+ max = max_t(u32, IPA_FILTER_COUNT_MAX, IPA_ROUTE_COUNT_MAX);
+ ipa_assert(&ipa->pdev->dev, max);
/* Skip over the zero rule and possibly the filter mask */
skip = filter_mask ? 1 : 2;
--
2.27.0
Powered by blists - more mailing lists