diff mbox series

[1/2] wifi: rtw88: debug: add to check if debug mask is enabled

Message ID 20231016053554.744180-2-pkshih@realtek.com (mailing list archive)
State Accepted
Commit 1926a27299db00239d6bdc4c3f2bd3f842277d0d
Delegated to: Kalle Valo
Headers show
Series wifi: rtw88: dump registers related to firmware state when it get abnormal | expand

Commit Message

Ping-Ke Shih Oct. 16, 2023, 5:35 a.m. UTC
From: Chin-Yen Lee <timlee@realtek.com>

The coming dump function for FW malfunction 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: Chin-Yen Lee <timlee@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/rtw88/debug.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Kalle Valo Oct. 19, 2023, 7:28 a.m. UTC | #1
Ping-Ke Shih <pkshih@realtek.com> wrote:

> From: Chin-Yen Lee <timlee@realtek.com>
> 
> The coming dump function for FW malfunction 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: Chin-Yen Lee <timlee@realtek.com>
> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>

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

1926a27299db wifi: rtw88: debug: add to check if debug mask is enabled
20907fc06997 wifi: rtw88: dump firmware debug information in abnormal state
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw88/debug.h b/drivers/net/wireless/realtek/rtw88/debug.h
index a9149c6c2b48..a03ced11bbe0 100644
--- a/drivers/net/wireless/realtek/rtw88/debug.h
+++ b/drivers/net/wireless/realtek/rtw88/debug.h
@@ -48,11 +48,23 @@  void __rtw_dbg(struct rtw_dev *rtwdev, enum rtw_debug_mask mask,
 
 #define rtw_dbg(rtwdev, a...) __rtw_dbg(rtwdev, ##a)
 
+static inline bool rtw_dbg_is_enabled(struct rtw_dev *rtwdev,
+				      enum rtw_debug_mask mask)
+{
+	return !!(rtw_debug_mask & mask);
+}
+
 #else
 
 static inline void rtw_dbg(struct rtw_dev *rtwdev, enum rtw_debug_mask mask,
 			   const char *fmt, ...) {}
 
+static inline bool rtw_dbg_is_enabled(struct rtw_dev *rtwdev,
+				      enum rtw_debug_mask mask)
+{
+	return false;
+}
+
 #endif /* CONFIG_RTW88_DEBUG */
 
 #define rtw_info(rtwdev, a...) dev_info(rtwdev->dev, ##a)