Skip to contentSkip to conversation

staging: r8188eu: remove rtw_endofpktfile()

PATCH In review Michael Straube 2 participants 2 messages Aug 17, 2022 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: r8188eu: remove rtw_endofpktfile()

The function rtw_endofpktfile() just checks for pkt_len == 0. Remove rtw_endofpktfile() and merge the check into the caller to improve readability and simplify the driver code.

---
 drivers/staging/r8188eu/core/rtw_xmit.c      |  2 +-
 drivers/staging/r8188eu/include/xmit_osdep.h |  1 -
 drivers/staging/r8188eu/os_dep/xmit_linux.c  | 11 -----------
 3 files changed, 1 insertion(+), 13 deletions(-)
drivers/staging/r8188eu/core/rtw_xmit.c +1 -1
index 24401f3ae2a0..48631ef56114 100644
@@ -970,7 +970,7 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct
 
 		frg_inx++;
 
-		if (bmcst || rtw_endofpktfile(&pktfile)) {
+		if (bmcst || pktfile.pkt_len == 0) {
 			pattrib->nr_frags = frg_inx;
 
 			pattrib->last_txcmdsz = pattrib->hdrlen + pattrib->iv_len + ((pattrib->nr_frags == 1) ? llc_sz : 0) +
drivers/staging/r8188eu/include/xmit_osdep.h +0 -1
index 00658681fef9..130dc06efe73 100644
@@ -40,7 +40,6 @@ void rtw_os_xmit_resource_free(struct adapter *padapter,
 uint rtw_remainder_len(struct pkt_file *pfile);
 void _rtw_open_pktfile(struct sk_buff *pkt, struct pkt_file *pfile);
 uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen);
-bool rtw_endofpktfile(struct pkt_file *pfile);
 
 void rtw_os_pkt_complete(struct adapter *padapter, struct sk_buff *pkt);
 void rtw_os_xmit_complete(struct adapter *padapter,
drivers/staging/r8188eu/os_dep/xmit_linux.c +0 -11
index 91a1e4e3219a..85ef27735b88 100644
@@ -54,17 +54,6 @@ uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen)
 	return len;
 }
 
-bool rtw_endofpktfile(struct pkt_file *pfile)
-{
-
-	if (pfile->pkt_len == 0) {
-
-		return true;
-	}
-
-	return false;
-}
-
 int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitbuf, u32 alloc_sz)
 {
 	pxmitbuf->pallocated_buf = kzalloc(alloc_sz, GFP_KERNEL);
Signature · 1 line
2.37.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 48 lines · Michael Straube

The function rtw_endofpktfile() just checks for pkt_len == 0. Remove rtw_endofpktfile() and merge the check into the caller to improve readability and simplify the driver code.

---
  drivers/staging/r8188eu/core/rtw_xmit.c      |  2 +-
  drivers/staging/r8188eu/include/xmit_osdep.h |  1 -
  drivers/staging/r8188eu/os_dep/xmit_linux.c  | 11 -----------
  3 files changed, 1 insertion(+), 13 deletions(-)
drivers/staging/r8188eu/core/rtw_xmit.c +1 -1
index 24401f3ae2a0..48631ef56114 100644
@@ -970,7 +970,7 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct
 
  		frg_inx++;
 
-		if (bmcst || rtw_endofpktfile(&pktfile)) {
+		if (bmcst || pktfile.pkt_len == 0) {
  			pattrib->nr_frags = frg_inx;
 
  			pattrib->last_txcmdsz = pattrib->hdrlen + pattrib->iv_len + ((pattrib->nr_frags == 1) ? llc_sz : 0) +
drivers/staging/r8188eu/include/xmit_osdep.h +0 -1
index 00658681fef9..130dc06efe73 100644
@@ -40,7 +40,6 @@ void rtw_os_xmit_resource_free(struct adapter *padapter,
  uint rtw_remainder_len(struct pkt_file *pfile);
  void _rtw_open_pktfile(struct sk_buff *pkt, struct pkt_file *pfile);
  uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen);
-bool rtw_endofpktfile(struct pkt_file *pfile);
 
  void rtw_os_pkt_complete(struct adapter *padapter, struct sk_buff *pkt);
  void rtw_os_xmit_complete(struct adapter *padapter,
drivers/staging/r8188eu/os_dep/xmit_linux.c +0 -4
index 91a1e4e3219a..85ef27735b88 100644
@@ -54,17 +54,6 @@ uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen)
  	return len;
  }
 
-bool rtw_endofpktfile(struct pkt_file *pfile)
-{
-
-	if (pfile->pkt_len == 0) {

drivers/staging/r8188eu/os_dep/xmit_linux.c uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen) · line 59

Quoted 10 lines
drivers/staging/r8188eu/os_dep/xmit_linux.c +0 -7
-
-		return true;
-	}
-
-	return false;
-}
-
  int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitbuf, u32 alloc_sz)
  {
  	pxmitbuf->pallocated_buf = kzalloc(alloc_sz, GFP_KERNEL);

Tested with Edimax N150 and