Skip to content

staging: rtl8723bs: replace custom wrappers with kernel APIs

Minu Jin linux-staging lkml 2 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest5 patches 3 repliesIn review
  2. v55 patches 5 repliesSuperseded

Changes in v6 from the cover letter

(suggested by Andy Shevchenko)
- Add standard for selecting the GFP flag in Cover-Letter
- Patch 1: Removed unnecessary curly braces in OnAssocReq() and comment about GFP Flag.
- Patch 3: Converted a remaining 'return -1' to '-ENOMEM' in cfg80211_rtw_add_key()
- Collected Reviewed-by tags from Andy Shevchenko for patches 2, 3, 4, and 5.

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5staging: rtl8723bs: introduce kmemdup() where applicabledrivers/staging/rtl8723bs/core/rtw_ap.c drivers/staging/rtl8723bs/core/rtw_mlme.c drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +3 more+12 -251 reply
2/5staging: rtl8723bs: replace rtw_malloc() with kmalloc()drivers/staging/rtl8723bs/core/rtw_cmd.c drivers/staging/rtl8723bs/core/rtw_mlme_ext.c drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +1 more+16 -162 replies
3/5staging: rtl8723bs: replace rtw_zmalloc() with kzalloc()drivers/staging/rtl8723bs/core/rtw_ap.c drivers/staging/rtl8723bs/core/rtw_cmd.c drivers/staging/rtl8723bs/core/rtw_mlme.c +11 more+90 -1030 replies
4/5staging: rtl8723bs: use standard skb allocation APIsdrivers/staging/rtl8723bs/core/rtw_recv.c drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c drivers/staging/rtl8723bs/hal/sdio_ops.c +1 more+5 -70 replies
5/5staging: rtl8723bs: remove unused allocation wrapper functionsdrivers/staging/rtl8723bs/include/osdep_service.h drivers/staging/rtl8723bs/os_dep/osdep_service.c+0 -360 replies

Reviews trailers per patch

All 5 patches have a Reviewed-by or Acked-by.

PatchAndy Shevchenko
1/5R-b
2/5Reviewd-by R-b
3/5R-b
4/5R-b
5/5R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v6 thread

Cover letter [PATCH v6 0/5] staging: rtl8723bs: replace custom wrappers with kernel APIs

This series replaces redundant custom wrapper functions (rtw_malloc(), rtw_zmalloc(), rtw_skb_alloc(), etc.) with standard kernel APIs (kmalloc(), kzalloc(), kmemdup(), skb_copy(), __dev_alloc_skb()).

The original wrappers relied on an internal in_interrupt() check to select GFP flags. I have analyzed all call sites and replaced them with explicit GFP_KERNEL or GFP_ATOMIC flags based on the context.

About GFP Flags:
- GFP_ATOMIC is used for allocations in atomic contexts such as spinlock-protected sections, tasklets, and timer handlers.
- GFP_KERNEL is used for process contexts where sleeping is allowed.

I would like to thank Andy Shevchenko
for the continuous reviews and the time spent on my patches.

Changes in v6:
(suggested by Andy Shevchenko)
- Add standard for selecting the GFP flag in Cover-Letter
- Patch 1: Removed unnecessary curly braces in OnAssocReq() and comment about GFP Flag.
- Patch 3: Converted a remaining 'return -1' to '-ENOMEM' in cfg80211_rtw_add_key()
- Collected Reviewed-by tags from Andy Shevchenko for patches 2, 3, 4, and 5.

Changes in v5:
(suggested by Andy Shevchenko)
- Completely restructured the patch series.
- Use kmemdup() where applicable (replacing kmalloc + memcpy patterns).
- Used kzalloc() for allocations followed by manual zero-initialization.
- Used array_size() and size_add() for overflow-safe allocations.
- Updated error return codes from -1 to -ENOMEM where appropriate.

Changes in v4:
(suggested by Andy Shevchenko)
- Use kmemdup() where applicable.
- Use array_size(), size_add() for overflow safe allocations.
- Use sizeof(*ptr) instead of sizeof(struct val) for better maintainability.

Changes in v3:
- I have analyzed each call site to apply the appropriate GFP flags based on the execution context.
- Improved the logical separation of patches to maintain git bisect
- Removed redundant definitions and unused macros (e.g., rtw_skb_alloc_f) in the final cleanup patch.

Minu Jin (5):
staging: rtl8723bs: introduce kmemdup() where applicable
staging: rtl8723bs: replace rtw_malloc() with kmalloc()
staging: rtl8723bs: replace rtw_zmalloc() with kzalloc()
staging: rtl8723bs: use standard skb allocation APIs
staging: rtl8723bs: remove unused allocation wrapper functions

 drivers/staging/rtl8723bs/core/rtw_ap.c       | 22 ++---
 drivers/staging/rtl8723bs/core/rtw_cmd.c      | 83 +++++++++----------
 drivers/staging/rtl8723bs/core/rtw_mlme.c     | 13 ++-
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 45 +++++-----
 drivers/staging/rtl8723bs/core/rtw_recv.c     |  4 +-
 drivers/staging/rtl8723bs/core/rtw_security.c |  3 +-
 .../staging/rtl8723bs/core/rtw_wlan_util.c    |  2 +-
 drivers/staging/rtl8723bs/core/rtw_xmit.c     |  8 +-
 .../staging/rtl8723bs/hal/rtl8723b_hal_init.c |  4 +-
 .../staging/rtl8723bs/hal/rtl8723bs_recv.c    | 11 +--
 drivers/staging/rtl8723bs/hal/sdio_ops.c      | 28 +++----
 .../staging/rtl8723bs/include/osdep_service.h | 11 ---
 .../staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 29 +++----
 drivers/staging/rtl8723bs/os_dep/os_intfs.c   |  2 +-
 .../staging/rtl8723bs/os_dep/osdep_service.c  | 40 +--------
 drivers/staging/rtl8723bs/os_dep/xmit_linux.c |  5 +-
 16 files changed, 123 insertions(+), 187 deletions(-)
Signature · 1 line
2.43.0