[PATCH] staging: rtl8723bs: remove unused macros from wifi.h

From: Yaroslav Shevchenko

Date: Wed Oct 21 2026 - 16:46:57 EST


SetFrameType(), SetFragNum(), GetOrderBit(), ACT_CAT_VENDOR,
_IEEE8021X_MGT_ and _IEEE8021X_PSK_ are defined in wifi.h but have no
users anywhere in the tree.

Three of them are also broken. GetOrderBit() duplicates GetOrder(),
which is used by rtw_recv.c, but casts the frame header to
"unsigned short" instead of __le16 while masking it against a
cpu_to_le16() value. SetFrameType() has the same type confusion,
whereas the SetFrameSubType() macro next to it casts to __le16 as it
should. SetFragNum() passes a constant mask through le16_to_cpu()
where cpu_to_le16() is needed.

Since these macros are never expanded, neither the compiler nor sparse
flags any of this, so the first user of them would inherit the bugs.
Drop them rather than fix dead code.

No functional change intended. Built for arm64 with W=1, no new
warnings.

Signed-off-by: Yaroslav Shevchenko <yros22776@xxxxxxxxx>
Assisted-by: LLM
---
drivers/staging/rtl8723bs/include/wifi.h | 20 --------------------
1 file changed, 20 deletions(-)

diff --git a/drivers/staging/rtl8723bs/include/wifi.h b/drivers/staging/rtl8723bs/include/wifi.h
index 93cb83488..719a1ea34 100644
--- a/drivers/staging/rtl8723bs/include/wifi.h
+++ b/drivers/staging/rtl8723bs/include/wifi.h
@@ -123,12 +123,6 @@ enum {
#define GetFrameType(pbuf) \
(le16_to_cpu(*(__le16 *)(pbuf)) & (BIT(3) | BIT(2)))

-#define SetFrameType(pbuf, type) \
- do { \
- *(unsigned short *)(pbuf) &= cpu_to_le16(~(BIT(3) | BIT(2))); \
- *(unsigned short *)(pbuf) |= cpu_to_le16(type); \
- } while (0)
-
#define GetFrameSubType(pbuf) (le16_to_cpu(*(__le16 *)(pbuf)) & (BIT(7) |\
BIT(6) | BIT(5) | BIT(4) | BIT(3) | BIT(2)))

@@ -145,14 +139,6 @@ enum {
#define GetFragNum(pbuf) \
(le16_to_cpu(*(__le16 *)((size_t)(pbuf) + 22)) & 0x0f)

-#define SetFragNum(pbuf, num) \
- do { \
- *(unsigned short *)((size_t)(pbuf) + 22) = \
- ((*(unsigned short *)((size_t)(pbuf) + 22)) & \
- le16_to_cpu(~(0x000f))) | \
- cpu_to_le16(0x0f & (num)); \
- } while (0)
-
#define SetSeqNum(pbuf, num) \
do { \
*(__le16 *)((size_t)(pbuf) + 22) = \
@@ -306,9 +292,6 @@ static inline int IsFrameTypeCtrl(unsigned char *pframe)
/*-----------------------------------------------------------------------------
Below is the definition for 802.11i / 802.1x
------------------------------------------------------------------------------*/
-#define _IEEE8021X_MGT_ 1 /* WPA */
-#define _IEEE8021X_PSK_ 2 /* WPA with pre-shared key */
-
#define _MME_IE_LENGTH_ 18
/*-----------------------------------------------------------------------------
Below is the definition for WMM
@@ -318,9 +301,6 @@ static inline int IsFrameTypeCtrl(unsigned char *pframe)
/*-----------------------------------------------------------------------------
Below is the definition for 802.11n
------------------------------------------------------------------------------*/
-#define GetOrderBit(pbuf) (((*(unsigned short *)(pbuf)) & cpu_to_le16(_ORDER_)) != 0)
-
-#define ACT_CAT_VENDOR 0x7F/* 127 */

/**
* struct rtw_ieee80211_ht_cap - HT additional information
--
2.47.3