[PATCH] staging: rtl8723bs: refactor traffic_stat access in collect_traffic_statistics

Mirza Ishan Beg posted 1 patch 1 month, 4 weeks ago
There is a newer version of this series
drivers/staging/rtl8723bs/core/rtw_cmd.c | 25 ++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
[PATCH] staging: rtl8723bs: refactor traffic_stat access in collect_traffic_statistics
Posted by Mirza Ishan Beg 1 month, 4 weeks ago
Replace repetitive `pdvobjpriv->traffic_stat.` dereferencing with a local
pointer `ts` to improve readability and reduce line length. This resolves
multiple checkpatch line-length warnings without manual wrapping.

Suggested-by: Nikolay Kulikov <nikolayof23@gmail.com>
Signed-off-by: Mirza Ishan Beg <seedandsyntax@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_cmd.c | 25 ++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index ce3dfa1fee26..277eccba293c 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -1109,25 +1109,26 @@ u8 rtw_dynamic_chk_wk_cmd(struct adapter *padapter)
 static void collect_traffic_statistics(struct adapter *padapter)
 {
 	struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
+	struct traffic_stat *ts = &pdvobjpriv->traffic_stat
 
 	/*  Tx */
-	pdvobjpriv->traffic_stat.tx_bytes = padapter->xmitpriv.tx_bytes;
-	pdvobjpriv->traffic_stat.tx_pkts = padapter->xmitpriv.tx_pkts;
-	pdvobjpriv->traffic_stat.tx_drop = padapter->xmitpriv.tx_drop;
+	ts->tx_bytes = padapter->xmitpriv.tx_bytes;
+	ts->tx_pkts = padapter->xmitpriv.tx_pkts;
+	ts->tx_drop = padapter->xmitpriv.tx_drop;
 
 	/*  Rx */
-	pdvobjpriv->traffic_stat.rx_bytes = padapter->recvpriv.rx_bytes;
-	pdvobjpriv->traffic_stat.rx_pkts = padapter->recvpriv.rx_pkts;
-	pdvobjpriv->traffic_stat.rx_drop = padapter->recvpriv.rx_drop;
+	ts->rx_bytes = padapter->recvpriv.rx_bytes;
+	ts->rx_pkts = padapter->recvpriv.rx_pkts;
+	ts->rx_drop = padapter->recvpriv.rx_drop;
 
 	/*  Calculate throughput in last interval */
-	pdvobjpriv->traffic_stat.cur_tx_bytes = pdvobjpriv->traffic_stat.tx_bytes - pdvobjpriv->traffic_stat.last_tx_bytes;
-	pdvobjpriv->traffic_stat.cur_rx_bytes = pdvobjpriv->traffic_stat.rx_bytes - pdvobjpriv->traffic_stat.last_rx_bytes;
-	pdvobjpriv->traffic_stat.last_tx_bytes = pdvobjpriv->traffic_stat.tx_bytes;
-	pdvobjpriv->traffic_stat.last_rx_bytes = pdvobjpriv->traffic_stat.rx_bytes;
+	ts->cur_tx_bytes = ts->tx_bytes - ts->last_tx_bytes;
+	ts->cur_rx_bytes = ts->rx_bytes - ts->last_rx_bytes;
+	ts->last_tx_bytes = ts->tx_bytes;
+	ts->last_rx_bytes = ts->rx_bytes;
 
-	pdvobjpriv->traffic_stat.cur_tx_tp = (u32)(pdvobjpriv->traffic_stat.cur_tx_bytes * 8 / 2 / 1024 / 1024);
-	pdvobjpriv->traffic_stat.cur_rx_tp = (u32)(pdvobjpriv->traffic_stat.cur_rx_bytes * 8 / 2 / 1024 / 1024);
+	ts->cur_tx_tp = (u32)(ts->cur_tx_bytes * 8 / 2 / 1024 / 1024);
+	ts->cur_rx_tp = (u32)(ts->cur_rx_bytes * 8 / 2 / 1024 / 1024);
 }
 
 bool traffic_status_watchdog(struct adapter *padapter, bool from_timer)
-- 
2.47.3
Re: [PATCH] staging: rtl8723bs: refactor traffic_stat access in collect_traffic_statistics
Posted by kernel test robot 1 month, 3 weeks ago
Hi Mirza,

kernel test robot noticed the following build errors:

[auto build test ERROR on staging/staging-testing]

url:    https://github.com/intel-lab-lkp/linux/commits/Mirza-Ishan-Beg/staging-rtl8723bs-refactor-traffic_stat-access-in-collect_traffic_statistics/20260806-062100
base:   staging/staging-testing
patch link:    https://lore.kernel.org/r/20260803144826.15980-1-seedandsyntax%40gmail.com
patch subject: [PATCH] staging: rtl8723bs: refactor traffic_stat access in collect_traffic_statistics
config: csky-allmodconfig (https://download.01.org/0day-ci/archive/20260807/202608070545.V0T8UE77-lkp@intel.com/config)
compiler: csky-linux-gcc (GCC) 16.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260807/202608070545.V0T8UE77-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202608070545.V0T8UE77-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/staging/rtl8723bs/core/rtw_cmd.c: In function 'collect_traffic_statistics':
>> drivers/staging/rtl8723bs/core/rtw_cmd.c:1112:35: error: initialization of 'struct traffic_stat *' from incompatible pointer type 'struct rtw_traffic_statistics *' [-Wincompatible-pointer-types]
    1112 |         struct traffic_stat *ts = &pdvobjpriv->traffic_stat
         |                                   ^
>> drivers/staging/rtl8723bs/core/rtw_cmd.c:1115:9: error: expected ',' or ';' before 'ts'
    1115 |         ts->tx_bytes = padapter->xmitpriv.tx_bytes;
         |         ^~
>> drivers/staging/rtl8723bs/core/rtw_cmd.c:1116:11: error: invalid use of undefined type 'struct traffic_stat'
    1116 |         ts->tx_pkts = padapter->xmitpriv.tx_pkts;
         |           ^~
   drivers/staging/rtl8723bs/core/rtw_cmd.c:1117:11: error: invalid use of undefined type 'struct traffic_stat'
    1117 |         ts->tx_drop = padapter->xmitpriv.tx_drop;
         |           ^~
   drivers/staging/rtl8723bs/core/rtw_cmd.c:1120:11: error: invalid use of undefined type 'struct traffic_stat'
    1120 |         ts->rx_bytes = padapter->recvpriv.rx_bytes;
         |           ^~
   drivers/staging/rtl8723bs/core/rtw_cmd.c:1121:11: error: invalid use of undefined type 'struct traffic_stat'
    1121 |         ts->rx_pkts = padapter->recvpriv.rx_pkts;
         |           ^~
   drivers/staging/rtl8723bs/core/rtw_cmd.c:1122:11: error: invalid use of undefined type 'struct traffic_stat'
    1122 |         ts->rx_drop = padapter->recvpriv.rx_drop;
         |           ^~
   drivers/staging/rtl8723bs/core/rtw_cmd.c:1125:11: error: invalid use of undefined type 'struct traffic_stat'
    1125 |         ts->cur_tx_bytes = ts->tx_bytes - ts->last_tx_bytes;
         |           ^~
   drivers/staging/rtl8723bs/core/rtw_cmd.c:1125:30: error: invalid use of undefined type 'struct traffic_stat'
    1125 |         ts->cur_tx_bytes = ts->tx_bytes - ts->last_tx_bytes;
         |                              ^~
   drivers/staging/rtl8723bs/core/rtw_cmd.c:1125:45: error: invalid use of undefined type 'struct traffic_stat'
    1125 |         ts->cur_tx_bytes = ts->tx_bytes - ts->last_tx_bytes;
         |                                             ^~
   drivers/staging/rtl8723bs/core/rtw_cmd.c:1126:11: error: invalid use of undefined type 'struct traffic_stat'
    1126 |         ts->cur_rx_bytes = ts->rx_bytes - ts->last_rx_bytes;
         |           ^~
   drivers/staging/rtl8723bs/core/rtw_cmd.c:1126:30: error: invalid use of undefined type 'struct traffic_stat'
    1126 |         ts->cur_rx_bytes = ts->rx_bytes - ts->last_rx_bytes;
         |                              ^~
   drivers/staging/rtl8723bs/core/rtw_cmd.c:1126:45: error: invalid use of undefined type 'struct traffic_stat'
    1126 |         ts->cur_rx_bytes = ts->rx_bytes - ts->last_rx_bytes;
         |                                             ^~
   drivers/staging/rtl8723bs/core/rtw_cmd.c:1127:11: error: invalid use of undefined type 'struct traffic_stat'
    1127 |         ts->last_tx_bytes = ts->tx_bytes;
         |           ^~
   drivers/staging/rtl8723bs/core/rtw_cmd.c:1127:31: error: invalid use of undefined type 'struct traffic_stat'
    1127 |         ts->last_tx_bytes = ts->tx_bytes;
         |                               ^~
   drivers/staging/rtl8723bs/core/rtw_cmd.c:1128:11: error: invalid use of undefined type 'struct traffic_stat'
    1128 |         ts->last_rx_bytes = ts->rx_bytes;
         |           ^~
   drivers/staging/rtl8723bs/core/rtw_cmd.c:1128:31: error: invalid use of undefined type 'struct traffic_stat'
    1128 |         ts->last_rx_bytes = ts->rx_bytes;
         |                               ^~
   drivers/staging/rtl8723bs/core/rtw_cmd.c:1130:11: error: invalid use of undefined type 'struct traffic_stat'
    1130 |         ts->cur_tx_tp = (u32)(ts->cur_tx_bytes * 8 / 2 / 1024 / 1024);
         |           ^~
   drivers/staging/rtl8723bs/core/rtw_cmd.c:1130:33: error: invalid use of undefined type 'struct traffic_stat'
    1130 |         ts->cur_tx_tp = (u32)(ts->cur_tx_bytes * 8 / 2 / 1024 / 1024);
         |                                 ^~
   drivers/staging/rtl8723bs/core/rtw_cmd.c:1131:11: error: invalid use of undefined type 'struct traffic_stat'
    1131 |         ts->cur_rx_tp = (u32)(ts->cur_rx_bytes * 8 / 2 / 1024 / 1024);
         |           ^~
   drivers/staging/rtl8723bs/core/rtw_cmd.c:1131:33: error: invalid use of undefined type 'struct traffic_stat'
    1131 |         ts->cur_rx_tp = (u32)(ts->cur_rx_bytes * 8 / 2 / 1024 / 1024);
         |                                 ^~


vim +1112 drivers/staging/rtl8723bs/core/rtw_cmd.c

  1108	
  1109	static void collect_traffic_statistics(struct adapter *padapter)
  1110	{
  1111		struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
> 1112		struct traffic_stat *ts = &pdvobjpriv->traffic_stat
  1113	
  1114		/*  Tx */
> 1115		ts->tx_bytes = padapter->xmitpriv.tx_bytes;
> 1116		ts->tx_pkts = padapter->xmitpriv.tx_pkts;
  1117		ts->tx_drop = padapter->xmitpriv.tx_drop;
  1118	
  1119		/*  Rx */
  1120		ts->rx_bytes = padapter->recvpriv.rx_bytes;
  1121		ts->rx_pkts = padapter->recvpriv.rx_pkts;
  1122		ts->rx_drop = padapter->recvpriv.rx_drop;
  1123	
  1124		/*  Calculate throughput in last interval */
  1125		ts->cur_tx_bytes = ts->tx_bytes - ts->last_tx_bytes;
  1126		ts->cur_rx_bytes = ts->rx_bytes - ts->last_rx_bytes;
  1127		ts->last_tx_bytes = ts->tx_bytes;
  1128		ts->last_rx_bytes = ts->rx_bytes;
  1129	
  1130		ts->cur_tx_tp = (u32)(ts->cur_tx_bytes * 8 / 2 / 1024 / 1024);
  1131		ts->cur_rx_tp = (u32)(ts->cur_rx_bytes * 8 / 2 / 1024 / 1024);
  1132	}
  1133	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Re: [PATCH] staging: rtl8723bs: refactor traffic_stat access in collect_traffic_statistics
Posted by kernel test robot 1 month, 3 weeks ago
Hi Mirza,

kernel test robot noticed the following build errors:

[auto build test ERROR on staging/staging-testing]

url:    https://github.com/intel-lab-lkp/linux/commits/Mirza-Ishan-Beg/staging-rtl8723bs-refactor-traffic_stat-access-in-collect_traffic_statistics/20260806-062100
base:   staging/staging-testing
patch link:    https://lore.kernel.org/r/20260803144826.15980-1-seedandsyntax%40gmail.com
patch subject: [PATCH] staging: rtl8723bs: refactor traffic_stat access in collect_traffic_statistics
config: arm-randconfig-r051-20260806 (https://download.01.org/0day-ci/archive/20260807/202608070159.puVnOVxb-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260807/202608070159.puVnOVxb-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202608070159.puVnOVxb-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/staging/rtl8723bs/core/rtw_cmd.c: In function 'collect_traffic_statistics':
   drivers/staging/rtl8723bs/core/rtw_cmd.c:1112:28: error: initialization of 'struct traffic_stat *' from incompatible pointer type 'struct rtw_traffic_statistics *' [-Werror=incompatible-pointer-types]
     struct traffic_stat *ts = &pdvobjpriv->traffic_stat
                               ^
   drivers/staging/rtl8723bs/core/rtw_cmd.c:1115:2: error: expected ',' or ';' before 'ts'
     ts->tx_bytes = padapter->xmitpriv.tx_bytes;
     ^~
>> drivers/staging/rtl8723bs/core/rtw_cmd.c:1116:4: error: dereferencing pointer to incomplete type 'struct traffic_stat'
     ts->tx_pkts = padapter->xmitpriv.tx_pkts;
       ^~
   cc1: some warnings being treated as errors


vim +1116 drivers/staging/rtl8723bs/core/rtw_cmd.c

  1108	
  1109	static void collect_traffic_statistics(struct adapter *padapter)
  1110	{
  1111		struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
  1112		struct traffic_stat *ts = &pdvobjpriv->traffic_stat
  1113	
  1114		/*  Tx */
  1115		ts->tx_bytes = padapter->xmitpriv.tx_bytes;
> 1116		ts->tx_pkts = padapter->xmitpriv.tx_pkts;
  1117		ts->tx_drop = padapter->xmitpriv.tx_drop;
  1118	
  1119		/*  Rx */
  1120		ts->rx_bytes = padapter->recvpriv.rx_bytes;
  1121		ts->rx_pkts = padapter->recvpriv.rx_pkts;
  1122		ts->rx_drop = padapter->recvpriv.rx_drop;
  1123	
  1124		/*  Calculate throughput in last interval */
  1125		ts->cur_tx_bytes = ts->tx_bytes - ts->last_tx_bytes;
  1126		ts->cur_rx_bytes = ts->rx_bytes - ts->last_rx_bytes;
  1127		ts->last_tx_bytes = ts->tx_bytes;
  1128		ts->last_rx_bytes = ts->rx_bytes;
  1129	
  1130		ts->cur_tx_tp = (u32)(ts->cur_tx_bytes * 8 / 2 / 1024 / 1024);
  1131		ts->cur_rx_tp = (u32)(ts->cur_rx_bytes * 8 / 2 / 1024 / 1024);
  1132	}
  1133	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Re: [PATCH] staging: rtl8723bs: refactor traffic_stat access in collect_traffic_statistics
Posted by Greg KH 1 month, 4 weeks ago
On Mon, Aug 03, 2026 at 08:18:26PM +0530, Mirza Ishan Beg wrote:
> Replace repetitive `pdvobjpriv->traffic_stat.` dereferencing with a local
> pointer `ts` to improve readability and reduce line length. This resolves
> multiple checkpatch line-length warnings without manual wrapping.
> 
> Suggested-by: Nikolay Kulikov <nikolayof23@gmail.com>

Where was this suggested?

thanks,

greg k-h
Re: [PATCH] staging: rtl8723bs: refactor traffic_stat access in collect_traffic_statistics
Posted by Mirza Ishan Beg 1 month, 4 weeks ago
On Mon, Aug 03, 2026 at 05:09:46PM +0200, Greg KH wrote:
> Where was this suggested?

Hi Greg,

Nikolay suggested adding an intermediate pointer in this thread:
https://lore.kernel.org/linux-staging/agDaGJ5UKndFUNPY@archlinux/

His comment was:
> What about adding an intermediate pointer to traffic_stat? This will
> not only reduce the length of the lines, but will also make the code
> easier to read.

Thanks,
Mirza Ishan Beg
Re: [PATCH] staging: rtl8723bs: refactor traffic_stat access in collect_traffic_statistics
Posted by Greg KH 1 month, 4 weeks ago
On Mon, Aug 03, 2026 at 09:13:36PM +0530, Mirza Ishan Beg wrote:
> On Mon, Aug 03, 2026 at 05:09:46PM +0200, Greg KH wrote:
> > Where was this suggested?
> 
> Hi Greg,
> 
> Nikolay suggested adding an intermediate pointer in this thread:
> https://lore.kernel.org/linux-staging/agDaGJ5UKndFUNPY@archlinux/

Cool, then can you provide this link in the signed-off-by area so that
people can refer to it?

thanks,

greg k-h
[PATCH v2] staging: rtl8723bs: refactor traffic_stat access in collect_traffic_statistics
Posted by Mirza Ishan Beg 1 month, 4 weeks ago
Replace repetitive `pdvobjpriv->traffic_stat.` dereferencing with a local
pointer `ts` to improve readability and reduce line length. This resolves
multiple checkpatch line-length warnings without manual wrapping.

Suggested-by: Nikolay Kulikov <nikolayof23@gmail.com>
Signed-off-by: Mirza Ishan Beg <seedandsyntax@gmail.com>
Link: https://lore.kernel.org/linux-staging/agDaGJ5UKndFUNPY@archlinux/
---
 drivers/staging/rtl8723bs/core/rtw_cmd.c | 25 ++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index ce3dfa1fee26..277eccba293c 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -1109,25 +1109,26 @@ u8 rtw_dynamic_chk_wk_cmd(struct adapter *padapter)
 static void collect_traffic_statistics(struct adapter *padapter)
 {
 	struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
+	struct traffic_stat *ts = &pdvobjpriv->traffic_stat
 
 	/*  Tx */
-	pdvobjpriv->traffic_stat.tx_bytes = padapter->xmitpriv.tx_bytes;
-	pdvobjpriv->traffic_stat.tx_pkts = padapter->xmitpriv.tx_pkts;
-	pdvobjpriv->traffic_stat.tx_drop = padapter->xmitpriv.tx_drop;
+	ts->tx_bytes = padapter->xmitpriv.tx_bytes;
+	ts->tx_pkts = padapter->xmitpriv.tx_pkts;
+	ts->tx_drop = padapter->xmitpriv.tx_drop;
 
 	/*  Rx */
-	pdvobjpriv->traffic_stat.rx_bytes = padapter->recvpriv.rx_bytes;
-	pdvobjpriv->traffic_stat.rx_pkts = padapter->recvpriv.rx_pkts;
-	pdvobjpriv->traffic_stat.rx_drop = padapter->recvpriv.rx_drop;
+	ts->rx_bytes = padapter->recvpriv.rx_bytes;
+	ts->rx_pkts = padapter->recvpriv.rx_pkts;
+	ts->rx_drop = padapter->recvpriv.rx_drop;
 
 	/*  Calculate throughput in last interval */
-	pdvobjpriv->traffic_stat.cur_tx_bytes = pdvobjpriv->traffic_stat.tx_bytes - pdvobjpriv->traffic_stat.last_tx_bytes;
-	pdvobjpriv->traffic_stat.cur_rx_bytes = pdvobjpriv->traffic_stat.rx_bytes - pdvobjpriv->traffic_stat.last_rx_bytes;
-	pdvobjpriv->traffic_stat.last_tx_bytes = pdvobjpriv->traffic_stat.tx_bytes;
-	pdvobjpriv->traffic_stat.last_rx_bytes = pdvobjpriv->traffic_stat.rx_bytes;
+	ts->cur_tx_bytes = ts->tx_bytes - ts->last_tx_bytes;
+	ts->cur_rx_bytes = ts->rx_bytes - ts->last_rx_bytes;
+	ts->last_tx_bytes = ts->tx_bytes;
+	ts->last_rx_bytes = ts->rx_bytes;
 
-	pdvobjpriv->traffic_stat.cur_tx_tp = (u32)(pdvobjpriv->traffic_stat.cur_tx_bytes * 8 / 2 / 1024 / 1024);
-	pdvobjpriv->traffic_stat.cur_rx_tp = (u32)(pdvobjpriv->traffic_stat.cur_rx_bytes * 8 / 2 / 1024 / 1024);
+	ts->cur_tx_tp = (u32)(ts->cur_tx_bytes * 8 / 2 / 1024 / 1024);
+	ts->cur_rx_tp = (u32)(ts->cur_rx_bytes * 8 / 2 / 1024 / 1024);
 }
 
 bool traffic_status_watchdog(struct adapter *padapter, bool from_timer)
-- 
2.47.3
[PATCH v3] staging: rtl8723bs: refactor traffic_stat access in collect_traffic_statistics
Posted by Mirza Ishan Beg 1 month, 4 weeks ago
Replace repetitive `pdvobjpriv->traffic_stat.` dereferencing with a local
pointer `ts` to improve readability and reduce line length. This resolves
multiple checkpatch line-length warnings without manual wrapping.

Suggested-by: Nikolay Kulikov <nikolayof23@gmail.com>
Signed-off-by: Mirza Ishan Beg <seedandsyntax@gmail.com>
Link: https://lore.kernel.org/linux-staging/agDaGJ5UKndFUNPY@archlinux/
---
Changes in v3:
  - Fix missing semicolon in pointer declaration

Changes in v2:
  - Added Link: tag with lore URL as suggested by Greg KH

 drivers/staging/rtl8723bs/core/rtw_cmd.c | 25 ++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index ce3dfa1fee26..4aa430284a59 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -1109,25 +1109,26 @@ u8 rtw_dynamic_chk_wk_cmd(struct adapter *padapter)
 static void collect_traffic_statistics(struct adapter *padapter)
 {
 	struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
+	struct traffic_stat *ts = &pdvobjpriv->traffic_stat;
 
 	/*  Tx */
-	pdvobjpriv->traffic_stat.tx_bytes = padapter->xmitpriv.tx_bytes;
-	pdvobjpriv->traffic_stat.tx_pkts = padapter->xmitpriv.tx_pkts;
-	pdvobjpriv->traffic_stat.tx_drop = padapter->xmitpriv.tx_drop;
+	ts->tx_bytes = padapter->xmitpriv.tx_bytes;
+	ts->tx_pkts = padapter->xmitpriv.tx_pkts;
+	ts->tx_drop = padapter->xmitpriv.tx_drop;
 
 	/*  Rx */
-	pdvobjpriv->traffic_stat.rx_bytes = padapter->recvpriv.rx_bytes;
-	pdvobjpriv->traffic_stat.rx_pkts = padapter->recvpriv.rx_pkts;
-	pdvobjpriv->traffic_stat.rx_drop = padapter->recvpriv.rx_drop;
+	ts->rx_bytes = padapter->recvpriv.rx_bytes;
+	ts->rx_pkts = padapter->recvpriv.rx_pkts;
+	ts->rx_drop = padapter->recvpriv.rx_drop;
 
 	/*  Calculate throughput in last interval */
-	pdvobjpriv->traffic_stat.cur_tx_bytes = pdvobjpriv->traffic_stat.tx_bytes - pdvobjpriv->traffic_stat.last_tx_bytes;
-	pdvobjpriv->traffic_stat.cur_rx_bytes = pdvobjpriv->traffic_stat.rx_bytes - pdvobjpriv->traffic_stat.last_rx_bytes;
-	pdvobjpriv->traffic_stat.last_tx_bytes = pdvobjpriv->traffic_stat.tx_bytes;
-	pdvobjpriv->traffic_stat.last_rx_bytes = pdvobjpriv->traffic_stat.rx_bytes;
+	ts->cur_tx_bytes = ts->tx_bytes - ts->last_tx_bytes;
+	ts->cur_rx_bytes = ts->rx_bytes - ts->last_rx_bytes;
+	ts->last_tx_bytes = ts->tx_bytes;
+	ts->last_rx_bytes = ts->rx_bytes;
 
-	pdvobjpriv->traffic_stat.cur_tx_tp = (u32)(pdvobjpriv->traffic_stat.cur_tx_bytes * 8 / 2 / 1024 / 1024);
-	pdvobjpriv->traffic_stat.cur_rx_tp = (u32)(pdvobjpriv->traffic_stat.cur_rx_bytes * 8 / 2 / 1024 / 1024);
+	ts->cur_tx_tp = (u32)(ts->cur_tx_bytes * 8 / 2 / 1024 / 1024);
+	ts->cur_rx_tp = (u32)(ts->cur_rx_bytes * 8 / 2 / 1024 / 1024);
 }
 
 bool traffic_status_watchdog(struct adapter *padapter, bool from_timer)
-- 
2.47.3
[PATCH v4] staging: rtl8723bs: refactor traffic_stat access in collect_traffic_statistics
Posted by Mirza Ishan Beg 1 month, 3 weeks ago
Replace repetitive `pdvobjpriv->traffic_stat.` dereferencing with a local
pointer `ts` to improve readability and reduce line length. This resolves
multiple checkpatch line-length warnings without manual wrapping.

Suggested-by: Nikolay Kulikov <nikolayof23@gmail.com>
Signed-off-by: Mirza Ishan Beg <seedandsyntax@gmail.com>
Link: https://lore.kernel.org/linux-staging/agDaGJ5UKndFUNPY@archlinux/
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202608070159.puVnOVxb-lkp@intel.com/
Closes: https://lore.kernel.org/oe-kbuild-all/202608070545.V0T8UE77-lkp@intel.com/
---
Changes in v4:
- Fix incorrect struct type: use `rtw_traffic_statistics` instead of `traffic_stat` (reported by kernel test robot)
 drivers/staging/rtl8723bs/core/rtw_cmd.c | 25 ++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index ce3dfa1fee26..59f13f6b85ad 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -1109,25 +1109,26 @@ u8 rtw_dynamic_chk_wk_cmd(struct adapter *padapter)
 static void collect_traffic_statistics(struct adapter *padapter)
 {
 	struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
+	struct rtw_traffic_statistics *ts = &pdvobjpriv->traffic_stat;
 
 	/*  Tx */
-	pdvobjpriv->traffic_stat.tx_bytes = padapter->xmitpriv.tx_bytes;
-	pdvobjpriv->traffic_stat.tx_pkts = padapter->xmitpriv.tx_pkts;
-	pdvobjpriv->traffic_stat.tx_drop = padapter->xmitpriv.tx_drop;
+	ts->tx_bytes = padapter->xmitpriv.tx_bytes;
+	ts->tx_pkts = padapter->xmitpriv.tx_pkts;
+	ts->tx_drop = padapter->xmitpriv.tx_drop;
 
 	/*  Rx */
-	pdvobjpriv->traffic_stat.rx_bytes = padapter->recvpriv.rx_bytes;
-	pdvobjpriv->traffic_stat.rx_pkts = padapter->recvpriv.rx_pkts;
-	pdvobjpriv->traffic_stat.rx_drop = padapter->recvpriv.rx_drop;
+	ts->rx_bytes = padapter->recvpriv.rx_bytes;
+	ts->rx_pkts = padapter->recvpriv.rx_pkts;
+	ts->rx_drop = padapter->recvpriv.rx_drop;
 
 	/*  Calculate throughput in last interval */
-	pdvobjpriv->traffic_stat.cur_tx_bytes = pdvobjpriv->traffic_stat.tx_bytes - pdvobjpriv->traffic_stat.last_tx_bytes;
-	pdvobjpriv->traffic_stat.cur_rx_bytes = pdvobjpriv->traffic_stat.rx_bytes - pdvobjpriv->traffic_stat.last_rx_bytes;
-	pdvobjpriv->traffic_stat.last_tx_bytes = pdvobjpriv->traffic_stat.tx_bytes;
-	pdvobjpriv->traffic_stat.last_rx_bytes = pdvobjpriv->traffic_stat.rx_bytes;
+	ts->cur_tx_bytes = ts->tx_bytes - ts->last_tx_bytes;
+	ts->cur_rx_bytes = ts->rx_bytes - ts->last_rx_bytes;
+	ts->last_tx_bytes = ts->tx_bytes;
+	ts->last_rx_bytes = ts->rx_bytes;
 
-	pdvobjpriv->traffic_stat.cur_tx_tp = (u32)(pdvobjpriv->traffic_stat.cur_tx_bytes * 8 / 2 / 1024 / 1024);
-	pdvobjpriv->traffic_stat.cur_rx_tp = (u32)(pdvobjpriv->traffic_stat.cur_rx_bytes * 8 / 2 / 1024 / 1024);
+	ts->cur_tx_tp = (u32)(ts->cur_tx_bytes * 8 / 2 / 1024 / 1024);
+	ts->cur_rx_tp = (u32)(ts->cur_rx_bytes * 8 / 2 / 1024 / 1024);
 }
 
 bool traffic_status_watchdog(struct adapter *padapter, bool from_timer)
-- 
2.47.3
Re: [PATCH v4] staging: rtl8723bs: refactor traffic_stat access in collect_traffic_statistics
Posted by Greg KH 1 month, 1 week ago
On Fri, Aug 07, 2026 at 08:35:29PM +0530, Mirza Ishan Beg wrote:
> Replace repetitive `pdvobjpriv->traffic_stat.` dereferencing with a local
> pointer `ts` to improve readability and reduce line length. This resolves
> multiple checkpatch line-length warnings without manual wrapping.
> 
> Suggested-by: Nikolay Kulikov <nikolayof23@gmail.com>
> Signed-off-by: Mirza Ishan Beg <seedandsyntax@gmail.com>
> Link: https://lore.kernel.org/linux-staging/agDaGJ5UKndFUNPY@archlinux/
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202608070159.puVnOVxb-lkp@intel.com/
> Closes: https://lore.kernel.org/oe-kbuild-all/202608070545.V0T8UE77-lkp@intel.com/
> ---
> Changes in v4:
> - Fix incorrect struct type: use `rtw_traffic_statistics` instead of `traffic_stat` (reported by kernel test robot)
>  drivers/staging/rtl8723bs/core/rtw_cmd.c | 25 ++++++++++++------------
>  1 file changed, 13 insertions(+), 12 deletions(-)

Where is the 1-3 version info?

And the "Closes:" isn't correct, 0-day was responding to previous errors
you made in other versions of this series, not the original code.
THere's nothing wrong with the original code that needs to be "Closed".

thanks,

greg k-h
Re: [PATCH v4] staging: rtl8723bs: refactor traffic_stat access in collect_traffic_statistics
Posted by Mirza Ishan Beg 1 month ago
On 26/08/25 05:43PM, Greg KH wrote:
> Where is the 1-3 version info?
> 
> And the "Closes:" isn't correct, 0-day was responding to previous errors
> you made in other versions of this series, not the original code.
> THere's nothing wrong with the original code that needs to be "Closed".
> 
> thanks,
> 
> greg k-h

I see, thanks for the feedback. I will prepare v5 with a complete
changelog covering v1 to v5, and I will remove the Reported-by and
Closes tags for the reasons stated: those errors were introduced from my own
earlier patch versions. I'll send v5 shortly.

Regards,
Mirza Ishan Beg
[PATCH v5] staging: rtl8723bs: refactor traffic_stat access in collect_traffic_statistics
Posted by Mirza Ishan Beg 1 month ago
Replace repetitive `pdvobjpriv->traffic_stat.` dereferencing with a local
pointer `ts` to improve readability and reduce line length. This resolves
multiple checkpatch line-length warnings without manual wrapping.

Suggested-by: Nikolay Kulikov <nikolayof23@gmail.com>
Signed-off-by: Mirza Ishan Beg <seedandsyntax@gmail.com>
Link: https://lore.kernel.org/linux-staging/agDaGJ5UKndFUNPY@archlinux/
---
Changes in v5:
- Removed the `Closes` and `Reported-by` tags.

Changes in v4:
- Fix incorrect struct type: use `rtw_traffic_statistics` instead 
  of `traffic_stat` (reported by kernel test robot).
- Added `Closes` and `Reported-by` tags.

Changes in v3:
- Fix missing semicolon in pointer declaration.

Changes in v2:
- Added Link: tag with lore URL as suggested by Greg KH.

Changes in v1:
- Repetitive `pdvobjpriv->traffic_stat.` dereferencing replaced with a
  local pointer `ts` to improve readability and reduce line length.

 drivers/staging/rtl8723bs/core/rtw_cmd.c | 25 ++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index ce3dfa1fee26..59f13f6b85ad 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -1109,25 +1109,26 @@ u8 rtw_dynamic_chk_wk_cmd(struct adapter *padapter)
 static void collect_traffic_statistics(struct adapter *padapter)
 {
 	struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
+	struct rtw_traffic_statistics *ts = &pdvobjpriv->traffic_stat;
 
 	/*  Tx */
-	pdvobjpriv->traffic_stat.tx_bytes = padapter->xmitpriv.tx_bytes;
-	pdvobjpriv->traffic_stat.tx_pkts = padapter->xmitpriv.tx_pkts;
-	pdvobjpriv->traffic_stat.tx_drop = padapter->xmitpriv.tx_drop;
+	ts->tx_bytes = padapter->xmitpriv.tx_bytes;
+	ts->tx_pkts = padapter->xmitpriv.tx_pkts;
+	ts->tx_drop = padapter->xmitpriv.tx_drop;
 
 	/*  Rx */
-	pdvobjpriv->traffic_stat.rx_bytes = padapter->recvpriv.rx_bytes;
-	pdvobjpriv->traffic_stat.rx_pkts = padapter->recvpriv.rx_pkts;
-	pdvobjpriv->traffic_stat.rx_drop = padapter->recvpriv.rx_drop;
+	ts->rx_bytes = padapter->recvpriv.rx_bytes;
+	ts->rx_pkts = padapter->recvpriv.rx_pkts;
+	ts->rx_drop = padapter->recvpriv.rx_drop;
 
 	/*  Calculate throughput in last interval */
-	pdvobjpriv->traffic_stat.cur_tx_bytes = pdvobjpriv->traffic_stat.tx_bytes - pdvobjpriv->traffic_stat.last_tx_bytes;
-	pdvobjpriv->traffic_stat.cur_rx_bytes = pdvobjpriv->traffic_stat.rx_bytes - pdvobjpriv->traffic_stat.last_rx_bytes;
-	pdvobjpriv->traffic_stat.last_tx_bytes = pdvobjpriv->traffic_stat.tx_bytes;
-	pdvobjpriv->traffic_stat.last_rx_bytes = pdvobjpriv->traffic_stat.rx_bytes;
+	ts->cur_tx_bytes = ts->tx_bytes - ts->last_tx_bytes;
+	ts->cur_rx_bytes = ts->rx_bytes - ts->last_rx_bytes;
+	ts->last_tx_bytes = ts->tx_bytes;
+	ts->last_rx_bytes = ts->rx_bytes;
 
-	pdvobjpriv->traffic_stat.cur_tx_tp = (u32)(pdvobjpriv->traffic_stat.cur_tx_bytes * 8 / 2 / 1024 / 1024);
-	pdvobjpriv->traffic_stat.cur_rx_tp = (u32)(pdvobjpriv->traffic_stat.cur_rx_bytes * 8 / 2 / 1024 / 1024);
+	ts->cur_tx_tp = (u32)(ts->cur_tx_bytes * 8 / 2 / 1024 / 1024);
+	ts->cur_rx_tp = (u32)(ts->cur_rx_bytes * 8 / 2 / 1024 / 1024);
 }
 
 bool traffic_status_watchdog(struct adapter *padapter, bool from_timer)
-- 
2.47.3