[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <84e388b0eaaf3c56f575216b0571318ed799a4d2.1629642658.git.paskripkin@gmail.com>
Date: Sun, 22 Aug 2021 17:35:41 +0300
From: Pavel Skripkin <paskripkin@...il.com>
To: Larry.Finger@...inger.net, phil@...lpotter.co.uk,
gregkh@...uxfoundation.org, straube.linux@...il.com,
fmdefrancesco@...il.com
Cc: linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org,
Pavel Skripkin <paskripkin@...il.com>
Subject: [PATCH RFC v2 2/6] staging: r8188eu: add helper macro for printing registers
There are a lof of places, where DBG_88E() is used to print register
value. Since following patches change _rtw_read*() family
prototypes, we can wrap printing registers into useful macro to avoid
open-coding error checking like this:
u32 tmp;
if (!rtw_read(&tmp))
DBG("reg = %d\n", tmp);
So, added DBG_88E_REG{8,16,32} macros for printing register values.
Signed-off-by: Pavel Skripkin <paskripkin@...il.com>
---
drivers/staging/r8188eu/include/rtw_debug.h | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/staging/r8188eu/include/rtw_debug.h b/drivers/staging/r8188eu/include/rtw_debug.h
index 3c3bf2a4f30e..059647b9cd3a 100644
--- a/drivers/staging/r8188eu/include/rtw_debug.h
+++ b/drivers/staging/r8188eu/include/rtw_debug.h
@@ -72,6 +72,19 @@ extern u32 GlobalDebugLevel;
pr_info(DRIVER_PREFIX __VA_ARGS__); \
} while (0)
+#define __DBG_88E_REG(fmt, adap, reg, size) \
+ do { \
+ u##size __tmp__; \
+ if (rtw_read##size((adap), (reg), &__tmp__)) \
+ break; \
+ if (_drv_err_ <= GlobalDebugLevel) \
+ pr_info(DRIVER_PREFIX fmt, __tmp__); \
+ } while (0)
+
+#define DBG_88E_REG8(fmt, adap, reg) __DBG_88E_REG(fmt, adap, reg, 8)
+#define DBG_88E_REG16(fmt, adap, reg) __DBG_88E_REG(fmt, adap, reg, 16)
+#define DBG_88E_REG32(fmt, adap, reg) __DBG_88E_REG(fmt, adap, reg, 32)
+
int proc_get_drv_version(char *page, char **start,
off_t offset, int count,
int *eof, void *data);
--
2.32.0
Powered by blists - more mailing lists