wifi: rtw89: debug: add to check if debug mask is enabled
authorPing-Ke Shih <pkshih@realtek.com>
Wed, 22 Nov 2023 06:04:55 +0000 (14:04 +0800)
committerKalle Valo <kvalo@kernel.org>
Thu, 30 Nov 2023 19:45:21 +0000 (21:45 +0200)
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>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20231122060458.30878-2-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/debug.h

index b663ee24555a1510272fc08d083b04b965b36e5c..f18021f9046db9e7bbc3086325a54870a82a3bca 100644 (file)
@@ -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