Re: [PATCH 4/7] staging: rtl8723bs: replace DBG_871X_SEL_NL with netdev_dbg()

2021-04-14 Thread Greg KH
On Wed, Apr 14, 2021 at 11:43:41AM +0200, Fabio Aiuto wrote:
> On Wed, Apr 14, 2021 at 10:26:01AM +0200, Greg KH wrote:
> > > - DBG_871X_SEL_NL(sel, "%10s %16s %8s %10s %11s %14s\n",
> > > - "TH_L2H_ini", "TH_EDCCA_HL_diff", "IGI_Base",
> > > - "ForceEDCCA", "AdapEn_RSSI", "IGI_LowerBound");
> > > - DBG_871X_SEL_NL(sel, "0x%-8x %-16d 0x%-6x %-10d %-11u %-14u\n",
> > > - (u8)odm->TH_L2H_ini,
> > > - odm->TH_EDCCA_HL_diff,
> > > - odm->IGI_Base,
> > > - odm->ForceEDCCA,
> > > - odm->AdapEn_RSSI,
> > > - odm->IGI_LowerBound
> > > - );
> > > + netdev_dbg(adapter->pnetdev, "%10s %16s %8s %10s %11s %14s\n",
> > > +"TH_L2H_ini", "TH_EDCCA_HL_diff", "IGI_Base", "ForceEDCCA",
> > > +"AdapEn_RSSI", "IGI_LowerBound");netdev_dbg(adapter->pnetdev,
> > > +"0x%-8x %-16d 
> > > 0x%-6x %-10d %-11u %-14u\n",
> > > +
> > > (u8)odm->TH_L2H_ini,
> > > +
> > > odm->TH_EDCCA_HL_diff,
> > > +odm->IGI_Base,
> > > +odm->ForceEDCCA,
> > > +odm->AdapEn_RSSI,
> > > +
> > > odm->IGI_LowerBound);
> > 
> > Something went wrong with this change :(
> 
> thanks Greg, I sent an example to Julia, that reproduce the problem.
> As soon as it gets fixed I will send you a v2.

You can fix it up yourself "by hand" for now, no need to wait for a tool
fix :)


Re: [PATCH 4/7] staging: rtl8723bs: replace DBG_871X_SEL_NL with netdev_dbg()

2021-04-14 Thread Fabio Aiuto
On Wed, Apr 14, 2021 at 10:26:01AM +0200, Greg KH wrote:
> > -   DBG_871X_SEL_NL(sel, "%10s %16s %8s %10s %11s %14s\n",
> > -   "TH_L2H_ini", "TH_EDCCA_HL_diff", "IGI_Base",
> > -   "ForceEDCCA", "AdapEn_RSSI", "IGI_LowerBound");
> > -   DBG_871X_SEL_NL(sel, "0x%-8x %-16d 0x%-6x %-10d %-11u %-14u\n",
> > -   (u8)odm->TH_L2H_ini,
> > -   odm->TH_EDCCA_HL_diff,
> > -   odm->IGI_Base,
> > -   odm->ForceEDCCA,
> > -   odm->AdapEn_RSSI,
> > -   odm->IGI_LowerBound
> > -   );
> > +   netdev_dbg(adapter->pnetdev, "%10s %16s %8s %10s %11s %14s\n",
> > +  "TH_L2H_ini", "TH_EDCCA_HL_diff", "IGI_Base", "ForceEDCCA",
> > +  "AdapEn_RSSI", "IGI_LowerBound");netdev_dbg(adapter->pnetdev,
> > +  "0x%-8x %-16d 
> > 0x%-6x %-10d %-11u %-14u\n",
> > +  
> > (u8)odm->TH_L2H_ini,
> > +  
> > odm->TH_EDCCA_HL_diff,
> > +  odm->IGI_Base,
> > +  odm->ForceEDCCA,
> > +  odm->AdapEn_RSSI,
> > +  
> > odm->IGI_LowerBound);
> 
> Something went wrong with this change :(

thanks Greg, I sent an example to Julia, that reproduce the problem.
As soon as it gets fixed I will send you a v2.

fabio


Re: [PATCH 4/7] staging: rtl8723bs: replace DBG_871X_SEL_NL with netdev_dbg()

2021-04-14 Thread Greg KH
On Tue, Apr 13, 2021 at 04:56:32PM +0200, Fabio Aiuto wrote:
> replace DGB_871X_SEL_NL macro with netdev_dbg().
> 
> DBG_871X_SEL_NL macro expands to a raw prink call or a
> seq_printf if selected stream _is not_ a local
> debug symbol set to null.
> This second scenario never occurs so replace
> all macro usages with netdev_dbg().
> 
> This is done with the following coccinelle script:
> 
> @@
> expression sel;
> expression list args;
> identifier padapter;
> identifier func;
> @@
> 
> func(..., struct adapter *padapter, ...) {
>   <...
> - DBG_871X_SEL_NL(sel, args);
> + netdev_dbg(padapter->pnetdev, args);
>   ...>
> }
> 
> Signed-off-by: Fabio Aiuto 
> ---
>  drivers/staging/rtl8723bs/core/rtw_debug.c | 16 +++
>  drivers/staging/rtl8723bs/core/rtw_odm.c   | 49 +++---
>  drivers/staging/rtl8723bs/hal/hal_com.c| 31 ++
>  3 files changed, 46 insertions(+), 50 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/core/rtw_debug.c 
> b/drivers/staging/rtl8723bs/core/rtw_debug.c
> index 324c7e5248f8..79fd968bb147 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_debug.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_debug.c
> @@ -20,7 +20,7 @@ void sd_f0_reg_dump(void *sel, struct adapter *adapter)
>  
>   for (i = 0x0; i <= 0xff; i++) {
>   if (i%16 == 0)
> - DBG_871X_SEL_NL(sel, "0x%02x ", i);
> + netdev_dbg(adapter->pnetdev, "0x%02x ", i);
>  
>   DBG_871X_SEL(sel, "%02x ", rtw_sd_f0_read8(adapter, i));
>  
> @@ -35,11 +35,11 @@ void mac_reg_dump(void *sel, struct adapter *adapter)
>  {
>   int i, j = 1;
>  
> - DBG_871X_SEL_NL(sel, "=== MAC REG ===\n");
> + netdev_dbg(adapter->pnetdev, "=== MAC REG ===\n");
>  
>   for (i = 0x0; i < 0x800; i += 4) {
>   if (j%4 == 1)
> - DBG_871X_SEL_NL(sel, "0x%03x", i);
> + netdev_dbg(adapter->pnetdev, "0x%03x", i);
>   DBG_871X_SEL(sel, " 0x%08x ", rtw_read32(adapter, i));
>   if ((j++)%4 == 0)
>   DBG_871X_SEL(sel, "\n");
> @@ -50,10 +50,10 @@ void bb_reg_dump(void *sel, struct adapter *adapter)
>  {
>   int i, j = 1;
>  
> - DBG_871X_SEL_NL(sel, "=== BB REG ===\n");
> + netdev_dbg(adapter->pnetdev, "=== BB REG ===\n");
>   for (i = 0x800; i < 0x1000 ; i += 4) {
>   if (j%4 == 1)
> - DBG_871X_SEL_NL(sel, "0x%03x", i);
> + netdev_dbg(adapter->pnetdev, "0x%03x", i);
>   DBG_871X_SEL(sel, " 0x%08x ", rtw_read32(adapter, i));
>   if ((j++)%4 == 0)
>   DBG_871X_SEL(sel, "\n");
> @@ -73,14 +73,14 @@ void rf_reg_dump(void *sel, struct adapter *adapter)
>   else
>   path_nums = 2;
>  
> - DBG_871X_SEL_NL(sel, "=== RF REG ===\n");
> + netdev_dbg(adapter->pnetdev, "=== RF REG ===\n");
>  
>   for (path = 0; path < path_nums; path++) {
> - DBG_871X_SEL_NL(sel, "RF_Path(%x)\n", path);
> + netdev_dbg(adapter->pnetdev, "RF_Path(%x)\n", path);
>   for (i = 0; i < 0x100; i++) {
>   value = rtw_hal_read_rfreg(adapter, path, i, 
> 0x);
>   if (j%4 == 1)
> - DBG_871X_SEL_NL(sel, "0x%02x ", i);
> + netdev_dbg(adapter->pnetdev, "0x%02x ", i);
>   DBG_871X_SEL(sel, " 0x%08x ", value);
>   if ((j++)%4 == 0)
>   DBG_871X_SEL(sel, "\n");
> diff --git a/drivers/staging/rtl8723bs/core/rtw_odm.c 
> b/drivers/staging/rtl8723bs/core/rtw_odm.c
> index 53f7cc0444ba..084f6ae040ee 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_odm.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_odm.c
> @@ -96,12 +96,13 @@ void rtw_odm_dbg_comp_msg(void *sel, struct adapter 
> *adapter)
>   int i;
>  
>   rtw_hal_get_def_var(adapter, HW_DEF_ODM_DBG_FLAG, _comp);
> - DBG_871X_SEL_NL(sel, "odm.DebugComponents = 0x%016llx\n", dbg_comp);
> + netdev_dbg(adapter->pnetdev, "odm.DebugComponents = 0x%016llx\n",
> +dbg_comp);
>   for (i = 0; i < RTW_ODM_COMP_MAX; i++) {
>   if (odm_comp_str[i])
> - DBG_871X_SEL_NL(sel, "%cBIT%-2d %s\n",
> - (BIT0 << i) & dbg_comp ? '+' : ' ',
> - i, odm_comp_str[i]);
> + netdev_dbg(adapter->pnetdev, "%cBIT%-2d %s\n",
> +(BIT0 << i) & dbg_comp ? '+' : ' ', i,
> +odm_comp_str[i]);
>   }
>  }
>  
> @@ -116,11 +117,11 @@ void rtw_odm_dbg_level_msg(void *sel, struct adapter 
> *adapter)
>   int i;
>  
>   rtw_hal_get_def_var(adapter, HW_DEF_ODM_DBG_LEVEL, _level);
> - DBG_871X_SEL_NL(sel, "odm.DebugLevel = %u\n", dbg_level);
> + 

[PATCH 4/7] staging: rtl8723bs: replace DBG_871X_SEL_NL with netdev_dbg()

2021-04-13 Thread Fabio Aiuto
replace DGB_871X_SEL_NL macro with netdev_dbg().

DBG_871X_SEL_NL macro expands to a raw prink call or a
seq_printf if selected stream _is not_ a local
debug symbol set to null.
This second scenario never occurs so replace
all macro usages with netdev_dbg().

This is done with the following coccinelle script:

@@
expression sel;
expression list args;
identifier padapter;
identifier func;
@@

func(..., struct adapter *padapter, ...) {
<...
-   DBG_871X_SEL_NL(sel, args);
+   netdev_dbg(padapter->pnetdev, args);
...>
}

Signed-off-by: Fabio Aiuto 
---
 drivers/staging/rtl8723bs/core/rtw_debug.c | 16 +++
 drivers/staging/rtl8723bs/core/rtw_odm.c   | 49 +++---
 drivers/staging/rtl8723bs/hal/hal_com.c| 31 ++
 3 files changed, 46 insertions(+), 50 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_debug.c 
b/drivers/staging/rtl8723bs/core/rtw_debug.c
index 324c7e5248f8..79fd968bb147 100644
--- a/drivers/staging/rtl8723bs/core/rtw_debug.c
+++ b/drivers/staging/rtl8723bs/core/rtw_debug.c
@@ -20,7 +20,7 @@ void sd_f0_reg_dump(void *sel, struct adapter *adapter)
 
for (i = 0x0; i <= 0xff; i++) {
if (i%16 == 0)
-   DBG_871X_SEL_NL(sel, "0x%02x ", i);
+   netdev_dbg(adapter->pnetdev, "0x%02x ", i);
 
DBG_871X_SEL(sel, "%02x ", rtw_sd_f0_read8(adapter, i));
 
@@ -35,11 +35,11 @@ void mac_reg_dump(void *sel, struct adapter *adapter)
 {
int i, j = 1;
 
-   DBG_871X_SEL_NL(sel, "=== MAC REG ===\n");
+   netdev_dbg(adapter->pnetdev, "=== MAC REG ===\n");
 
for (i = 0x0; i < 0x800; i += 4) {
if (j%4 == 1)
-   DBG_871X_SEL_NL(sel, "0x%03x", i);
+   netdev_dbg(adapter->pnetdev, "0x%03x", i);
DBG_871X_SEL(sel, " 0x%08x ", rtw_read32(adapter, i));
if ((j++)%4 == 0)
DBG_871X_SEL(sel, "\n");
@@ -50,10 +50,10 @@ void bb_reg_dump(void *sel, struct adapter *adapter)
 {
int i, j = 1;
 
-   DBG_871X_SEL_NL(sel, "=== BB REG ===\n");
+   netdev_dbg(adapter->pnetdev, "=== BB REG ===\n");
for (i = 0x800; i < 0x1000 ; i += 4) {
if (j%4 == 1)
-   DBG_871X_SEL_NL(sel, "0x%03x", i);
+   netdev_dbg(adapter->pnetdev, "0x%03x", i);
DBG_871X_SEL(sel, " 0x%08x ", rtw_read32(adapter, i));
if ((j++)%4 == 0)
DBG_871X_SEL(sel, "\n");
@@ -73,14 +73,14 @@ void rf_reg_dump(void *sel, struct adapter *adapter)
else
path_nums = 2;
 
-   DBG_871X_SEL_NL(sel, "=== RF REG ===\n");
+   netdev_dbg(adapter->pnetdev, "=== RF REG ===\n");
 
for (path = 0; path < path_nums; path++) {
-   DBG_871X_SEL_NL(sel, "RF_Path(%x)\n", path);
+   netdev_dbg(adapter->pnetdev, "RF_Path(%x)\n", path);
for (i = 0; i < 0x100; i++) {
value = rtw_hal_read_rfreg(adapter, path, i, 
0x);
if (j%4 == 1)
-   DBG_871X_SEL_NL(sel, "0x%02x ", i);
+   netdev_dbg(adapter->pnetdev, "0x%02x ", i);
DBG_871X_SEL(sel, " 0x%08x ", value);
if ((j++)%4 == 0)
DBG_871X_SEL(sel, "\n");
diff --git a/drivers/staging/rtl8723bs/core/rtw_odm.c 
b/drivers/staging/rtl8723bs/core/rtw_odm.c
index 53f7cc0444ba..084f6ae040ee 100644
--- a/drivers/staging/rtl8723bs/core/rtw_odm.c
+++ b/drivers/staging/rtl8723bs/core/rtw_odm.c
@@ -96,12 +96,13 @@ void rtw_odm_dbg_comp_msg(void *sel, struct adapter 
*adapter)
int i;
 
rtw_hal_get_def_var(adapter, HW_DEF_ODM_DBG_FLAG, _comp);
-   DBG_871X_SEL_NL(sel, "odm.DebugComponents = 0x%016llx\n", dbg_comp);
+   netdev_dbg(adapter->pnetdev, "odm.DebugComponents = 0x%016llx\n",
+  dbg_comp);
for (i = 0; i < RTW_ODM_COMP_MAX; i++) {
if (odm_comp_str[i])
-   DBG_871X_SEL_NL(sel, "%cBIT%-2d %s\n",
-   (BIT0 << i) & dbg_comp ? '+' : ' ',
-   i, odm_comp_str[i]);
+   netdev_dbg(adapter->pnetdev, "%cBIT%-2d %s\n",
+  (BIT0 << i) & dbg_comp ? '+' : ' ', i,
+  odm_comp_str[i]);
}
 }
 
@@ -116,11 +117,11 @@ void rtw_odm_dbg_level_msg(void *sel, struct adapter 
*adapter)
int i;
 
rtw_hal_get_def_var(adapter, HW_DEF_ODM_DBG_LEVEL, _level);
-   DBG_871X_SEL_NL(sel, "odm.DebugLevel = %u\n", dbg_level);
+   netdev_dbg(adapter->pnetdev, "odm.DebugLevel = %u\n", dbg_level);
for (i = 0; i < RTW_ODM_DBG_LEVEL_NUM; i++) {
if (odm_dbg_level_str[i])
-   

[PATCH 4/7] staging: rtl8723bs: replace DBG_871X_SEL_NL with netdev_dbg()

2021-04-13 Thread Fabio Aiuto
replace DGB_871X_SEL_NL macro with netdev_dbg().

DBG_871X_SEL_NL macro expands to a raw prink call or a
seq_printf if selected stream _is not_ a local
debug symbol set to null.
This second scenario never occurs so replace
all macro usages with netdev_dbg().

This is done with the following coccinelle script:

@@
expression sel;
expression list args;
identifier padapter;
identifier func;
@@

func(..., struct adapter *padapter, ...) {
<...
-   DBG_871X_SEL_NL(sel, args);
+   netdev_dbg(padapter->pnetdev, args);
...>
}

@rule@
identifier func, context, padapter;
@@

func(void *context)
{
...
struct adapter *padapter = context;
...
}

@@
expression sel;
expression list args;
identifier rule.padapter;
identifier rule.func, rule.context;
@@

func(void *context)
{
<...
-   DBG_871X_SEL_NL(sel, args);
+   netdev_dbg(padapter->pnetdev, args);
...>
}

@@
expression sel;
expression list args;
expression get_dev;
identifier func, dev;
@@

func(...)
{
...
struct net_device *dev = get_dev;
<...
-   DBG_871X_SEL_NL(sel, args);
+   netdev_dbg(dev, args);
...>
}

@@
expression sel;
expression list args;
identifier func, dev;
@@

func(struct net_device *dev)
{
<...
-   DBG_871X_SEL_NL(sel, args);
+   netdev_dbg(dev, args);
...>
}

@@
expression sel;
expression list args;
identifier func, dvobj;
@@

func(struct dvobj_priv *dvobj)
{
<...
-   DBG_871X_SEL_NL(sel, args);
+   netdev_dbg(dvobj->if1->pnetdev, args);
...>
}

Signed-off-by: Fabio Aiuto 
---
 drivers/staging/rtl8723bs/core/rtw_debug.c | 16 +++
 drivers/staging/rtl8723bs/core/rtw_odm.c   | 49 +++---
 drivers/staging/rtl8723bs/hal/hal_com.c| 31 ++
 3 files changed, 46 insertions(+), 50 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_debug.c 
b/drivers/staging/rtl8723bs/core/rtw_debug.c
index 324c7e5248f8..79fd968bb147 100644
--- a/drivers/staging/rtl8723bs/core/rtw_debug.c
+++ b/drivers/staging/rtl8723bs/core/rtw_debug.c
@@ -20,7 +20,7 @@ void sd_f0_reg_dump(void *sel, struct adapter *adapter)
 
for (i = 0x0; i <= 0xff; i++) {
if (i%16 == 0)
-   DBG_871X_SEL_NL(sel, "0x%02x ", i);
+   netdev_dbg(adapter->pnetdev, "0x%02x ", i);
 
DBG_871X_SEL(sel, "%02x ", rtw_sd_f0_read8(adapter, i));
 
@@ -35,11 +35,11 @@ void mac_reg_dump(void *sel, struct adapter *adapter)
 {
int i, j = 1;
 
-   DBG_871X_SEL_NL(sel, "=== MAC REG ===\n");
+   netdev_dbg(adapter->pnetdev, "=== MAC REG ===\n");
 
for (i = 0x0; i < 0x800; i += 4) {
if (j%4 == 1)
-   DBG_871X_SEL_NL(sel, "0x%03x", i);
+   netdev_dbg(adapter->pnetdev, "0x%03x", i);
DBG_871X_SEL(sel, " 0x%08x ", rtw_read32(adapter, i));
if ((j++)%4 == 0)
DBG_871X_SEL(sel, "\n");
@@ -50,10 +50,10 @@ void bb_reg_dump(void *sel, struct adapter *adapter)
 {
int i, j = 1;
 
-   DBG_871X_SEL_NL(sel, "=== BB REG ===\n");
+   netdev_dbg(adapter->pnetdev, "=== BB REG ===\n");
for (i = 0x800; i < 0x1000 ; i += 4) {
if (j%4 == 1)
-   DBG_871X_SEL_NL(sel, "0x%03x", i);
+   netdev_dbg(adapter->pnetdev, "0x%03x", i);
DBG_871X_SEL(sel, " 0x%08x ", rtw_read32(adapter, i));
if ((j++)%4 == 0)
DBG_871X_SEL(sel, "\n");
@@ -73,14 +73,14 @@ void rf_reg_dump(void *sel, struct adapter *adapter)
else
path_nums = 2;
 
-   DBG_871X_SEL_NL(sel, "=== RF REG ===\n");
+   netdev_dbg(adapter->pnetdev, "=== RF REG ===\n");
 
for (path = 0; path < path_nums; path++) {
-   DBG_871X_SEL_NL(sel, "RF_Path(%x)\n", path);
+   netdev_dbg(adapter->pnetdev, "RF_Path(%x)\n", path);
for (i = 0; i < 0x100; i++) {
value = rtw_hal_read_rfreg(adapter, path, i, 
0x);
if (j%4 == 1)
-   DBG_871X_SEL_NL(sel, "0x%02x ", i);
+   netdev_dbg(adapter->pnetdev, "0x%02x ", i);
DBG_871X_SEL(sel, " 0x%08x ", value);
if ((j++)%4 == 0)
DBG_871X_SEL(sel, "\n");
diff --git a/drivers/staging/rtl8723bs/core/rtw_odm.c 
b/drivers/staging/rtl8723bs/core/rtw_odm.c
index 53f7cc0444ba..084f6ae040ee 100644
--- a/drivers/staging/rtl8723bs/core/rtw_odm.c
+++ b/drivers/staging/rtl8723bs/core/rtw_odm.c
@@ -96,12 +96,13 @@ void rtw_odm_dbg_comp_msg(void *sel, struct adapter 
*adapter)
int i;
 
rtw_hal_get_def_var(adapter, HW_DEF_ODM_DBG_FLAG, _comp);
-   DBG_871X_SEL_NL(sel, "odm.DebugComponents = 0x%016llx\n", dbg_comp);
+