mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8723bs: remove unused macros from wifi.h
@ 2026-10-21 20:46 Yaroslav Shevchenko
  2026-10-22  4:39 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 2+ messages in thread
From: Yaroslav Shevchenko @ 2026-10-21 20:46 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel

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@gmail.com>
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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] staging: rtl8723bs: remove unused macros from wifi.h
  2026-10-21 20:46 [PATCH] staging: rtl8723bs: remove unused macros from wifi.h Yaroslav Shevchenko
@ 2026-10-22  4:39 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2026-10-22  4:39 UTC (permalink / raw)
  To: Yaroslav Shevchenko; +Cc: linux-staging, linux-kernel

On Wed, Oct 21, 2026 at 10:46:33PM +0200, Yaroslav Shevchenko wrote:
> 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@gmail.com>
> Assisted-by: LLM

Please read https://lore.kernel.org/r/2026080354-skater-urgent-31b2@gregkh

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-22  4:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-21 20:46 [PATCH] staging: rtl8723bs: remove unused macros from wifi.h Yaroslav Shevchenko
2026-10-22  4:39 ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®