Skip to content

Commit 9fe6f14

Browse files
Jminugregkh
authored andcommitted
staging: rtl8723bs: use standard skb allocation APIs
Replace custom wrappers rtw_skb_alloc() and rtw_skb_copy() with standard kernel APIs __dev_alloc_skb() and skb_copy(). 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. Signed-off-by: Minu Jin <s9430939@naver.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Link: https://patch.msgid.link/20260204131347.3515949-5-s9430939@naver.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 980cd42 commit 9fe6f14

4 files changed

Lines changed: 5 additions & 7 deletions

File tree

drivers/staging/rtl8723bs/core/rtw_recv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1630,7 +1630,7 @@ static struct sk_buff *rtw_alloc_msdu_pkt(union recv_frame *prframe, u16 nSubfra
16301630

16311631
pattrib = &prframe->u.hdr.attrib;
16321632

1633-
sub_skb = rtw_skb_alloc(nSubframe_Length + 12);
1633+
sub_skb = __dev_alloc_skb(nSubframe_Length + 12, GFP_ATOMIC);
16341634
if (!sub_skb)
16351635
return NULL;
16361636

drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ static void rtl8723bs_recv_tasklet(struct tasklet_struct *t)
290290
alloc_sz += 14;
291291
}
292292

293-
pkt_copy = rtw_skb_alloc(alloc_sz);
293+
pkt_copy = __dev_alloc_skb(alloc_sz, GFP_ATOMIC);
294294
if (!pkt_copy) {
295295
rtw_free_recvframe(precvframe, &precvpriv->free_recv_queue);
296296
break;
@@ -397,8 +397,7 @@ s32 rtl8723bs_init_recv_priv(struct adapter *padapter)
397397
SIZE_PTR tmpaddr = 0;
398398
SIZE_PTR alignment = 0;
399399

400-
precvbuf->pskb = rtw_skb_alloc(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ);
401-
400+
precvbuf->pskb = __dev_alloc_skb(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ, GFP_ATOMIC);
402401
if (precvbuf->pskb) {
403402
precvbuf->pskb->dev = padapter->pnetdev;
404403

drivers/staging/rtl8723bs/hal/sdio_ops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,7 @@ static struct recv_buf *sd_recv_rxfifo(struct adapter *adapter, u32 size)
810810
SIZE_PTR tmpaddr = 0;
811811
SIZE_PTR alignment = 0;
812812

813-
recvbuf->pskb = rtw_skb_alloc(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ);
813+
recvbuf->pskb = __dev_alloc_skb(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ, GFP_ATOMIC);
814814
if (!recvbuf->pskb)
815815
return NULL;
816816

drivers/staging/rtl8723bs/os_dep/xmit_linux.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,7 @@ static int rtw_mlcst2unicst(struct adapter *padapter, struct sk_buff *skb)
162162
!memcmp(psta->hwaddr, bc_addr, 6))
163163
continue;
164164

165-
newskb = rtw_skb_copy(skb);
166-
165+
newskb = skb_copy(skb, GFP_ATOMIC);
167166
if (newskb) {
168167
memcpy(newskb->data, psta->hwaddr, 6);
169168
res = rtw_xmit(padapter, &newskb);

0 commit comments

Comments
 (0)