public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH v4 0/2] staging: rtl8723bs: Cleanups for rtw_xmit.c
@ 2026-03-15 21:05 Marcos Andrade
  2026-03-15 21:05 ` [PATCH v4 1/2] staging: rtl8723bs: Replace network magic numbers with EtherType macros Marcos Andrade
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Marcos Andrade @ 2026-03-15 21:05 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Ethan Tidmore
  Cc: linux-staging, linux-kernel, Marcos Andrade

This patch series cleans up rtw_xmit.c by replacing magic numbers with
proper macros and updating the sleep API, as suggested by reviewers.

Patch 1 replaces network magic numbers with EtherType macros.
Patch 2 updates an msleep() call to the new fsleep() API.

Changes in v4:
 - Fixed commit message line wrapping in patch 2/2 to comply with 
   the 75-column limit, as suggested by Ethan Tidmore.
Changes in v3:
 - Grouped the patches into a series because patch 2 depends on the 
   include context of patch 1.
Changes in v2:
 - Changed include from "" to <> for linux/if_ether.h.
 - Sorted includes alphabetically.

Marcos Andrade (2):
  staging: rtl8723bs: Replace network magic numbers with EtherType
    macros
  staging: rtl8723bs: Replace msleep() with fsleep()

 drivers/staging/rtl8723bs/core/rtw_xmit.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

-- 
2.53.0


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

* [PATCH v4 1/2] staging: rtl8723bs: Replace network magic numbers with EtherType macros
  2026-03-15 21:05 [PATCH v4 0/2] staging: rtl8723bs: Cleanups for rtw_xmit.c Marcos Andrade
@ 2026-03-15 21:05 ` Marcos Andrade
  2026-03-15 21:05 ` [PATCH v4 2/2] staging: rtl8723bs: Replace msleep() with fsleep() Marcos Andrade
  2026-03-15 22:08 ` [PATCH v4 0/2] staging: rtl8723bs: Cleanups for rtw_xmit.c Ethan Tidmore
  2 siblings, 0 replies; 4+ messages in thread
From: Marcos Andrade @ 2026-03-15 21:05 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Ethan Tidmore
  Cc: linux-staging, linux-kernel, Marcos Andrade

Replace hardcoded magic numbers for network protocols (e.g., 0x0806
for ARP, 0x888e for EAPOL) with their standard EtherType macro
equivalents (ETH_P_ARP, ETH_P_PAE) defined in <linux/if_ether.h>.

This change improves code readability and aligns the driver with
standard Linux networking definitions.

Signed-off-by: Marcos Andrade <marcosandrade95963@gmail.com>
---
Changes in v3:
 - Included in a patch series.
Changes in v2:
 - Changed include from "" to <> for linux/if_ether.h.
 - Sorted includes alphabetically.

 drivers/staging/rtl8723bs/core/rtw_xmit.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c b/drivers/staging/rtl8723bs/core/rtw_xmit.c
index 7b18be891..4062fe0c1 100644
--- a/drivers/staging/rtl8723bs/core/rtw_xmit.c
+++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c
@@ -5,6 +5,7 @@
  *
  ******************************************************************************/
 #include <drv_types.h>
+#include <linux/if_ether.h>
 
 static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 };
 static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 };
@@ -2026,8 +2027,8 @@ inline bool xmitframe_hiq_filter(struct xmit_frame *xmitframe)
 	if (registry->hiq_filter == RTW_HIQ_FILTER_ALLOW_SPECIAL) {
 		struct pkt_attrib *attrib = &xmitframe->attrib;
 
-		if (attrib->ether_type == 0x0806 ||
-		    attrib->ether_type == 0x888e ||
+		if (attrib->ether_type == ETH_P_ARP ||
+		    attrib->ether_type == ETH_P_PAE ||
 		    attrib->dhcp_pkt
 		)
 			allow = true;
-- 
2.53.0


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

* [PATCH v4 2/2] staging: rtl8723bs: Replace msleep() with fsleep()
  2026-03-15 21:05 [PATCH v4 0/2] staging: rtl8723bs: Cleanups for rtw_xmit.c Marcos Andrade
  2026-03-15 21:05 ` [PATCH v4 1/2] staging: rtl8723bs: Replace network magic numbers with EtherType macros Marcos Andrade
@ 2026-03-15 21:05 ` Marcos Andrade
  2026-03-15 22:08 ` [PATCH v4 0/2] staging: rtl8723bs: Cleanups for rtw_xmit.c Ethan Tidmore
  2 siblings, 0 replies; 4+ messages in thread
From: Marcos Andrade @ 2026-03-15 21:05 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Ethan Tidmore
  Cc: linux-staging, linux-kernel, Marcos Andrade

Replace msleep(10) with fsleep(10 * USEC_PER_MSEC)
in _rtw_init_xmit_priv().
fsleep() is the new standard API for delays, as it automatically chooses
the best sleep method based on the duration.

Suggested-by: Ethan Tidmore <ethantidmore06@gmail.com>
Signed-off-by: Marcos Andrade <marcosandrade95963@gmail.com>
---
Changes in v4:
 - Wrapped commit message lines to 75 columns.

 drivers/staging/rtl8723bs/core/rtw_xmit.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c b/drivers/staging/rtl8723bs/core/rtw_xmit.c
index 4062fe0c1..dab16851f 100644
--- a/drivers/staging/rtl8723bs/core/rtw_xmit.c
+++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c
@@ -5,6 +5,7 @@
  *
  ******************************************************************************/
 #include <drv_types.h>
+#include <linux/delay.h>
 #include <linux/if_ether.h>
 
 static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 };
@@ -129,7 +130,7 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter)
 		/* Tx buf allocation may fail sometimes, so sleep and retry. */
 		res = rtw_os_xmit_resource_alloc(padapter, pxmitbuf, (MAX_XMITBUF_SZ + XMITBUF_ALIGN_SZ), true);
 		if (res == _FAIL) {
-			msleep(10);
+			fsleep(10 * USEC_PER_MSEC);
 			res = rtw_os_xmit_resource_alloc(padapter, pxmitbuf, (MAX_XMITBUF_SZ + XMITBUF_ALIGN_SZ), true);
 			if (res == _FAIL)
 				goto exit;
-- 
2.53.0


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

* Re: [PATCH v4 0/2] staging: rtl8723bs: Cleanups for rtw_xmit.c
  2026-03-15 21:05 [PATCH v4 0/2] staging: rtl8723bs: Cleanups for rtw_xmit.c Marcos Andrade
  2026-03-15 21:05 ` [PATCH v4 1/2] staging: rtl8723bs: Replace network magic numbers with EtherType macros Marcos Andrade
  2026-03-15 21:05 ` [PATCH v4 2/2] staging: rtl8723bs: Replace msleep() with fsleep() Marcos Andrade
@ 2026-03-15 22:08 ` Ethan Tidmore
  2 siblings, 0 replies; 4+ messages in thread
From: Ethan Tidmore @ 2026-03-15 22:08 UTC (permalink / raw)
  To: Marcos Andrade, Greg Kroah-Hartman, Ethan Tidmore
  Cc: linux-staging, linux-kernel

On Sun Mar 15, 2026 at 4:05 PM CDT, Marcos Andrade wrote:
> This patch series cleans up rtw_xmit.c by replacing magic numbers with
> proper macros and updating the sleep API, as suggested by reviewers.
>
> Patch 1 replaces network magic numbers with EtherType macros.
> Patch 2 updates an msleep() call to the new fsleep() API.
>
> Changes in v4:
>  - Fixed commit message line wrapping in patch 2/2 to comply with 
>    the 75-column limit, as suggested by Ethan Tidmore.
> Changes in v3:
>  - Grouped the patches into a series because patch 2 depends on the 
>    include context of patch 1.
> Changes in v2:
>  - Changed include from "" to <> for linux/if_ether.h.
>  - Sorted includes alphabetically.
>
> Marcos Andrade (2):
>   staging: rtl8723bs: Replace network magic numbers with EtherType
>     macros
>   staging: rtl8723bs: Replace msleep() with fsleep()
>
>  drivers/staging/rtl8723bs/core/rtw_xmit.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)

LGTM.

Reviewed-by: Ethan Tidmore <ethantidmore06@gmail.com>

Thanks,

ET

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

end of thread, other threads:[~2026-03-15 22:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-15 21:05 [PATCH v4 0/2] staging: rtl8723bs: Cleanups for rtw_xmit.c Marcos Andrade
2026-03-15 21:05 ` [PATCH v4 1/2] staging: rtl8723bs: Replace network magic numbers with EtherType macros Marcos Andrade
2026-03-15 21:05 ` [PATCH v4 2/2] staging: rtl8723bs: Replace msleep() with fsleep() Marcos Andrade
2026-03-15 22:08 ` [PATCH v4 0/2] staging: rtl8723bs: Cleanups for rtw_xmit.c Ethan Tidmore

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