[PATCH 09/31] staging: wfx: replace magic value by WFX_HIF_BUFFER_SIZE

From: Jerome Pouiller
Date: Thu Jan 13 2022 - 03:56:55 EST


From: Jérôme Pouiller <jerome.pouiller@xxxxxxxxxx>

Magic values are not recommended.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@xxxxxxxxxx>
---
drivers/staging/wfx/hwio.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wfx/hwio.c b/drivers/staging/wfx/hwio.c
index a2a37efc51a6..977b9325f496 100644
--- a/drivers/staging/wfx/hwio.c
+++ b/drivers/staging/wfx/hwio.c
@@ -15,6 +15,8 @@
#include "bus.h"
#include "traces.h"

+#define WFX_HIF_BUFFER_SIZE 0x2000
+
static int read32(struct wfx_dev *wdev, int reg, u32 *val)
{
int ret;
@@ -103,7 +105,7 @@ static int indirect_read(struct wfx_dev *wdev, int reg, u32 addr,
u32 cfg;
u32 prefetch;

- WARN_ON(len >= 0x2000);
+ WARN_ON(len >= WFX_HIF_BUFFER_SIZE);
WARN_ON(reg != WFX_REG_AHB_DPORT && reg != WFX_REG_SRAM_DPORT);

if (reg == WFX_REG_AHB_DPORT)
@@ -151,7 +153,7 @@ static int indirect_write(struct wfx_dev *wdev, int reg, u32 addr,
{
int ret;

- WARN_ON(len >= 0x2000);
+ WARN_ON(len >= WFX_HIF_BUFFER_SIZE);
WARN_ON(reg != WFX_REG_AHB_DPORT && reg != WFX_REG_SRAM_DPORT);
ret = write32(wdev, WFX_REG_BASE_ADDR, addr);
if (ret < 0)
--
2.34.1