diff mbox series

[1/4] wifi: rtw89: debug: add to check if debug mask is enabled

Message ID 20231122060458.30878-2-pkshih@realtek.com
State New
Headers show
Series wifi: rtw89: phy: add dynamic EDCCA mechanism | expand

Commit Message

Ping-Ke Shih Nov. 22, 2023, 6:04 a.m. UTC
The coming dynamic mechanism of EDCCA adjustment will add a function to
dump registers to reflect status. However, if we are not debugging
the mechanism, we don't print anything, so avoid reading registers by
checking debug mask to reduce IO.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/rtw89/debug.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Kalle Valo Nov. 30, 2023, 7:45 p.m. UTC | #1
Ping-Ke Shih <pkshih@realtek.com> wrote:

> The coming dynamic mechanism of EDCCA adjustment will add a function to
> dump registers to reflect status. However, if we are not debugging
> the mechanism, we don't print anything, so avoid reading registers by
> checking debug mask to reduce IO.
> 
> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>

4 patches applied to wireless-next.git, thanks.

77abbabaafe5 wifi: rtw89: debug: add to check if debug mask is enabled
0bb185257de6 wifi: rtw89: phy: dynamically adjust EDCCA threshold
d371c3aa35fd wifi: rtw89: debug: add debugfs entry to disable dynamic mechanism
9f4dee32b783 wifi: rtw89: debug: remove wrapper of rtw89_debug()
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw89/debug.h b/drivers/net/wireless/realtek/rtw89/debug.h
index b663ee24555a..f18021f9046d 100644
--- a/drivers/net/wireless/realtek/rtw89/debug.h
+++ b/drivers/net/wireless/realtek/rtw89/debug.h
@@ -74,6 +74,12 @@  static inline void rtw89_hex_dump(struct rtw89_dev *rtwdev,
 
 	print_hex_dump_bytes(prefix_str, DUMP_PREFIX_OFFSET, buf, len);
 }
+
+static inline bool rtw89_debug_is_enabled(struct rtw89_dev *rtwdev,
+					  enum rtw89_debug_mask mask)
+{
+	return !!(rtw89_debug_mask & mask);
+}
 #else
 static inline void rtw89_debug(struct rtw89_dev *rtwdev,
 			       enum rtw89_debug_mask mask,
@@ -82,6 +88,11 @@  static inline void rtw89_hex_dump(struct rtw89_dev *rtwdev,
 				  enum rtw89_debug_mask mask,
 				  const char *prefix_str,
 				  const void *buf, size_t len) {}
+static inline bool rtw89_debug_is_enabled(struct rtw89_dev *rtwdev,
+					  enum rtw89_debug_mask mask)
+{
+	return false;
+}
 #endif
 
 #endif