[PATCH 2/3] staging: rtl8188eu: rename Hal8188EPhyReg.h

2018-07-04 Thread Michael Straube
Rename header file to avoid CamelCase.

Hal8188EPhyReg.h -> hal8188e_phy_reg.h

Signed-off-by: Michael Straube 
---
 .../rtl8188eu/include/{Hal8188EPhyReg.h => hal8188e_phy_reg.h}  | 0
 drivers/staging/rtl8188eu/include/rtl8188e_hal.h| 2 +-
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename drivers/staging/rtl8188eu/include/{Hal8188EPhyReg.h => 
hal8188e_phy_reg.h} (100%)

diff --git a/drivers/staging/rtl8188eu/include/Hal8188EPhyReg.h 
b/drivers/staging/rtl8188eu/include/hal8188e_phy_reg.h
similarity index 100%
rename from drivers/staging/rtl8188eu/include/Hal8188EPhyReg.h
rename to drivers/staging/rtl8188eu/include/hal8188e_phy_reg.h
diff --git a/drivers/staging/rtl8188eu/include/rtl8188e_hal.h 
b/drivers/staging/rtl8188eu/include/rtl8188e_hal.h
index e04e97e98ab7..a86b07d3c82a 100644
--- a/drivers/staging/rtl8188eu/include/rtl8188e_hal.h
+++ b/drivers/staging/rtl8188eu/include/rtl8188e_hal.h
@@ -10,7 +10,7 @@
 
 /* include HAL Related header after HAL Related compiling flags */
 #include "rtl8188e_spec.h"
-#include "Hal8188EPhyReg.h"
+#include "hal8188e_phy_reg.h"
 #include "hal8188e_phy_cfg.h"
 #include "rtl8188e_dm.h"
 #include "rtl8188e_recv.h"
-- 
2.18.0



[PATCH 3/3] staging: rtl8188eu: rename Hal8188ERateAdaptive

2018-07-04 Thread Michael Straube
Rename header and source file to avoid CamelCase.

Hal8188ERateAdaptive.h -> hal8188e_rate_adaptive.h
Hal8188ERateAdaptive.c -> hal8188e_rate_adaptive.c

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/Makefile  | 2 +-
 .../hal/{Hal8188ERateAdaptive.c => hal8188e_rate_adaptive.c}| 0
 .../{Hal8188ERateAdaptive.h => hal8188e_rate_adaptive.h}| 0
 drivers/staging/rtl8188eu/include/odm_precomp.h | 2 +-
 4 files changed, 2 insertions(+), 2 deletions(-)
 rename drivers/staging/rtl8188eu/hal/{Hal8188ERateAdaptive.c => 
hal8188e_rate_adaptive.c} (100%)
 rename drivers/staging/rtl8188eu/include/{Hal8188ERateAdaptive.h => 
hal8188e_rate_adaptive.h} (100%)

diff --git a/drivers/staging/rtl8188eu/Makefile 
b/drivers/staging/rtl8188eu/Makefile
index 033fb2e6950d..aa6ea65d05fe 100644
--- a/drivers/staging/rtl8188eu/Makefile
+++ b/drivers/staging/rtl8188eu/Makefile
@@ -24,7 +24,7 @@ r8188eu-y :=  \
hal/rf_cfg.o \
hal/pwrseqcmd.o \
hal/pwrseq.o \
-   hal/Hal8188ERateAdaptive.o\
+   hal/hal8188e_rate_adaptive.o \
hal/hal_intf.o  \
hal/hal_com.o   \
hal/odm.o   \
diff --git a/drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c 
b/drivers/staging/rtl8188eu/hal/hal8188e_rate_adaptive.c
similarity index 100%
rename from drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c
rename to drivers/staging/rtl8188eu/hal/hal8188e_rate_adaptive.c
diff --git a/drivers/staging/rtl8188eu/include/Hal8188ERateAdaptive.h 
b/drivers/staging/rtl8188eu/include/hal8188e_rate_adaptive.h
similarity index 100%
rename from drivers/staging/rtl8188eu/include/Hal8188ERateAdaptive.h
rename to drivers/staging/rtl8188eu/include/hal8188e_rate_adaptive.h
diff --git a/drivers/staging/rtl8188eu/include/odm_precomp.h 
b/drivers/staging/rtl8188eu/include/odm_precomp.h
index c01714be141f..f00967fd9599 100644
--- a/drivers/staging/rtl8188eu/include/odm_precomp.h
+++ b/drivers/staging/rtl8188eu/include/odm_precomp.h
@@ -26,7 +26,7 @@
 #include "odm_debug.h"
 #include "odm_RegDefine11N.h"
 
-#include "Hal8188ERateAdaptive.h"/* for  RA,Power training */
+#include "hal8188e_rate_adaptive.h" /* for RA,Power training */
 #include "rtl8188e_hal.h"
 
 #include "odm_reg.h"
-- 
2.18.0



[PATCH 3/3] staging: rtl8188eu: rename Hal8188ERateAdaptive

2018-07-04 Thread Michael Straube
Rename header and source file to avoid CamelCase.

Hal8188ERateAdaptive.h -> hal8188e_rate_adaptive.h
Hal8188ERateAdaptive.c -> hal8188e_rate_adaptive.c

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/Makefile  | 2 +-
 .../hal/{Hal8188ERateAdaptive.c => hal8188e_rate_adaptive.c}| 0
 .../{Hal8188ERateAdaptive.h => hal8188e_rate_adaptive.h}| 0
 drivers/staging/rtl8188eu/include/odm_precomp.h | 2 +-
 4 files changed, 2 insertions(+), 2 deletions(-)
 rename drivers/staging/rtl8188eu/hal/{Hal8188ERateAdaptive.c => 
hal8188e_rate_adaptive.c} (100%)
 rename drivers/staging/rtl8188eu/include/{Hal8188ERateAdaptive.h => 
hal8188e_rate_adaptive.h} (100%)

diff --git a/drivers/staging/rtl8188eu/Makefile 
b/drivers/staging/rtl8188eu/Makefile
index 033fb2e6950d..aa6ea65d05fe 100644
--- a/drivers/staging/rtl8188eu/Makefile
+++ b/drivers/staging/rtl8188eu/Makefile
@@ -24,7 +24,7 @@ r8188eu-y :=  \
hal/rf_cfg.o \
hal/pwrseqcmd.o \
hal/pwrseq.o \
-   hal/Hal8188ERateAdaptive.o\
+   hal/hal8188e_rate_adaptive.o \
hal/hal_intf.o  \
hal/hal_com.o   \
hal/odm.o   \
diff --git a/drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c 
b/drivers/staging/rtl8188eu/hal/hal8188e_rate_adaptive.c
similarity index 100%
rename from drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c
rename to drivers/staging/rtl8188eu/hal/hal8188e_rate_adaptive.c
diff --git a/drivers/staging/rtl8188eu/include/Hal8188ERateAdaptive.h 
b/drivers/staging/rtl8188eu/include/hal8188e_rate_adaptive.h
similarity index 100%
rename from drivers/staging/rtl8188eu/include/Hal8188ERateAdaptive.h
rename to drivers/staging/rtl8188eu/include/hal8188e_rate_adaptive.h
diff --git a/drivers/staging/rtl8188eu/include/odm_precomp.h 
b/drivers/staging/rtl8188eu/include/odm_precomp.h
index c01714be141f..f00967fd9599 100644
--- a/drivers/staging/rtl8188eu/include/odm_precomp.h
+++ b/drivers/staging/rtl8188eu/include/odm_precomp.h
@@ -26,7 +26,7 @@
 #include "odm_debug.h"
 #include "odm_RegDefine11N.h"
 
-#include "Hal8188ERateAdaptive.h"/* for  RA,Power training */
+#include "hal8188e_rate_adaptive.h" /* for RA,Power training */
 #include "rtl8188e_hal.h"
 
 #include "odm_reg.h"
-- 
2.18.0



[PATCH] staging: rtl8188eu: remove rtw_mp_phy_regdef.h

2018-07-02 Thread Michael Straube
The header rtw_mp_phy_regdef.h is not used anywhere.
'git grep rtw_mp_phy_regdef.h' returns nothing, remove the file.

Signed-off-by: Michael Straube 
---
 .../rtl8188eu/include/rtw_mp_phy_regdef.h | 1078 -
 1 file changed, 1078 deletions(-)
 delete mode 100644 drivers/staging/rtl8188eu/include/rtw_mp_phy_regdef.h

diff --git a/drivers/staging/rtl8188eu/include/rtw_mp_phy_regdef.h 
b/drivers/staging/rtl8188eu/include/rtw_mp_phy_regdef.h
deleted file mode 100644
index 9276e2321f2a..
--- a/drivers/staging/rtl8188eu/include/rtw_mp_phy_regdef.h
+++ /dev/null
@@ -1,1078 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/**
- *
- * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
- *
- 
**/
-/*
- *
- * Module: __RTW_MP_PHY_REGDEF_H_
- *
- *
- * Note:   1. Define PMAC/BB register map
- * 2. Define RF register map
- * 3. PMAC/BB register bit mask.
- * 4. RF reg bit mask.
- * 5. Other BB/RF relative definition.
- *
- *
- * Export: Constants, macro, functions(API), global variables(None).
- *
- * Abbrev:
- *
- * History:
- * DataWho Remark
- * 08/07/2007  MHC 1. Porting from 9x series PHYCFG.h.
- * 2. Reorganize code architecture.
- * 09/25/2008  MH  1. Add RL6052 register definition
- *
- */
-#ifndef __RTW_MP_PHY_REGDEF_H_
-#define __RTW_MP_PHY_REGDEF_H_
-
-
-/*--Define Parameters---*/
-
-/*  */
-/* 8192S Regsiter offset definition */
-/*  */
-
-/*  */
-/*  BB-PHY register PMAC 0x100 PHY 0x800 - 0xEFF */
-/*  1. PMAC duplicate register due to connection: RF_Mode, TRxRN, NumOf L-STF 
*/
-/*  2. 0x800/0x900/0xA00/0xC00/0xD00/0xE00 */
-/*  3. RF register 0x00-2E */
-/*  4. Bit Mask for BB/RF register */
-/*  5. Other definition for BB/RF R/W */
-/*  */
-
-
-/*  */
-/*  1. PMAC duplicate register due to connection: RF_Mode, TRxRN, NumOf L-STF 
*/
-/*  1. Page1(0x100) */
-/*  */
-#definerPMAC_Reset 0x100
-#definerPMAC_TxStart   0x104
-#definerPMAC_TxLegacySIG   0x108
-#definerPMAC_TxHTSIG1  0x10c
-#definerPMAC_TxHTSIG2  0x110
-#definerPMAC_PHYDebug  0x114
-#definerPMAC_TxPacketNum   0x118
-#definerPMAC_TxIdle0x11c
-#definerPMAC_TxMACHeader0  0x120
-#definerPMAC_TxMACHeader1  0x124
-#definerPMAC_TxMACHeader2  0x128
-#definerPMAC_TxMACHeader3  0x12c
-#definerPMAC_TxMACHeader4  0x130
-#definerPMAC_TxMACHeader5  0x134
-#definerPMAC_TxDataType0x138
-#definerPMAC_TxRandomSeed  0x13c
-#definerPMAC_CCKPLCPPreamble   0x140
-#definerPMAC_CCKPLCPHeader 0x144
-#definerPMAC_CCKCRC16  0x148
-#definerPMAC_OFDMRxCRC32OK 0x170
-#definerPMAC_OFDMRxCRC32Er 0x174
-#definerPMAC_OFDMRxParityEr0x178
-#definerPMAC_OFDMRxCRC8Er  0x17c
-#definerPMAC_CCKCRxRC16Er  0x180
-#definerPMAC_CCKCRxRC32Er  0x184
-#definerPMAC_CCKCRxRC32OK  0x188
-#definerPMAC_TxStatus  0x18c
-
-/*  */
-/*  2. Page2(0x200) */
-/*  */
-/*  The following two definition are only used for USB interface. */
-/* define  RF_BB_CMD_ADDR  0x02c0   RF/BB read/write command address. */
-/* define  RF_BB_CMD_DATA  0x02c4   RF/BB read/write command data. */
-
-/*  */
-/*  3. Page8(0x800) */
-/*  */
-#definerFPGA0_RFMOD0x800   /* RF mode & CCK TxSC RF BW 
Setting?? */
-
-#definerFPGA0_TxInfo   0x804   /*  Status report?? */
-#definerFPGA0_PSDFunction  0x808
-
-#definerFPGA0_TxGainStage  0x80c   /*  Set TX PWR init gain? */
-
-#definerFPGA0_RFTiming10x810   /*  Useless now */
-#definerFPGA0_RFTiming20x814
-/* define rFPGA0_XC_RFTiming   0x818 */
-/* define rFPGA0_XD_RFTiming   0x81c */
-
-#define rFPGA0_XA_HSSIParameter1   0x820   /*  RF 3 wire register */
-#define rFPGA0_XA_HSSIParameter2   0x824
-#define rFPGA0_XB_HSSIParameter1   0x828
-#define rFPGA0_XB_HSSIParameter2   0x82c
-#define rFPGA0_XC_HSSIParameter1   0x830
-#define rFPGA0_XC_HSSIParameter2   0x834
-#define rFPGA0_XD_HSSIParameter1   0x838
-#define rFPGA0_XD_HSSIParameter2   0x83c
-#definerFPGA0_XA_LSSIParameter 0x840
-#definerFPGA0_XB_LSSIParameter 0x844
-#de

[PATCH] staging: rtl8188eu: remove rtw_mp_phy_regdef.h

2018-07-02 Thread Michael Straube
The header rtw_mp_phy_regdef.h is not used anywhere.
'git grep rtw_mp_phy_regdef.h' returns nothing, remove the file.

Signed-off-by: Michael Straube 
---
 .../rtl8188eu/include/rtw_mp_phy_regdef.h | 1078 -
 1 file changed, 1078 deletions(-)
 delete mode 100644 drivers/staging/rtl8188eu/include/rtw_mp_phy_regdef.h

diff --git a/drivers/staging/rtl8188eu/include/rtw_mp_phy_regdef.h 
b/drivers/staging/rtl8188eu/include/rtw_mp_phy_regdef.h
deleted file mode 100644
index 9276e2321f2a..
--- a/drivers/staging/rtl8188eu/include/rtw_mp_phy_regdef.h
+++ /dev/null
@@ -1,1078 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/**
- *
- * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
- *
- 
**/
-/*
- *
- * Module: __RTW_MP_PHY_REGDEF_H_
- *
- *
- * Note:   1. Define PMAC/BB register map
- * 2. Define RF register map
- * 3. PMAC/BB register bit mask.
- * 4. RF reg bit mask.
- * 5. Other BB/RF relative definition.
- *
- *
- * Export: Constants, macro, functions(API), global variables(None).
- *
- * Abbrev:
- *
- * History:
- * DataWho Remark
- * 08/07/2007  MHC 1. Porting from 9x series PHYCFG.h.
- * 2. Reorganize code architecture.
- * 09/25/2008  MH  1. Add RL6052 register definition
- *
- */
-#ifndef __RTW_MP_PHY_REGDEF_H_
-#define __RTW_MP_PHY_REGDEF_H_
-
-
-/*--Define Parameters---*/
-
-/*  */
-/* 8192S Regsiter offset definition */
-/*  */
-
-/*  */
-/*  BB-PHY register PMAC 0x100 PHY 0x800 - 0xEFF */
-/*  1. PMAC duplicate register due to connection: RF_Mode, TRxRN, NumOf L-STF 
*/
-/*  2. 0x800/0x900/0xA00/0xC00/0xD00/0xE00 */
-/*  3. RF register 0x00-2E */
-/*  4. Bit Mask for BB/RF register */
-/*  5. Other definition for BB/RF R/W */
-/*  */
-
-
-/*  */
-/*  1. PMAC duplicate register due to connection: RF_Mode, TRxRN, NumOf L-STF 
*/
-/*  1. Page1(0x100) */
-/*  */
-#definerPMAC_Reset 0x100
-#definerPMAC_TxStart   0x104
-#definerPMAC_TxLegacySIG   0x108
-#definerPMAC_TxHTSIG1  0x10c
-#definerPMAC_TxHTSIG2  0x110
-#definerPMAC_PHYDebug  0x114
-#definerPMAC_TxPacketNum   0x118
-#definerPMAC_TxIdle0x11c
-#definerPMAC_TxMACHeader0  0x120
-#definerPMAC_TxMACHeader1  0x124
-#definerPMAC_TxMACHeader2  0x128
-#definerPMAC_TxMACHeader3  0x12c
-#definerPMAC_TxMACHeader4  0x130
-#definerPMAC_TxMACHeader5  0x134
-#definerPMAC_TxDataType0x138
-#definerPMAC_TxRandomSeed  0x13c
-#definerPMAC_CCKPLCPPreamble   0x140
-#definerPMAC_CCKPLCPHeader 0x144
-#definerPMAC_CCKCRC16  0x148
-#definerPMAC_OFDMRxCRC32OK 0x170
-#definerPMAC_OFDMRxCRC32Er 0x174
-#definerPMAC_OFDMRxParityEr0x178
-#definerPMAC_OFDMRxCRC8Er  0x17c
-#definerPMAC_CCKCRxRC16Er  0x180
-#definerPMAC_CCKCRxRC32Er  0x184
-#definerPMAC_CCKCRxRC32OK  0x188
-#definerPMAC_TxStatus  0x18c
-
-/*  */
-/*  2. Page2(0x200) */
-/*  */
-/*  The following two definition are only used for USB interface. */
-/* define  RF_BB_CMD_ADDR  0x02c0   RF/BB read/write command address. */
-/* define  RF_BB_CMD_DATA  0x02c4   RF/BB read/write command data. */
-
-/*  */
-/*  3. Page8(0x800) */
-/*  */
-#definerFPGA0_RFMOD0x800   /* RF mode & CCK TxSC RF BW 
Setting?? */
-
-#definerFPGA0_TxInfo   0x804   /*  Status report?? */
-#definerFPGA0_PSDFunction  0x808
-
-#definerFPGA0_TxGainStage  0x80c   /*  Set TX PWR init gain? */
-
-#definerFPGA0_RFTiming10x810   /*  Useless now */
-#definerFPGA0_RFTiming20x814
-/* define rFPGA0_XC_RFTiming   0x818 */
-/* define rFPGA0_XD_RFTiming   0x81c */
-
-#define rFPGA0_XA_HSSIParameter1   0x820   /*  RF 3 wire register */
-#define rFPGA0_XA_HSSIParameter2   0x824
-#define rFPGA0_XB_HSSIParameter1   0x828
-#define rFPGA0_XB_HSSIParameter2   0x82c
-#define rFPGA0_XC_HSSIParameter1   0x830
-#define rFPGA0_XC_HSSIParameter2   0x834
-#define rFPGA0_XD_HSSIParameter1   0x838
-#define rFPGA0_XD_HSSIParameter2   0x83c
-#definerFPGA0_XA_LSSIParameter 0x840
-#definerFPGA0_XB_LSSIParameter 0x844
-#de

Re: [PATCH] staging: rtl8188eu: remove rtw_ioctl_rtl.h

2018-07-01 Thread Michael Straube

On 07/01/18 11:14, Andy Shevchenko wrote:

On Sat, Jun 30, 2018 at 5:59 PM, Michael Straube
 wrote:

The header rtw_ioctl_rtl.h is not used anywhere.
Running 'grep -r rtw_ioctl_rtl *' from kernel root
directory returns nothing, remove the file.


Just a side note, using `git grep` is much more efficient against
kernel source tree.
Something like `git grep -n rtw_ioctl_rtl.h` in this case.



Ah, I did not know about `git grep`, thanks!

Michael


Re: [PATCH] staging: rtl8188eu: remove rtw_ioctl_rtl.h

2018-07-01 Thread Michael Straube

On 07/01/18 11:14, Andy Shevchenko wrote:

On Sat, Jun 30, 2018 at 5:59 PM, Michael Straube
 wrote:

The header rtw_ioctl_rtl.h is not used anywhere.
Running 'grep -r rtw_ioctl_rtl *' from kernel root
directory returns nothing, remove the file.


Just a side note, using `git grep` is much more efficient against
kernel source tree.
Something like `git grep -n rtw_ioctl_rtl.h` in this case.



Ah, I did not know about `git grep`, thanks!

Michael


[PATCH 2/3] staging: rtl8188eu: move return type to functions definition line

2018-06-30 Thread Michael Straube
The return type of a function should be on the same line as the
definition.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/hal/hal_com.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/hal_com.c 
b/drivers/staging/rtl8188eu/hal/hal_com.c
index b2ea3d435af0..ca26a4f4dd86 100644
--- a/drivers/staging/rtl8188eu/hal/hal_com.c
+++ b/drivers/staging/rtl8188eu/hal/hal_com.c
@@ -44,10 +44,10 @@ void dump_chip_info(struct HAL_VERSION  chip_vers)
 
 #defineCHAN_PLAN_HW0x80
 
-u8 /* return the final channel plan decision */
-hal_com_get_channel_plan(struct adapter *padapter, u8 hw_channel_plan,
-u8 sw_channel_plan, u8 def_channel_plan,
-bool load_fail)
+/* return the final channel plan decision */
+u8 hal_com_get_channel_plan(struct adapter *padapter, u8 hw_channel_plan,
+   u8 sw_channel_plan, u8 def_channel_plan,
+   bool load_fail)
 {
u8 sw_cfg;
u8 chnlplan;
-- 
2.18.0



[PATCH 2/3] staging: rtl8188eu: move return type to functions definition line

2018-06-30 Thread Michael Straube
The return type of a function should be on the same line as the
definition.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/hal/hal_com.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/hal_com.c 
b/drivers/staging/rtl8188eu/hal/hal_com.c
index b2ea3d435af0..ca26a4f4dd86 100644
--- a/drivers/staging/rtl8188eu/hal/hal_com.c
+++ b/drivers/staging/rtl8188eu/hal/hal_com.c
@@ -44,10 +44,10 @@ void dump_chip_info(struct HAL_VERSION  chip_vers)
 
 #defineCHAN_PLAN_HW0x80
 
-u8 /* return the final channel plan decision */
-hal_com_get_channel_plan(struct adapter *padapter, u8 hw_channel_plan,
-u8 sw_channel_plan, u8 def_channel_plan,
-bool load_fail)
+/* return the final channel plan decision */
+u8 hal_com_get_channel_plan(struct adapter *padapter, u8 hw_channel_plan,
+   u8 sw_channel_plan, u8 def_channel_plan,
+   bool load_fail)
 {
u8 sw_cfg;
u8 chnlplan;
-- 
2.18.0



[PATCH 3/3] staging: rtl8188eu: fix block comments - coding style

2018-06-30 Thread Michael Straube
Write multiple single line comments as block comments to
follow kernel coding style and improve readability.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/hal/hal_com.c | 50 ++---
 1 file changed, 28 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/hal_com.c 
b/drivers/staging/rtl8188eu/hal/hal_com.c
index ca26a4f4dd86..7202e1767fc0 100644
--- a/drivers/staging/rtl8188eu/hal/hal_com.c
+++ b/drivers/staging/rtl8188eu/hal/hal_com.c
@@ -189,11 +189,13 @@ static void two_out_pipe(struct adapter *adapter, bool 
wifi_cfg)
 {
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(adapter);
 
-   if (wifi_cfg) { /* WMM */
-   /* BK, BE, VI, VO, BCN, CMD, MGT, HIGH, HCCA */
-   /*  0,  1,  0,  1,   0,   0,   0,0,0}; */
-   /* 0:H, 1:L */
-
+   if (wifi_cfg) {
+   /*
+* WMM
+* BK, BE, VI, VO, BCN, CMD, MGT, HIGH, HCCA
+*  0,  1,  0,  1,   0,   0,   0,0,0
+* 0:H, 1:L
+*/
pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[1];/* VO */
pdvobjpriv->Queue2Pipe[1] = pdvobjpriv->RtOutPipe[0];/* VI */
pdvobjpriv->Queue2Pipe[2] = pdvobjpriv->RtOutPipe[1];/* BE */
@@ -203,12 +205,13 @@ static void two_out_pipe(struct adapter *adapter, bool 
wifi_cfg)
pdvobjpriv->Queue2Pipe[5] = pdvobjpriv->RtOutPipe[0];/* MGT */
pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0];/* HIGH */
pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0];/* TXCMD */
-
-   } else {/* typical setting */
-   /* BK, BE, VI, VO, BCN, CMD, MGT, HIGH, HCCA */
-   /*  1,  1,  0,  0,   0,   0,   0,0,0}; */
-   /* 0:H, 1:L */
-
+   } else {
+   /*
+* typical setting
+* BK, BE, VI, VO, BCN, CMD, MGT, HIGH, HCCA
+*  1,  1,  0,  0,   0,   0,   0,0,0
+* 0:H, 1:L
+*/
pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[0];/* VO */
pdvobjpriv->Queue2Pipe[1] = pdvobjpriv->RtOutPipe[0];/* VI */
pdvobjpriv->Queue2Pipe[2] = pdvobjpriv->RtOutPipe[1];/* BE */
@@ -225,11 +228,13 @@ static void three_out_pipe(struct adapter *adapter, bool 
wifi_cfg)
 {
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(adapter);
 
-   if (wifi_cfg) {/* for WMM */
-   /* BK, BE, VI, VO, BCN, CMD, MGT, HIGH, HCCA */
-   /*  1,  2,  1,  0,   0,   0,   0,0,0}; */
-   /* 0:H, 1:N, 2:L */
-
+   if (wifi_cfg) {
+   /*
+* for WMM
+* BK, BE, VI, VO, BCN, CMD, MGT, HIGH, HCCA
+*  1,  2,  1,  0,   0,   0,   0,0,0
+* 0:H, 1:N, 2:L
+*/
pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[0];/* VO */
pdvobjpriv->Queue2Pipe[1] = pdvobjpriv->RtOutPipe[1];/* VI */
pdvobjpriv->Queue2Pipe[2] = pdvobjpriv->RtOutPipe[2];/* BE */
@@ -239,12 +244,13 @@ static void three_out_pipe(struct adapter *adapter, bool 
wifi_cfg)
pdvobjpriv->Queue2Pipe[5] = pdvobjpriv->RtOutPipe[0];/* MGT */
pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0];/* HIGH */
pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0];/* TXCMD */
-
-   } else {/* typical setting */
-   /* BK, BE, VI, VO, BCN, CMD, MGT, HIGH, HCCA */
-   /*  2,  2,  1,  0,   0,   0,   0,0,0}; */
-   /* 0:H, 1:N, 2:L */
-
+   } else {
+   /*
+* typical setting
+* BK, BE, VI, VO, BCN, CMD, MGT, HIGH, HCCA
+*  2,  2,  1,  0,   0,   0,   0,0,0
+* 0:H, 1:N, 2:L
+*/
pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[0];/* VO */
pdvobjpriv->Queue2Pipe[1] = pdvobjpriv->RtOutPipe[1];/* VI */
pdvobjpriv->Queue2Pipe[2] = pdvobjpriv->RtOutPipe[2];/* BE */
-- 
2.18.0



[PATCH 3/3] staging: rtl8188eu: fix block comments - coding style

2018-06-30 Thread Michael Straube
Write multiple single line comments as block comments to
follow kernel coding style and improve readability.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/hal/hal_com.c | 50 ++---
 1 file changed, 28 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/hal_com.c 
b/drivers/staging/rtl8188eu/hal/hal_com.c
index ca26a4f4dd86..7202e1767fc0 100644
--- a/drivers/staging/rtl8188eu/hal/hal_com.c
+++ b/drivers/staging/rtl8188eu/hal/hal_com.c
@@ -189,11 +189,13 @@ static void two_out_pipe(struct adapter *adapter, bool 
wifi_cfg)
 {
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(adapter);
 
-   if (wifi_cfg) { /* WMM */
-   /* BK, BE, VI, VO, BCN, CMD, MGT, HIGH, HCCA */
-   /*  0,  1,  0,  1,   0,   0,   0,0,0}; */
-   /* 0:H, 1:L */
-
+   if (wifi_cfg) {
+   /*
+* WMM
+* BK, BE, VI, VO, BCN, CMD, MGT, HIGH, HCCA
+*  0,  1,  0,  1,   0,   0,   0,0,0
+* 0:H, 1:L
+*/
pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[1];/* VO */
pdvobjpriv->Queue2Pipe[1] = pdvobjpriv->RtOutPipe[0];/* VI */
pdvobjpriv->Queue2Pipe[2] = pdvobjpriv->RtOutPipe[1];/* BE */
@@ -203,12 +205,13 @@ static void two_out_pipe(struct adapter *adapter, bool 
wifi_cfg)
pdvobjpriv->Queue2Pipe[5] = pdvobjpriv->RtOutPipe[0];/* MGT */
pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0];/* HIGH */
pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0];/* TXCMD */
-
-   } else {/* typical setting */
-   /* BK, BE, VI, VO, BCN, CMD, MGT, HIGH, HCCA */
-   /*  1,  1,  0,  0,   0,   0,   0,0,0}; */
-   /* 0:H, 1:L */
-
+   } else {
+   /*
+* typical setting
+* BK, BE, VI, VO, BCN, CMD, MGT, HIGH, HCCA
+*  1,  1,  0,  0,   0,   0,   0,0,0
+* 0:H, 1:L
+*/
pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[0];/* VO */
pdvobjpriv->Queue2Pipe[1] = pdvobjpriv->RtOutPipe[0];/* VI */
pdvobjpriv->Queue2Pipe[2] = pdvobjpriv->RtOutPipe[1];/* BE */
@@ -225,11 +228,13 @@ static void three_out_pipe(struct adapter *adapter, bool 
wifi_cfg)
 {
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(adapter);
 
-   if (wifi_cfg) {/* for WMM */
-   /* BK, BE, VI, VO, BCN, CMD, MGT, HIGH, HCCA */
-   /*  1,  2,  1,  0,   0,   0,   0,0,0}; */
-   /* 0:H, 1:N, 2:L */
-
+   if (wifi_cfg) {
+   /*
+* for WMM
+* BK, BE, VI, VO, BCN, CMD, MGT, HIGH, HCCA
+*  1,  2,  1,  0,   0,   0,   0,0,0
+* 0:H, 1:N, 2:L
+*/
pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[0];/* VO */
pdvobjpriv->Queue2Pipe[1] = pdvobjpriv->RtOutPipe[1];/* VI */
pdvobjpriv->Queue2Pipe[2] = pdvobjpriv->RtOutPipe[2];/* BE */
@@ -239,12 +244,13 @@ static void three_out_pipe(struct adapter *adapter, bool 
wifi_cfg)
pdvobjpriv->Queue2Pipe[5] = pdvobjpriv->RtOutPipe[0];/* MGT */
pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0];/* HIGH */
pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0];/* TXCMD */
-
-   } else {/* typical setting */
-   /* BK, BE, VI, VO, BCN, CMD, MGT, HIGH, HCCA */
-   /*  2,  2,  1,  0,   0,   0,   0,0,0}; */
-   /* 0:H, 1:N, 2:L */
-
+   } else {
+   /*
+* typical setting
+* BK, BE, VI, VO, BCN, CMD, MGT, HIGH, HCCA
+*  2,  2,  1,  0,   0,   0,   0,0,0
+* 0:H, 1:N, 2:L
+*/
pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[0];/* VO */
pdvobjpriv->Queue2Pipe[1] = pdvobjpriv->RtOutPipe[1];/* VI */
pdvobjpriv->Queue2Pipe[2] = pdvobjpriv->RtOutPipe[2];/* BE */
-- 
2.18.0



[PATCH 1/3] staging: rtl8188eu: reorder switch cases and remove default break

2018-06-30 Thread Michael Straube
Reorder the cases of a switch statement to be in ascending order.
Remove unrequired break from default case.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/hal/hal_com.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/hal_com.c 
b/drivers/staging/rtl8188eu/hal/hal_com.c
index b91902cdb34c..b2ea3d435af0 100644
--- a/drivers/staging/rtl8188eu/hal/hal_com.c
+++ b/drivers/staging/rtl8188eu/hal/hal_com.c
@@ -264,18 +264,17 @@ bool Hal_MappingOutPipe(struct adapter *adapter, u8 
numoutpipe)
bool result = true;
 
switch (numoutpipe) {
+   case 1:
+   one_out_pipe(adapter);
+   break;
case 2:
two_out_pipe(adapter, wifi_cfg);
break;
case 3:
three_out_pipe(adapter, wifi_cfg);
break;
-   case 1:
-   one_out_pipe(adapter);
-   break;
default:
result = false;
-   break;
}
return result;
 }
-- 
2.18.0



[PATCH 1/3] staging: rtl8188eu: reorder switch cases and remove default break

2018-06-30 Thread Michael Straube
Reorder the cases of a switch statement to be in ascending order.
Remove unrequired break from default case.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/hal/hal_com.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/hal_com.c 
b/drivers/staging/rtl8188eu/hal/hal_com.c
index b91902cdb34c..b2ea3d435af0 100644
--- a/drivers/staging/rtl8188eu/hal/hal_com.c
+++ b/drivers/staging/rtl8188eu/hal/hal_com.c
@@ -264,18 +264,17 @@ bool Hal_MappingOutPipe(struct adapter *adapter, u8 
numoutpipe)
bool result = true;
 
switch (numoutpipe) {
+   case 1:
+   one_out_pipe(adapter);
+   break;
case 2:
two_out_pipe(adapter, wifi_cfg);
break;
case 3:
three_out_pipe(adapter, wifi_cfg);
break;
-   case 1:
-   one_out_pipe(adapter);
-   break;
default:
result = false;
-   break;
}
return result;
 }
-- 
2.18.0



[PATCH] staging: rtl8188eu: remove rtw_ioctl_rtl.h

2018-06-30 Thread Michael Straube
The header rtw_ioctl_rtl.h is not used anywhere.
Running 'grep -r rtw_ioctl_rtl *' from kernel root
directory returns nothing, remove the file.

Signed-off-by: Michael Straube 
---
 .../staging/rtl8188eu/include/rtw_ioctl_rtl.h | 66 ---
 1 file changed, 66 deletions(-)
 delete mode 100644 drivers/staging/rtl8188eu/include/rtw_ioctl_rtl.h

diff --git a/drivers/staging/rtl8188eu/include/rtw_ioctl_rtl.h 
b/drivers/staging/rtl8188eu/include/rtw_ioctl_rtl.h
deleted file mode 100644
index e29ebfd40a58..
--- a/drivers/staging/rtl8188eu/include/rtw_ioctl_rtl.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/**
- *
- * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
- *
- 
**/
-#ifndef _RTW_IOCTL_RTL_H_
-#define _RTW_IOCTL_RTL_H_
-
-#include 
-#include 
-
-/*  oid_rtl_seg_01_01 ** */
-int oid_rt_get_signal_quality_hdl(struct oid_par_priv *poid_par_priv);/* 84 */
-int oid_rt_get_small_packet_crc_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_middle_packet_crc_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_large_packet_crc_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_tx_retry_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_rx_retry_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_rx_total_packet_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_tx_beacon_ok_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_tx_beacon_err_hdl(struct oid_par_priv *poid_par_priv);
-
-int oid_rt_pro_set_fw_dig_state_hdl(struct oid_par_priv *poid_par_priv);/* 8a 
*/
-int oid_rt_pro_set_fw_ra_state_hdl(struct oid_par_priv *poid_par_priv);
/* 8b */
-
-int oid_rt_get_rx_icv_err_hdl(struct oid_par_priv *poid_par_priv);/* 93 */
-int oid_rt_set_encryption_algorithm_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_preamble_mode_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_ap_ip_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_channelplan_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_set_channelplan_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_set_preamble_mode_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_set_bcn_intvl_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_dedicate_probe_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_total_tx_bytes_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_total_rx_bytes_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_current_tx_power_level_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_enc_key_mismatch_count_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_enc_key_match_count_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_channel_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_hardware_radio_off_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_key_mismatch_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_supported_wireless_mode_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_channel_list_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_scan_in_progress_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_forced_data_rate_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_wireless_mode_for_scan_list_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_bss_wireless_mode_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_scan_with_magic_packet_hdl(struct oid_par_priv *poid_par_priv);
-
-/*   oid_rtl_seg_01_03 section start ** */
-int oid_rt_ap_get_associated_station_list_hdl(struct oid_par_priv *priv);
-int oid_rt_ap_switch_into_ap_mode_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_ap_supported_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_ap_set_passphrase_hdl(struct oid_par_priv *poid_par_priv);
-
-/*  oid_rtl_seg_01_11 */
-int oid_rt_pro_rf_write_registry_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_pro_rf_read_registry_hdl(struct oid_par_priv *poid_par_priv);
-
-/*   oid_rtl_seg_03_00 section start ** */
-int oid_rt_get_connect_state_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_set_default_key_id_hdl(struct oid_par_priv *poid_par_priv);
-
-#endif
-- 
2.18.0



[PATCH] staging: rtl8188eu: remove rtw_ioctl_rtl.h

2018-06-30 Thread Michael Straube
The header rtw_ioctl_rtl.h is not used anywhere.
Running 'grep -r rtw_ioctl_rtl *' from kernel root
directory returns nothing, remove the file.

Signed-off-by: Michael Straube 
---
 .../staging/rtl8188eu/include/rtw_ioctl_rtl.h | 66 ---
 1 file changed, 66 deletions(-)
 delete mode 100644 drivers/staging/rtl8188eu/include/rtw_ioctl_rtl.h

diff --git a/drivers/staging/rtl8188eu/include/rtw_ioctl_rtl.h 
b/drivers/staging/rtl8188eu/include/rtw_ioctl_rtl.h
deleted file mode 100644
index e29ebfd40a58..
--- a/drivers/staging/rtl8188eu/include/rtw_ioctl_rtl.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/**
- *
- * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
- *
- 
**/
-#ifndef _RTW_IOCTL_RTL_H_
-#define _RTW_IOCTL_RTL_H_
-
-#include 
-#include 
-
-/*  oid_rtl_seg_01_01 ** */
-int oid_rt_get_signal_quality_hdl(struct oid_par_priv *poid_par_priv);/* 84 */
-int oid_rt_get_small_packet_crc_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_middle_packet_crc_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_large_packet_crc_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_tx_retry_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_rx_retry_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_rx_total_packet_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_tx_beacon_ok_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_tx_beacon_err_hdl(struct oid_par_priv *poid_par_priv);
-
-int oid_rt_pro_set_fw_dig_state_hdl(struct oid_par_priv *poid_par_priv);/* 8a 
*/
-int oid_rt_pro_set_fw_ra_state_hdl(struct oid_par_priv *poid_par_priv);
/* 8b */
-
-int oid_rt_get_rx_icv_err_hdl(struct oid_par_priv *poid_par_priv);/* 93 */
-int oid_rt_set_encryption_algorithm_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_preamble_mode_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_ap_ip_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_channelplan_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_set_channelplan_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_set_preamble_mode_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_set_bcn_intvl_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_dedicate_probe_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_total_tx_bytes_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_total_rx_bytes_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_current_tx_power_level_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_enc_key_mismatch_count_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_enc_key_match_count_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_channel_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_hardware_radio_off_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_key_mismatch_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_supported_wireless_mode_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_channel_list_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_scan_in_progress_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_forced_data_rate_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_wireless_mode_for_scan_list_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_get_bss_wireless_mode_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_scan_with_magic_packet_hdl(struct oid_par_priv *poid_par_priv);
-
-/*   oid_rtl_seg_01_03 section start ** */
-int oid_rt_ap_get_associated_station_list_hdl(struct oid_par_priv *priv);
-int oid_rt_ap_switch_into_ap_mode_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_ap_supported_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_ap_set_passphrase_hdl(struct oid_par_priv *poid_par_priv);
-
-/*  oid_rtl_seg_01_11 */
-int oid_rt_pro_rf_write_registry_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_pro_rf_read_registry_hdl(struct oid_par_priv *poid_par_priv);
-
-/*   oid_rtl_seg_03_00 section start ** */
-int oid_rt_get_connect_state_hdl(struct oid_par_priv *poid_par_priv);
-int oid_rt_set_default_key_id_hdl(struct oid_par_priv *poid_par_priv);
-
-#endif
-- 
2.18.0



[PATCH v2 2/2] staging: rtl8723bs: simplify if else statement

2018-06-30 Thread Michael Straube
Simplify if else statement to a single function call
by passing the variable.

Suggested-by: Andreas Schwab 
Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_btcoex.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_btcoex.c 
b/drivers/staging/rtl8723bs/core/rtw_btcoex.c
index e56502e301ec..35310e8e0806 100644
--- a/drivers/staging/rtl8723bs/core/rtw_btcoex.c
+++ b/drivers/staging/rtl8723bs/core/rtw_btcoex.c
@@ -115,11 +115,7 @@ s32 rtw_btcoex_IsBTCoexCtrlAMPDUSize(struct adapter 
*padapter)
 
 void rtw_btcoex_SetManualControl(struct adapter *padapter, u8 manual)
 {
-   if (true == manual) {
-   hal_btcoex_SetManualControl(padapter, true);
-   } else{
-   hal_btcoex_SetManualControl(padapter, false);
-   }
+   hal_btcoex_SetManualControl(padapter, manual);
 }
 
 u8 rtw_btcoex_IsBtControlLps(struct adapter *padapter)
-- 
2.18.0



[PATCH v2 2/2] staging: rtl8723bs: simplify if else statement

2018-06-30 Thread Michael Straube
Simplify if else statement to a single function call
by passing the variable.

Suggested-by: Andreas Schwab 
Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_btcoex.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_btcoex.c 
b/drivers/staging/rtl8723bs/core/rtw_btcoex.c
index e56502e301ec..35310e8e0806 100644
--- a/drivers/staging/rtl8723bs/core/rtw_btcoex.c
+++ b/drivers/staging/rtl8723bs/core/rtw_btcoex.c
@@ -115,11 +115,7 @@ s32 rtw_btcoex_IsBTCoexCtrlAMPDUSize(struct adapter 
*padapter)
 
 void rtw_btcoex_SetManualControl(struct adapter *padapter, u8 manual)
 {
-   if (true == manual) {
-   hal_btcoex_SetManualControl(padapter, true);
-   } else{
-   hal_btcoex_SetManualControl(padapter, false);
-   }
+   hal_btcoex_SetManualControl(padapter, manual);
 }
 
 u8 rtw_btcoex_IsBtControlLps(struct adapter *padapter)
-- 
2.18.0



[PATCH v2 1/2] staging: rtl8723bs: fix comparsion to true/false and brace issues

2018-06-30 Thread Michael Straube
Use if(x) and if(!x) instead of comparsion to true/false.
Reported by checkpatch.

Remove unrequired braces from single if else statement.
Add missing space after else: else{ -> else {

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_btcoex.c | 8 
 drivers/staging/rtl8723bs/core/rtw_efuse.c  | 5 ++---
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_btcoex.c 
b/drivers/staging/rtl8723bs/core/rtw_btcoex.c
index adac915a2153..e56502e301ec 100644
--- a/drivers/staging/rtl8723bs/core/rtw_btcoex.c
+++ b/drivers/staging/rtl8723bs/core/rtw_btcoex.c
@@ -77,14 +77,14 @@ void rtw_btcoex_SuspendNotify(struct adapter *padapter, u8 
state)
 
 void rtw_btcoex_HaltNotify(struct adapter *padapter)
 {
-   if (false == padapter->bup) {
+   if (!padapter->bup) {
DBG_871X(FUNC_ADPT_FMT ": bup =%d Skip!\n",
FUNC_ADPT_ARG(padapter), padapter->bup);
 
return;
}
 
-   if (true == padapter->bSurpriseRemoved) {
+   if (padapter->bSurpriseRemoved) {
DBG_871X(FUNC_ADPT_FMT ": bSurpriseRemoved =%d Skip!\n",
FUNC_ADPT_ARG(padapter), padapter->bSurpriseRemoved);
 
@@ -198,11 +198,11 @@ void rtw_btcoex_RejectApAggregatedPacket(struct adapter 
*padapter, u8 enable)
pmlmeinfo = >mlmeextpriv.mlmext_info;
psta = rtw_get_stainfo(>stapriv, 
get_bssid(>mlmepriv));
 
-   if (true == enable) {
+   if (enable) {
pmlmeinfo->accept_addba_req = false;
if (psta)
send_delba(padapter, 0, psta->hwaddr);
-   } else{
+   } else {
pmlmeinfo->accept_addba_req = true;
}
 }
diff --git a/drivers/staging/rtl8723bs/core/rtw_efuse.c 
b/drivers/staging/rtl8723bs/core/rtw_efuse.c
index c306ad7e395c..b3247c9642ea 100644
--- a/drivers/staging/rtl8723bs/core/rtw_efuse.c
+++ b/drivers/staging/rtl8723bs/core/rtw_efuse.c
@@ -580,11 +580,10 @@ void EFUSE_ShadowMapUpdate(
 
EFUSE_GetEfuseDefinition(padapter, efuseType, TYPE_EFUSE_MAP_LEN, (void 
*), bPseudoTest);
 
-   if (pEEPROM->bautoload_fail_flag == true) {
+   if (pEEPROM->bautoload_fail_flag)
memset(pEEPROM->efuse_eeprom_data, 0xFF, mapLen);
-   } else{
+   else
Efuse_ReadAllMap(padapter, efuseType, 
pEEPROM->efuse_eeprom_data, bPseudoTest);
-   }
 
/* PlatformMoveMemory((void *)>EfuseMap[EFUSE_MODIFY_MAP][0], 
*/
/* void *)>EfuseMap[EFUSE_INIT_MAP][0], mapLen); */
-- 
2.18.0



[PATCH v2 1/2] staging: rtl8723bs: fix comparsion to true/false and brace issues

2018-06-30 Thread Michael Straube
Use if(x) and if(!x) instead of comparsion to true/false.
Reported by checkpatch.

Remove unrequired braces from single if else statement.
Add missing space after else: else{ -> else {

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_btcoex.c | 8 
 drivers/staging/rtl8723bs/core/rtw_efuse.c  | 5 ++---
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_btcoex.c 
b/drivers/staging/rtl8723bs/core/rtw_btcoex.c
index adac915a2153..e56502e301ec 100644
--- a/drivers/staging/rtl8723bs/core/rtw_btcoex.c
+++ b/drivers/staging/rtl8723bs/core/rtw_btcoex.c
@@ -77,14 +77,14 @@ void rtw_btcoex_SuspendNotify(struct adapter *padapter, u8 
state)
 
 void rtw_btcoex_HaltNotify(struct adapter *padapter)
 {
-   if (false == padapter->bup) {
+   if (!padapter->bup) {
DBG_871X(FUNC_ADPT_FMT ": bup =%d Skip!\n",
FUNC_ADPT_ARG(padapter), padapter->bup);
 
return;
}
 
-   if (true == padapter->bSurpriseRemoved) {
+   if (padapter->bSurpriseRemoved) {
DBG_871X(FUNC_ADPT_FMT ": bSurpriseRemoved =%d Skip!\n",
FUNC_ADPT_ARG(padapter), padapter->bSurpriseRemoved);
 
@@ -198,11 +198,11 @@ void rtw_btcoex_RejectApAggregatedPacket(struct adapter 
*padapter, u8 enable)
pmlmeinfo = >mlmeextpriv.mlmext_info;
psta = rtw_get_stainfo(>stapriv, 
get_bssid(>mlmepriv));
 
-   if (true == enable) {
+   if (enable) {
pmlmeinfo->accept_addba_req = false;
if (psta)
send_delba(padapter, 0, psta->hwaddr);
-   } else{
+   } else {
pmlmeinfo->accept_addba_req = true;
}
 }
diff --git a/drivers/staging/rtl8723bs/core/rtw_efuse.c 
b/drivers/staging/rtl8723bs/core/rtw_efuse.c
index c306ad7e395c..b3247c9642ea 100644
--- a/drivers/staging/rtl8723bs/core/rtw_efuse.c
+++ b/drivers/staging/rtl8723bs/core/rtw_efuse.c
@@ -580,11 +580,10 @@ void EFUSE_ShadowMapUpdate(
 
EFUSE_GetEfuseDefinition(padapter, efuseType, TYPE_EFUSE_MAP_LEN, (void 
*), bPseudoTest);
 
-   if (pEEPROM->bautoload_fail_flag == true) {
+   if (pEEPROM->bautoload_fail_flag)
memset(pEEPROM->efuse_eeprom_data, 0xFF, mapLen);
-   } else{
+   else
Efuse_ReadAllMap(padapter, efuseType, 
pEEPROM->efuse_eeprom_data, bPseudoTest);
-   }
 
/* PlatformMoveMemory((void *)>EfuseMap[EFUSE_MODIFY_MAP][0], 
*/
/* void *)>EfuseMap[EFUSE_INIT_MAP][0], mapLen); */
-- 
2.18.0



Re: [PATCH] staging: rtl8723bs: fix comparsion to true/false and brace issues

2018-06-30 Thread Michael Straube

On 06/30/18 12:08, Andreas Schwab wrote:

On Jun 30 2018, Michael Straube  wrote:


@@ -115,11 +115,10 @@ s32 rtw_btcoex_IsBTCoexCtrlAMPDUSize(struct adapter 
*padapter)
  
  void rtw_btcoex_SetManualControl(struct adapter *padapter, u8 manual)

  {
-   if (true == manual) {
+   if (manual)
hal_btcoex_SetManualControl(padapter, true);
-   } else{
+   else
hal_btcoex_SetManualControl(padapter, false);
-   }


aka. hal_btcoex_SetManualControl(padapter, manual);

Andreas.



Ah, thanks!

Michael


Re: [PATCH] staging: rtl8723bs: fix comparsion to true/false and brace issues

2018-06-30 Thread Michael Straube

On 06/30/18 12:08, Andreas Schwab wrote:

On Jun 30 2018, Michael Straube  wrote:


@@ -115,11 +115,10 @@ s32 rtw_btcoex_IsBTCoexCtrlAMPDUSize(struct adapter 
*padapter)
  
  void rtw_btcoex_SetManualControl(struct adapter *padapter, u8 manual)

  {
-   if (true == manual) {
+   if (manual)
hal_btcoex_SetManualControl(padapter, true);
-   } else{
+   else
hal_btcoex_SetManualControl(padapter, false);
-   }


aka. hal_btcoex_SetManualControl(padapter, manual);

Andreas.



Ah, thanks!

Michael


[PATCH] staging: rtl8723bs: fix comparsion to true/false and brace issues

2018-06-30 Thread Michael Straube
Use if(x) and if(!x) instead of comparsion to true/false.
Reported by checkpatch.

Remove unrequired braces from single if else statements.
Add missing space after else: else{ -> else {

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_btcoex.c | 13 ++---
 drivers/staging/rtl8723bs/core/rtw_efuse.c  |  5 ++---
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_btcoex.c 
b/drivers/staging/rtl8723bs/core/rtw_btcoex.c
index adac915a2153..922628c59f80 100644
--- a/drivers/staging/rtl8723bs/core/rtw_btcoex.c
+++ b/drivers/staging/rtl8723bs/core/rtw_btcoex.c
@@ -77,14 +77,14 @@ void rtw_btcoex_SuspendNotify(struct adapter *padapter, u8 
state)
 
 void rtw_btcoex_HaltNotify(struct adapter *padapter)
 {
-   if (false == padapter->bup) {
+   if (!padapter->bup) {
DBG_871X(FUNC_ADPT_FMT ": bup =%d Skip!\n",
FUNC_ADPT_ARG(padapter), padapter->bup);
 
return;
}
 
-   if (true == padapter->bSurpriseRemoved) {
+   if (padapter->bSurpriseRemoved) {
DBG_871X(FUNC_ADPT_FMT ": bSurpriseRemoved =%d Skip!\n",
FUNC_ADPT_ARG(padapter), padapter->bSurpriseRemoved);
 
@@ -115,11 +115,10 @@ s32 rtw_btcoex_IsBTCoexCtrlAMPDUSize(struct adapter 
*padapter)
 
 void rtw_btcoex_SetManualControl(struct adapter *padapter, u8 manual)
 {
-   if (true == manual) {
+   if (manual)
hal_btcoex_SetManualControl(padapter, true);
-   } else{
+   else
hal_btcoex_SetManualControl(padapter, false);
-   }
 }
 
 u8 rtw_btcoex_IsBtControlLps(struct adapter *padapter)
@@ -198,11 +197,11 @@ void rtw_btcoex_RejectApAggregatedPacket(struct adapter 
*padapter, u8 enable)
pmlmeinfo = >mlmeextpriv.mlmext_info;
psta = rtw_get_stainfo(>stapriv, 
get_bssid(>mlmepriv));
 
-   if (true == enable) {
+   if (enable) {
pmlmeinfo->accept_addba_req = false;
if (psta)
send_delba(padapter, 0, psta->hwaddr);
-   } else{
+   } else {
pmlmeinfo->accept_addba_req = true;
}
 }
diff --git a/drivers/staging/rtl8723bs/core/rtw_efuse.c 
b/drivers/staging/rtl8723bs/core/rtw_efuse.c
index c306ad7e395c..b3247c9642ea 100644
--- a/drivers/staging/rtl8723bs/core/rtw_efuse.c
+++ b/drivers/staging/rtl8723bs/core/rtw_efuse.c
@@ -580,11 +580,10 @@ void EFUSE_ShadowMapUpdate(
 
EFUSE_GetEfuseDefinition(padapter, efuseType, TYPE_EFUSE_MAP_LEN, (void 
*), bPseudoTest);
 
-   if (pEEPROM->bautoload_fail_flag == true) {
+   if (pEEPROM->bautoload_fail_flag)
memset(pEEPROM->efuse_eeprom_data, 0xFF, mapLen);
-   } else{
+   else
Efuse_ReadAllMap(padapter, efuseType, 
pEEPROM->efuse_eeprom_data, bPseudoTest);
-   }
 
/* PlatformMoveMemory((void *)>EfuseMap[EFUSE_MODIFY_MAP][0], 
*/
/* void *)>EfuseMap[EFUSE_INIT_MAP][0], mapLen); */
-- 
2.18.0



[PATCH] staging: rtl8723bs: fix comparsion to true/false and brace issues

2018-06-30 Thread Michael Straube
Use if(x) and if(!x) instead of comparsion to true/false.
Reported by checkpatch.

Remove unrequired braces from single if else statements.
Add missing space after else: else{ -> else {

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_btcoex.c | 13 ++---
 drivers/staging/rtl8723bs/core/rtw_efuse.c  |  5 ++---
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_btcoex.c 
b/drivers/staging/rtl8723bs/core/rtw_btcoex.c
index adac915a2153..922628c59f80 100644
--- a/drivers/staging/rtl8723bs/core/rtw_btcoex.c
+++ b/drivers/staging/rtl8723bs/core/rtw_btcoex.c
@@ -77,14 +77,14 @@ void rtw_btcoex_SuspendNotify(struct adapter *padapter, u8 
state)
 
 void rtw_btcoex_HaltNotify(struct adapter *padapter)
 {
-   if (false == padapter->bup) {
+   if (!padapter->bup) {
DBG_871X(FUNC_ADPT_FMT ": bup =%d Skip!\n",
FUNC_ADPT_ARG(padapter), padapter->bup);
 
return;
}
 
-   if (true == padapter->bSurpriseRemoved) {
+   if (padapter->bSurpriseRemoved) {
DBG_871X(FUNC_ADPT_FMT ": bSurpriseRemoved =%d Skip!\n",
FUNC_ADPT_ARG(padapter), padapter->bSurpriseRemoved);
 
@@ -115,11 +115,10 @@ s32 rtw_btcoex_IsBTCoexCtrlAMPDUSize(struct adapter 
*padapter)
 
 void rtw_btcoex_SetManualControl(struct adapter *padapter, u8 manual)
 {
-   if (true == manual) {
+   if (manual)
hal_btcoex_SetManualControl(padapter, true);
-   } else{
+   else
hal_btcoex_SetManualControl(padapter, false);
-   }
 }
 
 u8 rtw_btcoex_IsBtControlLps(struct adapter *padapter)
@@ -198,11 +197,11 @@ void rtw_btcoex_RejectApAggregatedPacket(struct adapter 
*padapter, u8 enable)
pmlmeinfo = >mlmeextpriv.mlmext_info;
psta = rtw_get_stainfo(>stapriv, 
get_bssid(>mlmepriv));
 
-   if (true == enable) {
+   if (enable) {
pmlmeinfo->accept_addba_req = false;
if (psta)
send_delba(padapter, 0, psta->hwaddr);
-   } else{
+   } else {
pmlmeinfo->accept_addba_req = true;
}
 }
diff --git a/drivers/staging/rtl8723bs/core/rtw_efuse.c 
b/drivers/staging/rtl8723bs/core/rtw_efuse.c
index c306ad7e395c..b3247c9642ea 100644
--- a/drivers/staging/rtl8723bs/core/rtw_efuse.c
+++ b/drivers/staging/rtl8723bs/core/rtw_efuse.c
@@ -580,11 +580,10 @@ void EFUSE_ShadowMapUpdate(
 
EFUSE_GetEfuseDefinition(padapter, efuseType, TYPE_EFUSE_MAP_LEN, (void 
*), bPseudoTest);
 
-   if (pEEPROM->bautoload_fail_flag == true) {
+   if (pEEPROM->bautoload_fail_flag)
memset(pEEPROM->efuse_eeprom_data, 0xFF, mapLen);
-   } else{
+   else
Efuse_ReadAllMap(padapter, efuseType, 
pEEPROM->efuse_eeprom_data, bPseudoTest);
-   }
 
/* PlatformMoveMemory((void *)>EfuseMap[EFUSE_MODIFY_MAP][0], 
*/
/* void *)>EfuseMap[EFUSE_INIT_MAP][0], mapLen); */
-- 
2.18.0



[PATCH] staging: rtl8723bs: fix line over 80 characters

2018-06-30 Thread Michael Straube
Fix line over 80 characters by replacing tab with space.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_xmit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c 
b/drivers/staging/rtl8723bs/core/rtw_xmit.c
index 3e7c1f07b8b4..edb678190b4b 100644
--- a/drivers/staging/rtl8723bs/core/rtw_xmit.c
+++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c
@@ -36,7 +36,7 @@ void _rtw_init_sta_xmit_priv(struct sta_xmit_priv 
*psta_xmitpriv)
INIT_LIST_HEAD(_xmitpriv->apsd);
 }
 
-s32_rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter 
*padapter)
+s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter)
 {
int i;
struct xmit_buf *pxmitbuf;
-- 
2.18.0



[PATCH] staging: rtl8723bs: fix line over 80 characters

2018-06-30 Thread Michael Straube
Fix line over 80 characters by replacing tab with space.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_xmit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c 
b/drivers/staging/rtl8723bs/core/rtw_xmit.c
index 3e7c1f07b8b4..edb678190b4b 100644
--- a/drivers/staging/rtl8723bs/core/rtw_xmit.c
+++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c
@@ -36,7 +36,7 @@ void _rtw_init_sta_xmit_priv(struct sta_xmit_priv 
*psta_xmitpriv)
INIT_LIST_HEAD(_xmitpriv->apsd);
 }
 
-s32_rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter 
*padapter)
+s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter)
 {
int i;
struct xmit_buf *pxmitbuf;
-- 
2.18.0



[PATCH] staging: rtl8188eu: remove unnecessary parentheses

2018-06-29 Thread Michael Straube
Remove unnecessary parentheses as reported by checkpatch.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 22 ++--
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c 
b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
index 53c6ca85d69f..53e518148ae5 100644
--- a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
@@ -81,7 +81,7 @@ u32   _rtw_init_sta_priv(struct   sta_priv *pstapriv)
for (i = 0; i < NUM_STA; i++) {
_rtw_init_stainfo(psta);
 
-   INIT_LIST_HEAD(&(pstapriv->sta_hash[i]));
+   INIT_LIST_HEAD(>sta_hash[i]);
 
list_add_tail(>list, 
get_list_head(>free_sta_queue));
 
@@ -138,7 +138,7 @@ u32 _rtw_free_sta_priv(struct   sta_priv *pstapriv)
/*  delete all reordering_ctrl_timer*/
spin_lock_bh(>sta_hash_lock);
for (index = 0; index < NUM_STA; index++) {
-   phead = &(pstapriv->sta_hash[index]);
+   phead = >sta_hash[index];
plist = phead->next;
 
while (phead != plist) {
@@ -266,19 +266,19 @@ u32   rtw_free_stainfo(struct adapter *padapter, 
struct sta_info *psta)
 
rtw_free_xmitframe_queue(pxmitpriv, >vo_q.sta_pending);
 
-   list_del_init(&(pstaxmitpriv->vo_q.tx_pending));
+   list_del_init(>vo_q.tx_pending);
 
rtw_free_xmitframe_queue(pxmitpriv, >vi_q.sta_pending);
 
-   list_del_init(&(pstaxmitpriv->vi_q.tx_pending));
+   list_del_init(>vi_q.tx_pending);
 
rtw_free_xmitframe_queue(pxmitpriv, >bk_q.sta_pending);
 
-   list_del_init(&(pstaxmitpriv->bk_q.tx_pending));
+   list_del_init(>bk_q.tx_pending);
 
rtw_free_xmitframe_queue(pxmitpriv, >be_q.sta_pending);
 
-   list_del_init(&(pstaxmitpriv->be_q.tx_pending));
+   list_del_init(>be_q.tx_pending);
 
spin_unlock_bh(>lock);
 
@@ -319,7 +319,7 @@ u32 rtw_free_stainfo(struct adapter *padapter, struct 
sta_info *psta)
 
plist = plist->next;
 
-   list_del_init(&(prframe->list));
+   list_del_init(>list);
 
rtw_free_recvframe(prframe, pfree_recv_queue);
}
@@ -363,7 +363,7 @@ u32 rtw_free_stainfo(struct adapter *padapter, struct 
sta_info *psta)
 
 #endif /*  CONFIG_88EU_AP_MODE */
 
-   spin_lock_bh(&(pfree_sta_queue->lock));
+   spin_lock_bh(_sta_queue->lock);
list_add_tail(>list, get_list_head(pfree_sta_queue));
spin_unlock_bh(_sta_queue->lock);
 
@@ -387,7 +387,7 @@ void rtw_free_all_stainfo(struct adapter *padapter)
spin_lock_bh(>sta_hash_lock);
 
for (index = 0; index < NUM_STA; index++) {
-   phead = &(pstapriv->sta_hash[index]);
+   phead = >sta_hash[index];
plist = phead->next;
 
while (phead != plist) {
@@ -423,7 +423,7 @@ struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, 
u8 *hwaddr)
 
spin_lock_bh(>sta_hash_lock);
 
-   phead = &(pstapriv->sta_hash[index]);
+   phead = >sta_hash[index];
plist = phead->next;
 
while (phead != plist) {
@@ -481,7 +481,7 @@ u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr)
struct wlan_acl_pool *pacl_list = >acl_list;
struct __queue *pacl_node_q = _list->acl_node_q;
 
-   spin_lock_bh(&(pacl_node_q->lock));
+   spin_lock_bh(_node_q->lock);
phead = get_list_head(pacl_node_q);
plist = phead->next;
while (phead != plist) {
-- 
2.18.0



[PATCH] staging: rtl8188eu: remove unnecessary parentheses

2018-06-29 Thread Michael Straube
Remove unnecessary parentheses as reported by checkpatch.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 22 ++--
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c 
b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
index 53c6ca85d69f..53e518148ae5 100644
--- a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
@@ -81,7 +81,7 @@ u32   _rtw_init_sta_priv(struct   sta_priv *pstapriv)
for (i = 0; i < NUM_STA; i++) {
_rtw_init_stainfo(psta);
 
-   INIT_LIST_HEAD(&(pstapriv->sta_hash[i]));
+   INIT_LIST_HEAD(>sta_hash[i]);
 
list_add_tail(>list, 
get_list_head(>free_sta_queue));
 
@@ -138,7 +138,7 @@ u32 _rtw_free_sta_priv(struct   sta_priv *pstapriv)
/*  delete all reordering_ctrl_timer*/
spin_lock_bh(>sta_hash_lock);
for (index = 0; index < NUM_STA; index++) {
-   phead = &(pstapriv->sta_hash[index]);
+   phead = >sta_hash[index];
plist = phead->next;
 
while (phead != plist) {
@@ -266,19 +266,19 @@ u32   rtw_free_stainfo(struct adapter *padapter, 
struct sta_info *psta)
 
rtw_free_xmitframe_queue(pxmitpriv, >vo_q.sta_pending);
 
-   list_del_init(&(pstaxmitpriv->vo_q.tx_pending));
+   list_del_init(>vo_q.tx_pending);
 
rtw_free_xmitframe_queue(pxmitpriv, >vi_q.sta_pending);
 
-   list_del_init(&(pstaxmitpriv->vi_q.tx_pending));
+   list_del_init(>vi_q.tx_pending);
 
rtw_free_xmitframe_queue(pxmitpriv, >bk_q.sta_pending);
 
-   list_del_init(&(pstaxmitpriv->bk_q.tx_pending));
+   list_del_init(>bk_q.tx_pending);
 
rtw_free_xmitframe_queue(pxmitpriv, >be_q.sta_pending);
 
-   list_del_init(&(pstaxmitpriv->be_q.tx_pending));
+   list_del_init(>be_q.tx_pending);
 
spin_unlock_bh(>lock);
 
@@ -319,7 +319,7 @@ u32 rtw_free_stainfo(struct adapter *padapter, struct 
sta_info *psta)
 
plist = plist->next;
 
-   list_del_init(&(prframe->list));
+   list_del_init(>list);
 
rtw_free_recvframe(prframe, pfree_recv_queue);
}
@@ -363,7 +363,7 @@ u32 rtw_free_stainfo(struct adapter *padapter, struct 
sta_info *psta)
 
 #endif /*  CONFIG_88EU_AP_MODE */
 
-   spin_lock_bh(&(pfree_sta_queue->lock));
+   spin_lock_bh(_sta_queue->lock);
list_add_tail(>list, get_list_head(pfree_sta_queue));
spin_unlock_bh(_sta_queue->lock);
 
@@ -387,7 +387,7 @@ void rtw_free_all_stainfo(struct adapter *padapter)
spin_lock_bh(>sta_hash_lock);
 
for (index = 0; index < NUM_STA; index++) {
-   phead = &(pstapriv->sta_hash[index]);
+   phead = >sta_hash[index];
plist = phead->next;
 
while (phead != plist) {
@@ -423,7 +423,7 @@ struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, 
u8 *hwaddr)
 
spin_lock_bh(>sta_hash_lock);
 
-   phead = &(pstapriv->sta_hash[index]);
+   phead = >sta_hash[index];
plist = phead->next;
 
while (phead != plist) {
@@ -481,7 +481,7 @@ u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr)
struct wlan_acl_pool *pacl_list = >acl_list;
struct __queue *pacl_node_q = _list->acl_node_q;
 
-   spin_lock_bh(&(pacl_node_q->lock));
+   spin_lock_bh(_node_q->lock);
phead = get_list_head(pacl_node_q);
plist = phead->next;
while (phead != plist) {
-- 
2.18.0



[PATCH] staging: rtl8723bs: remove pointless if else in rtw_sdio_resume()

2018-06-28 Thread Michael Straube
Whether any of the conditions is true or not, the return variable
is always set to rtw_resume_process(padapter). Replace the if else
construct with a single call to rtw_resume_process(). Also remove
the now unused local variable pwrpriv.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 19 ++-
 1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c 
b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
index 22191c9584ad..6d02904de63f 100644
--- a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
+++ b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
@@ -605,7 +605,6 @@ static int rtw_sdio_resume(struct device *dev)
 {
struct sdio_func *func =dev_to_sdio_func(dev);
struct dvobj_priv *psdpriv = sdio_get_drvdata(func);
-   struct pwrctrl_priv *pwrpriv = dvobj_to_pwrctl(psdpriv);
struct adapter *padapter = psdpriv->if1;
struct mlme_ext_priv *pmlmeext = >mlmeextpriv;
int ret = 0;
@@ -615,25 +614,11 @@ static int rtw_sdio_resume(struct device *dev)
 
pdbgpriv->dbg_resume_cnt++;
 
-   if (pwrpriv->bInternalAutoSuspend)
-   {
-   ret = rtw_resume_process(padapter);
-   }
-   else
-   {
-   if (pwrpriv->wowlan_mode || pwrpriv->wowlan_ap_mode)
-   {
-   ret = rtw_resume_process(padapter);
-   }
-   else
-   {
-   ret = rtw_resume_process(padapter);
-   }
-   }
+   ret = rtw_resume_process(padapter);
+
pmlmeext->last_scan_time = jiffies;
DBG_871X("<  %s return %d\n", __func__, ret);
return ret;
-
 }
 
 static int __init rtw_drv_entry(void)
-- 
2.18.0



[PATCH] staging: rtl8723bs: remove pointless if else in rtw_sdio_resume()

2018-06-28 Thread Michael Straube
Whether any of the conditions is true or not, the return variable
is always set to rtw_resume_process(padapter). Replace the if else
construct with a single call to rtw_resume_process(). Also remove
the now unused local variable pwrpriv.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 19 ++-
 1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c 
b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
index 22191c9584ad..6d02904de63f 100644
--- a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
+++ b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
@@ -605,7 +605,6 @@ static int rtw_sdio_resume(struct device *dev)
 {
struct sdio_func *func =dev_to_sdio_func(dev);
struct dvobj_priv *psdpriv = sdio_get_drvdata(func);
-   struct pwrctrl_priv *pwrpriv = dvobj_to_pwrctl(psdpriv);
struct adapter *padapter = psdpriv->if1;
struct mlme_ext_priv *pmlmeext = >mlmeextpriv;
int ret = 0;
@@ -615,25 +614,11 @@ static int rtw_sdio_resume(struct device *dev)
 
pdbgpriv->dbg_resume_cnt++;
 
-   if (pwrpriv->bInternalAutoSuspend)
-   {
-   ret = rtw_resume_process(padapter);
-   }
-   else
-   {
-   if (pwrpriv->wowlan_mode || pwrpriv->wowlan_ap_mode)
-   {
-   ret = rtw_resume_process(padapter);
-   }
-   else
-   {
-   ret = rtw_resume_process(padapter);
-   }
-   }
+   ret = rtw_resume_process(padapter);
+
pmlmeext->last_scan_time = jiffies;
DBG_871X("<  %s return %d\n", __func__, ret);
return ret;
-
 }
 
 static int __init rtw_drv_entry(void)
-- 
2.18.0



Re: staging: rtl8723bs: bug or pointless if else ?

2018-06-28 Thread Michael Straube

On 06/28/18 11:34, Bastien Nocera wrote:

On Thu, 2018-06-28 at 10:22 +0200, Hans de Goede wrote:

Hi,

On 28-06-18 09:43, Michael Straube wrote:

Hi,

I stumbled upon the following if else construct in
drivers/staging/rtl8723bs/os_dep/sdio_intf.c:618

  if (pwrpriv->bInternalAutoSuspend)
  {
  ret = rtw_resume_process(padapter);
  }
  else
  {
  if (pwrpriv->wowlan_mode || pwrpriv-

wowlan_ap_mode)

  {
  ret = rtw_resume_process(padapter);
  }
  else
  {
  ret = rtw_resume_process(padapter);
  }
  }

It does not matter if the conditions are true or not,
ret is always set to:

ret = rtw_resume_process(padapter)

Is this a bug or is the if else construct just pointless?


It probably is just pointless, my guess would be that once
upon a time there was a difference in the paths and at some
point that difference went away.


Quite:
https://github.com/hadess/rtl8723bs/blob/7d36e26f78bbc709844c12ad0c62e3e8503fdbc5/os_dep/linux/sdio_intf.c#L1757



So it can be safly removed?


Re: staging: rtl8723bs: bug or pointless if else ?

2018-06-28 Thread Michael Straube

On 06/28/18 11:34, Bastien Nocera wrote:

On Thu, 2018-06-28 at 10:22 +0200, Hans de Goede wrote:

Hi,

On 28-06-18 09:43, Michael Straube wrote:

Hi,

I stumbled upon the following if else construct in
drivers/staging/rtl8723bs/os_dep/sdio_intf.c:618

  if (pwrpriv->bInternalAutoSuspend)
  {
  ret = rtw_resume_process(padapter);
  }
  else
  {
  if (pwrpriv->wowlan_mode || pwrpriv-

wowlan_ap_mode)

  {
  ret = rtw_resume_process(padapter);
  }
  else
  {
  ret = rtw_resume_process(padapter);
  }
  }

It does not matter if the conditions are true or not,
ret is always set to:

ret = rtw_resume_process(padapter)

Is this a bug or is the if else construct just pointless?


It probably is just pointless, my guess would be that once
upon a time there was a difference in the paths and at some
point that difference went away.


Quite:
https://github.com/hadess/rtl8723bs/blob/7d36e26f78bbc709844c12ad0c62e3e8503fdbc5/os_dep/linux/sdio_intf.c#L1757



So it can be safly removed?


staging: rtl8723bs: bug or pointless if else ?

2018-06-28 Thread Michael Straube

Hi,

I stumbled upon the following if else construct in
drivers/staging/rtl8723bs/os_dep/sdio_intf.c:618

if (pwrpriv->bInternalAutoSuspend)
{
ret = rtw_resume_process(padapter);
}
else
{
if (pwrpriv->wowlan_mode || pwrpriv->wowlan_ap_mode)
{
ret = rtw_resume_process(padapter);
}
else
{
ret = rtw_resume_process(padapter);
}
}

It does not matter if the conditions are true or not,
ret is always set to:

ret = rtw_resume_process(padapter)

Is this a bug or is the if else construct just pointless?

Regards,
Michael


staging: rtl8723bs: bug or pointless if else ?

2018-06-28 Thread Michael Straube

Hi,

I stumbled upon the following if else construct in
drivers/staging/rtl8723bs/os_dep/sdio_intf.c:618

if (pwrpriv->bInternalAutoSuspend)
{
ret = rtw_resume_process(padapter);
}
else
{
if (pwrpriv->wowlan_mode || pwrpriv->wowlan_ap_mode)
{
ret = rtw_resume_process(padapter);
}
else
{
ret = rtw_resume_process(padapter);
}
}

It does not matter if the conditions are true or not,
ret is always set to:

ret = rtw_resume_process(padapter)

Is this a bug or is the if else construct just pointless?

Regards,
Michael


[PATCH] staging: rtl8188eu: remove whitespace - coding style

2018-06-27 Thread Michael Straube
Remove unrequired whitespace in some declarations,
fix an indentation and remove unrequired blank lines.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/os_dep/recv_linux.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8188eu/os_dep/recv_linux.c 
b/drivers/staging/rtl8188eu/os_dep/recv_linux.c
index 9f9a595191b6..deadf26ea2aa 100644
--- a/drivers/staging/rtl8188eu/os_dep/recv_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/recv_linux.c
@@ -28,9 +28,9 @@ int rtw_os_recvbuf_resource_alloc(struct adapter *padapter,
 void rtw_handle_tkip_mic_err(struct adapter *padapter, u8 bgroup)
 {
union iwreq_data wrqu;
-   struct iw_michaelmicfailureev;
-   struct mlme_priv *pmlmepriv  = >mlmepriv;
-   struct security_priv*psecuritypriv = >securitypriv;
+   struct iw_michaelmicfailure ev;
+   struct mlme_priv *pmlmepriv = >mlmepriv;
+   struct security_priv *psecuritypriv = >securitypriv;
u32 cur_time = 0;
 
if (psecuritypriv->last_mic_err_time == 0) {
@@ -69,7 +69,6 @@ int rtw_recv_indicatepkt(struct adapter *padapter,
struct sk_buff *skb;
struct mlme_priv *pmlmepriv = >mlmepriv;
 
-
precvpriv = &(padapter->recvpriv);
pfree_recv_queue = &(precvpriv->free_recv_queue);
 
@@ -129,7 +128,6 @@ int rtw_recv_indicatepkt(struct adapter *padapter,
RT_TRACE(_module_recv_osdep_c_, _drv_info_,
 ("\n rtw_recv_indicatepkt :after netif_rx\n"));
 
-
return _SUCCESS;
 
 _recv_indicatepkt_drop:
@@ -137,12 +135,11 @@ int rtw_recv_indicatepkt(struct adapter *padapter,
 /* enqueue back to free_recv_queue */
rtw_free_recvframe(precv_frame, pfree_recv_queue);
 
-return _FAIL;
+   return _FAIL;
 }
 
 void rtw_init_recv_timer(struct recv_reorder_ctrl *preorder_ctrl)
 {
-
timer_setup(_ctrl->reordering_ctrl_timer,
rtw_reordering_ctrl_timeout_handler, 0);
 }
-- 
2.18.0



[PATCH] staging: rtl8188eu: remove whitespace - coding style

2018-06-27 Thread Michael Straube
Remove unrequired whitespace in some declarations,
fix an indentation and remove unrequired blank lines.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/os_dep/recv_linux.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8188eu/os_dep/recv_linux.c 
b/drivers/staging/rtl8188eu/os_dep/recv_linux.c
index 9f9a595191b6..deadf26ea2aa 100644
--- a/drivers/staging/rtl8188eu/os_dep/recv_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/recv_linux.c
@@ -28,9 +28,9 @@ int rtw_os_recvbuf_resource_alloc(struct adapter *padapter,
 void rtw_handle_tkip_mic_err(struct adapter *padapter, u8 bgroup)
 {
union iwreq_data wrqu;
-   struct iw_michaelmicfailureev;
-   struct mlme_priv *pmlmepriv  = >mlmepriv;
-   struct security_priv*psecuritypriv = >securitypriv;
+   struct iw_michaelmicfailure ev;
+   struct mlme_priv *pmlmepriv = >mlmepriv;
+   struct security_priv *psecuritypriv = >securitypriv;
u32 cur_time = 0;
 
if (psecuritypriv->last_mic_err_time == 0) {
@@ -69,7 +69,6 @@ int rtw_recv_indicatepkt(struct adapter *padapter,
struct sk_buff *skb;
struct mlme_priv *pmlmepriv = >mlmepriv;
 
-
precvpriv = &(padapter->recvpriv);
pfree_recv_queue = &(precvpriv->free_recv_queue);
 
@@ -129,7 +128,6 @@ int rtw_recv_indicatepkt(struct adapter *padapter,
RT_TRACE(_module_recv_osdep_c_, _drv_info_,
 ("\n rtw_recv_indicatepkt :after netif_rx\n"));
 
-
return _SUCCESS;
 
 _recv_indicatepkt_drop:
@@ -137,12 +135,11 @@ int rtw_recv_indicatepkt(struct adapter *padapter,
 /* enqueue back to free_recv_queue */
rtw_free_recvframe(precv_frame, pfree_recv_queue);
 
-return _FAIL;
+   return _FAIL;
 }
 
 void rtw_init_recv_timer(struct recv_reorder_ctrl *preorder_ctrl)
 {
-
timer_setup(_ctrl->reordering_ctrl_timer,
rtw_reordering_ctrl_timeout_handler, 0);
 }
-- 
2.18.0



[PATCH v4 3/4] staging: rtl8723bs: use ether_addr_copy() in rtw_macaddr_cfg()

2018-06-27 Thread Michael Straube
Use ether_addr_copy() instead of memcpy() to copy the mac address.

Suggested-by: Andy Shevchenko 
Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index 7aa00d1391f7..8af4a89e632f 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -1172,15 +1172,15 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
for (jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3) {
mac[jj] = key_2char2num(rtw_initmac[kk], rtw_initmac[kk 
+ 1]);
}
-   memcpy(mac_addr, mac, ETH_ALEN);
+   ether_addr_copy(mac_addr, mac);
} else{ /*  Use the mac address stored in the Efuse */
-   memcpy(mac, mac_addr, ETH_ALEN);
+   ether_addr_copy(mac, mac_addr);
}
 
if (is_broadcast_ether_addr(mac) || is_zero_ether_addr(mac)) {
if ((addr = of_get_property(np, "local-mac-address", )) &&
len == ETH_ALEN) {
-   memcpy(mac_addr, addr, ETH_ALEN);
+   ether_addr_copy(mac_addr, addr);
} else {
eth_random_addr(mac_addr);
DBG_871X("MAC Address from efuse error, assign random 
one !!!\n");
-- 
2.18.0



[PATCH v4 1/4] staging: rtl8723bs: fix comparsion to NULL - coding style

2018-06-27 Thread Michael Straube
Fix comparsion to NULL issues found by checkpatch.
Use !x instead of x == NULL.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index 0822e440204e..e55895632921 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -747,7 +747,7 @@ u8 rtw_is_wps_ie(u8 *ie_ptr, uint *wps_ielen)
u8 match = false;
u8 eid, wps_oui[4] = {0x0, 0x50, 0xf2, 0x04};
 
-   if (ie_ptr == NULL)
+   if (!ie_ptr)
return match;
 
eid = ie_ptr[0];
@@ -1163,7 +1163,7 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
const unsigned char *addr;
int len;
 
-   if (mac_addr == NULL)
+   if (!mac_addr)
return;
 
if (rtw_initmac) {  /*  Users specify the mac address */
-- 
2.18.0



[PATCH v4 3/4] staging: rtl8723bs: use ether_addr_copy() in rtw_macaddr_cfg()

2018-06-27 Thread Michael Straube
Use ether_addr_copy() instead of memcpy() to copy the mac address.

Suggested-by: Andy Shevchenko 
Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index 7aa00d1391f7..8af4a89e632f 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -1172,15 +1172,15 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
for (jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3) {
mac[jj] = key_2char2num(rtw_initmac[kk], rtw_initmac[kk 
+ 1]);
}
-   memcpy(mac_addr, mac, ETH_ALEN);
+   ether_addr_copy(mac_addr, mac);
} else{ /*  Use the mac address stored in the Efuse */
-   memcpy(mac, mac_addr, ETH_ALEN);
+   ether_addr_copy(mac, mac_addr);
}
 
if (is_broadcast_ether_addr(mac) || is_zero_ether_addr(mac)) {
if ((addr = of_get_property(np, "local-mac-address", )) &&
len == ETH_ALEN) {
-   memcpy(mac_addr, addr, ETH_ALEN);
+   ether_addr_copy(mac_addr, addr);
} else {
eth_random_addr(mac_addr);
DBG_871X("MAC Address from efuse error, assign random 
one !!!\n");
-- 
2.18.0



[PATCH v4 1/4] staging: rtl8723bs: fix comparsion to NULL - coding style

2018-06-27 Thread Michael Straube
Fix comparsion to NULL issues found by checkpatch.
Use !x instead of x == NULL.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index 0822e440204e..e55895632921 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -747,7 +747,7 @@ u8 rtw_is_wps_ie(u8 *ie_ptr, uint *wps_ielen)
u8 match = false;
u8 eid, wps_oui[4] = {0x0, 0x50, 0xf2, 0x04};
 
-   if (ie_ptr == NULL)
+   if (!ie_ptr)
return match;
 
eid = ie_ptr[0];
@@ -1163,7 +1163,7 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
const unsigned char *addr;
int len;
 
-   if (mac_addr == NULL)
+   if (!mac_addr)
return;
 
if (rtw_initmac) {  /*  Users specify the mac address */
-- 
2.18.0



[PATCH v4 4/4] staging: rtl8723bs: use mac_pton() in rtw_macaddr_cfg()

2018-06-27 Thread Michael Straube
Use the mac_pton() helper to convert the mac address string.

The functions key_char2num() and key_2char2num() are not used
anywhere else and can be removed.

This also has the benefit of validating the input since mac_pton()
returns false if the string is not valid.

Signed-off-by: Michael Straube 
Reviewed-by: Andy Shevchenko 
---
 .../staging/rtl8723bs/core/rtw_ieee80211.c| 30 +++
 .../staging/rtl8723bs/os_dep/ioctl_linux.c|  3 --
 2 files changed, 4 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index 8af4a89e632f..8e0025e1ff14 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -1137,25 +1137,6 @@ ParseRes rtw_ieee802_11_parse_elems(u8 *start, uint len,
 
 }
 
-static u8 key_char2num(u8 ch);
-static u8 key_char2num(u8 ch)
-{
-   if ((ch >= '0') && (ch <= '9'))
-   return ch - '0';
-   else if ((ch >= 'a') && (ch <= 'f'))
-   return ch - 'a' + 10;
-   else if ((ch >= 'A') && (ch <= 'F'))
-   return ch - 'A' + 10;
-   else
-   return 0xff;
-}
-
-u8 key_2char2num(u8 hch, u8 lch);
-u8 key_2char2num(u8 hch, u8 lch)
-{
-   return ((key_char2num(hch) << 4) | key_char2num(lch));
-}
-
 void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
 {
u8 mac[ETH_ALEN];
@@ -1166,14 +1147,11 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
if (!mac_addr)
return;
 
-   if (rtw_initmac) {  /*  Users specify the mac address */
-   int jj, kk;
-
-   for (jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3) {
-   mac[jj] = key_2char2num(rtw_initmac[kk], rtw_initmac[kk 
+ 1]);
-   }
+   if (rtw_initmac && mac_pton(rtw_initmac, mac)) {
+   /* Users specify the mac address */
ether_addr_copy(mac_addr, mac);
-   } else{ /*  Use the mac address stored in the Efuse */
+   } else {
+   /* Use the mac address stored in the Efuse */
ether_addr_copy(mac, mac_addr);
}
 
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c 
b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index 39502156f652..4eb51f45b387 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -32,9 +32,6 @@
 #define WEXT_CSCAN_HOME_DWELL_SECTION  'H'
 #define WEXT_CSCAN_TYPE_SECTION'T'
 
-
-extern u8 key_2char2num(u8 hch, u8 lch);
-
 static u32 rtw_rates[] = {100, 200, 550, 1100,
600, 900, 1200, 1800, 2400, 3600, 4800, 
5400};
 
-- 
2.18.0



[PATCH v4 2/4] staging: rtl8723bs: refactor rtw_macaddr_cfg()

2018-06-27 Thread Michael Straube
Using is_broadcast_ether_addr() and is_zero_ether_addr() instead of
testing each byte of the mac[] array for 0xff and 0x00 shortens the
code and improves readability.

If np == NULL, of_get_property() returns NULL, hence the "np" check
is not needed.

Instead of a fixed default mac address use a random one to reduce the
likelihood of mac address collision.

Thanks to Joe Perches and Dan Carpenter.

Suggested-by: Joe Perches 
Suggested-by: Dan Carpenter 
Signed-off-by: Michael Straube 
---
 .../staging/rtl8723bs/core/rtw_ieee80211.c| 19 ---
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index e55895632921..7aa00d1391f7 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -1177,24 +1177,13 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
memcpy(mac, mac_addr, ETH_ALEN);
}
 
-   if (((mac[0] == 0xff) && (mac[1] == 0xff) && (mac[2] == 0xff) &&
-(mac[3] == 0xff) && (mac[4] == 0xff) && (mac[5] == 0xff)) ||
-   ((mac[0] == 0x00) && (mac[1] == 0x00) && (mac[2] == 0x00) &&
-(mac[3] == 0x00) && (mac[4] == 0x00) && (mac[5] == 0x00))) {
-   if (np &&
-   (addr = of_get_property(np, "local-mac-address", )) &&
+   if (is_broadcast_ether_addr(mac) || is_zero_ether_addr(mac)) {
+   if ((addr = of_get_property(np, "local-mac-address", )) &&
len == ETH_ALEN) {
memcpy(mac_addr, addr, ETH_ALEN);
} else {
-   mac[0] = 0x00;
-   mac[1] = 0xe0;
-   mac[2] = 0x4c;
-   mac[3] = 0x87;
-   mac[4] = 0x00;
-   mac[5] = 0x00;
-   /*  use default mac addresss */
-   memcpy(mac_addr, mac, ETH_ALEN);
-   DBG_871X("MAC Address from efuse error, assign default 
one !!!\n");
+   eth_random_addr(mac_addr);
+   DBG_871X("MAC Address from efuse error, assign random 
one !!!\n");
}
}
 
-- 
2.18.0



[PATCH v4 4/4] staging: rtl8723bs: use mac_pton() in rtw_macaddr_cfg()

2018-06-27 Thread Michael Straube
Use the mac_pton() helper to convert the mac address string.

The functions key_char2num() and key_2char2num() are not used
anywhere else and can be removed.

This also has the benefit of validating the input since mac_pton()
returns false if the string is not valid.

Signed-off-by: Michael Straube 
Reviewed-by: Andy Shevchenko 
---
 .../staging/rtl8723bs/core/rtw_ieee80211.c| 30 +++
 .../staging/rtl8723bs/os_dep/ioctl_linux.c|  3 --
 2 files changed, 4 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index 8af4a89e632f..8e0025e1ff14 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -1137,25 +1137,6 @@ ParseRes rtw_ieee802_11_parse_elems(u8 *start, uint len,
 
 }
 
-static u8 key_char2num(u8 ch);
-static u8 key_char2num(u8 ch)
-{
-   if ((ch >= '0') && (ch <= '9'))
-   return ch - '0';
-   else if ((ch >= 'a') && (ch <= 'f'))
-   return ch - 'a' + 10;
-   else if ((ch >= 'A') && (ch <= 'F'))
-   return ch - 'A' + 10;
-   else
-   return 0xff;
-}
-
-u8 key_2char2num(u8 hch, u8 lch);
-u8 key_2char2num(u8 hch, u8 lch)
-{
-   return ((key_char2num(hch) << 4) | key_char2num(lch));
-}
-
 void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
 {
u8 mac[ETH_ALEN];
@@ -1166,14 +1147,11 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
if (!mac_addr)
return;
 
-   if (rtw_initmac) {  /*  Users specify the mac address */
-   int jj, kk;
-
-   for (jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3) {
-   mac[jj] = key_2char2num(rtw_initmac[kk], rtw_initmac[kk 
+ 1]);
-   }
+   if (rtw_initmac && mac_pton(rtw_initmac, mac)) {
+   /* Users specify the mac address */
ether_addr_copy(mac_addr, mac);
-   } else{ /*  Use the mac address stored in the Efuse */
+   } else {
+   /* Use the mac address stored in the Efuse */
ether_addr_copy(mac, mac_addr);
}
 
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c 
b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index 39502156f652..4eb51f45b387 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -32,9 +32,6 @@
 #define WEXT_CSCAN_HOME_DWELL_SECTION  'H'
 #define WEXT_CSCAN_TYPE_SECTION'T'
 
-
-extern u8 key_2char2num(u8 hch, u8 lch);
-
 static u32 rtw_rates[] = {100, 200, 550, 1100,
600, 900, 1200, 1800, 2400, 3600, 4800, 
5400};
 
-- 
2.18.0



[PATCH v4 2/4] staging: rtl8723bs: refactor rtw_macaddr_cfg()

2018-06-27 Thread Michael Straube
Using is_broadcast_ether_addr() and is_zero_ether_addr() instead of
testing each byte of the mac[] array for 0xff and 0x00 shortens the
code and improves readability.

If np == NULL, of_get_property() returns NULL, hence the "np" check
is not needed.

Instead of a fixed default mac address use a random one to reduce the
likelihood of mac address collision.

Thanks to Joe Perches and Dan Carpenter.

Suggested-by: Joe Perches 
Suggested-by: Dan Carpenter 
Signed-off-by: Michael Straube 
---
 .../staging/rtl8723bs/core/rtw_ieee80211.c| 19 ---
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index e55895632921..7aa00d1391f7 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -1177,24 +1177,13 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
memcpy(mac, mac_addr, ETH_ALEN);
}
 
-   if (((mac[0] == 0xff) && (mac[1] == 0xff) && (mac[2] == 0xff) &&
-(mac[3] == 0xff) && (mac[4] == 0xff) && (mac[5] == 0xff)) ||
-   ((mac[0] == 0x00) && (mac[1] == 0x00) && (mac[2] == 0x00) &&
-(mac[3] == 0x00) && (mac[4] == 0x00) && (mac[5] == 0x00))) {
-   if (np &&
-   (addr = of_get_property(np, "local-mac-address", )) &&
+   if (is_broadcast_ether_addr(mac) || is_zero_ether_addr(mac)) {
+   if ((addr = of_get_property(np, "local-mac-address", )) &&
len == ETH_ALEN) {
memcpy(mac_addr, addr, ETH_ALEN);
} else {
-   mac[0] = 0x00;
-   mac[1] = 0xe0;
-   mac[2] = 0x4c;
-   mac[3] = 0x87;
-   mac[4] = 0x00;
-   mac[5] = 0x00;
-   /*  use default mac addresss */
-   memcpy(mac_addr, mac, ETH_ALEN);
-   DBG_871X("MAC Address from efuse error, assign default 
one !!!\n");
+   eth_random_addr(mac_addr);
+   DBG_871X("MAC Address from efuse error, assign random 
one !!!\n");
}
}
 
-- 
2.18.0



Re: [PATCH v3 3/4] staging: rtl8723bs: use ether_addr_copy() in rtw_macaddr_cfg()

2018-06-27 Thread Michael Straube

Am 27.06.2018 um 10:33 schrieb Dan Carpenter:

On Tue, Jun 26, 2018 at 10:32:09PM +0200, Michael Straube wrote:


On 06/26/18 22:17, Joe Perches wrote:

On Tue, 2018-06-26 at 21:44 +0200, Michael Straube wrote:

On 06/26/18 19:32, Andy Shevchenko wrote:

On Tue, Jun 26, 2018 at 11:14 AM, Michael Straube
 wrote:

Use ether_addr_copy() instead of memcpy() to copy the mac address.



Suggested-by ?



I'll add it. Sorry, I was not aware of the Suggested-by tag.


Btw, ensure that the source and destination buffers are aligned to u16
as required by API.


To be honest I'm not sure how to do that excactly.

Use __align(2) in the array declarations? e.g.:

   u8 mac[ETH_ALEN] __align(2);


All initial function automatics are naturally aligned.



So there is nothing to change? Now I'm confused.


Do not add the __align(2), as Joe says, it's not required.  You just
need to C alignment rules (it's expected/required for this sort of
patch).

Like if you have a struct:

struct foo {
char a;
int b;
};

There is going to be a 3 byte gap between a and b because ints are
normally __align(4).  The exception is when the struct is __packed.  So
sizeof(struct foo) in this case is going to be 8.  kmalloc() returns
pointers which are 8 at least byte aligned normally.  See
ARCH_KMALLOC_MINALIGN.  There is one arch where it's 4 byte aligned?

So when you would get things which aren't __align(2) is when you have:

struct bar {
char a[3];
u8 mac[ETH_ALEN];
};

Here the struct member before the mac[] is an odd number of char.  Or
when the struct is packed.

regards,
dan carpenter



Thank you for your explanation. I will not add __aligned(2).
The other buffer is u32 aligned:

struct eeprom_priv
{
u8 bautoload_fail_flag;
u8 bloadfile_fail_flag;
u8 bloadmac_fail_flag;
u8 EepromOrEfuse;

u8 mac_addr[6]; /* PermanentAddress */

...

u32 ocr;

...
};

Should I add a thanks line to the commit message:

Thanks to Dan Carpenter, Joe Perches and Andy Shevchenko.

Or would that be considered as too much?

Regards
Michael




Re: [PATCH v3 3/4] staging: rtl8723bs: use ether_addr_copy() in rtw_macaddr_cfg()

2018-06-27 Thread Michael Straube

Am 27.06.2018 um 10:33 schrieb Dan Carpenter:

On Tue, Jun 26, 2018 at 10:32:09PM +0200, Michael Straube wrote:


On 06/26/18 22:17, Joe Perches wrote:

On Tue, 2018-06-26 at 21:44 +0200, Michael Straube wrote:

On 06/26/18 19:32, Andy Shevchenko wrote:

On Tue, Jun 26, 2018 at 11:14 AM, Michael Straube
 wrote:

Use ether_addr_copy() instead of memcpy() to copy the mac address.



Suggested-by ?



I'll add it. Sorry, I was not aware of the Suggested-by tag.


Btw, ensure that the source and destination buffers are aligned to u16
as required by API.


To be honest I'm not sure how to do that excactly.

Use __align(2) in the array declarations? e.g.:

   u8 mac[ETH_ALEN] __align(2);


All initial function automatics are naturally aligned.



So there is nothing to change? Now I'm confused.


Do not add the __align(2), as Joe says, it's not required.  You just
need to C alignment rules (it's expected/required for this sort of
patch).

Like if you have a struct:

struct foo {
char a;
int b;
};

There is going to be a 3 byte gap between a and b because ints are
normally __align(4).  The exception is when the struct is __packed.  So
sizeof(struct foo) in this case is going to be 8.  kmalloc() returns
pointers which are 8 at least byte aligned normally.  See
ARCH_KMALLOC_MINALIGN.  There is one arch where it's 4 byte aligned?

So when you would get things which aren't __align(2) is when you have:

struct bar {
char a[3];
u8 mac[ETH_ALEN];
};

Here the struct member before the mac[] is an odd number of char.  Or
when the struct is packed.

regards,
dan carpenter



Thank you for your explanation. I will not add __aligned(2).
The other buffer is u32 aligned:

struct eeprom_priv
{
u8 bautoload_fail_flag;
u8 bloadfile_fail_flag;
u8 bloadmac_fail_flag;
u8 EepromOrEfuse;

u8 mac_addr[6]; /* PermanentAddress */

...

u32 ocr;

...
};

Should I add a thanks line to the commit message:

Thanks to Dan Carpenter, Joe Perches and Andy Shevchenko.

Or would that be considered as too much?

Regards
Michael




Re: [PATCH v3 4/4] staging: rtl8723bs: use mac_pton() in rtw_macaddr_cfg()

2018-06-26 Thread Michael Straube

On 06/26/18 19:34, Andy Shevchenko wrote:

On Tue, Jun 26, 2018 at 11:14 AM, Michael Straube
 wrote:

Use the mac_pton() helper to convert the mac address string.

The functions key_char2num() and key_2char2num() are not used
anywhere else and can be removed.

This also has the benefit of validating the input since mac_pton()
returns false if the string is not valid.



FWIW,
Reviewed-by: Andy Shevchenko 



Thanks.


Signed-off-by: Michael Straube 
---
  .../staging/rtl8723bs/core/rtw_ieee80211.c| 30 +++
  .../staging/rtl8723bs/os_dep/ioctl_linux.c|  3 --
  2 files changed, 4 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index 8af4a89e632f..8e0025e1ff14 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -1137,25 +1137,6 @@ ParseRes rtw_ieee802_11_parse_elems(u8 *start, uint len,

  }

-static u8 key_char2num(u8 ch);
-static u8 key_char2num(u8 ch)
-{
-   if ((ch >= '0') && (ch <= '9'))
-   return ch - '0';
-   else if ((ch >= 'a') && (ch <= 'f'))
-   return ch - 'a' + 10;
-   else if ((ch >= 'A') && (ch <= 'F'))
-   return ch - 'A' + 10;
-   else
-   return 0xff;
-}
-
-u8 key_2char2num(u8 hch, u8 lch);
-u8 key_2char2num(u8 hch, u8 lch)
-{
-   return ((key_char2num(hch) << 4) | key_char2num(lch));
-}
-
  void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
  {
 u8 mac[ETH_ALEN];
@@ -1166,14 +1147,11 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
 if (!mac_addr)
 return;

-   if (rtw_initmac) {  /*  Users specify the mac address */
-   int jj, kk;
-
-   for (jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3) {
-   mac[jj] = key_2char2num(rtw_initmac[kk], rtw_initmac[kk 
+ 1]);
-   }
+   if (rtw_initmac && mac_pton(rtw_initmac, mac)) {
+   /* Users specify the mac address */
 ether_addr_copy(mac_addr, mac);
-   } else{ /*  Use the mac address stored in the Efuse */
+   } else {
+   /* Use the mac address stored in the Efuse */
 ether_addr_copy(mac, mac_addr);
 }

diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c 
b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index 39502156f652..4eb51f45b387 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -32,9 +32,6 @@
  #define WEXT_CSCAN_HOME_DWELL_SECTION  'H'
  #define WEXT_CSCAN_TYPE_SECTION'T'

-
-extern u8 key_2char2num(u8 hch, u8 lch);
-
  static u32 rtw_rates[] = {100, 200, 550, 1100,
 600, 900, 1200, 1800, 2400, 3600, 4800, 
5400};

--
2.18.0







Re: [PATCH v3 4/4] staging: rtl8723bs: use mac_pton() in rtw_macaddr_cfg()

2018-06-26 Thread Michael Straube

On 06/26/18 19:34, Andy Shevchenko wrote:

On Tue, Jun 26, 2018 at 11:14 AM, Michael Straube
 wrote:

Use the mac_pton() helper to convert the mac address string.

The functions key_char2num() and key_2char2num() are not used
anywhere else and can be removed.

This also has the benefit of validating the input since mac_pton()
returns false if the string is not valid.



FWIW,
Reviewed-by: Andy Shevchenko 



Thanks.


Signed-off-by: Michael Straube 
---
  .../staging/rtl8723bs/core/rtw_ieee80211.c| 30 +++
  .../staging/rtl8723bs/os_dep/ioctl_linux.c|  3 --
  2 files changed, 4 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index 8af4a89e632f..8e0025e1ff14 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -1137,25 +1137,6 @@ ParseRes rtw_ieee802_11_parse_elems(u8 *start, uint len,

  }

-static u8 key_char2num(u8 ch);
-static u8 key_char2num(u8 ch)
-{
-   if ((ch >= '0') && (ch <= '9'))
-   return ch - '0';
-   else if ((ch >= 'a') && (ch <= 'f'))
-   return ch - 'a' + 10;
-   else if ((ch >= 'A') && (ch <= 'F'))
-   return ch - 'A' + 10;
-   else
-   return 0xff;
-}
-
-u8 key_2char2num(u8 hch, u8 lch);
-u8 key_2char2num(u8 hch, u8 lch)
-{
-   return ((key_char2num(hch) << 4) | key_char2num(lch));
-}
-
  void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
  {
 u8 mac[ETH_ALEN];
@@ -1166,14 +1147,11 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
 if (!mac_addr)
 return;

-   if (rtw_initmac) {  /*  Users specify the mac address */
-   int jj, kk;
-
-   for (jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3) {
-   mac[jj] = key_2char2num(rtw_initmac[kk], rtw_initmac[kk 
+ 1]);
-   }
+   if (rtw_initmac && mac_pton(rtw_initmac, mac)) {
+   /* Users specify the mac address */
 ether_addr_copy(mac_addr, mac);
-   } else{ /*  Use the mac address stored in the Efuse */
+   } else {
+   /* Use the mac address stored in the Efuse */
 ether_addr_copy(mac, mac_addr);
 }

diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c 
b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index 39502156f652..4eb51f45b387 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -32,9 +32,6 @@
  #define WEXT_CSCAN_HOME_DWELL_SECTION  'H'
  #define WEXT_CSCAN_TYPE_SECTION'T'

-
-extern u8 key_2char2num(u8 hch, u8 lch);
-
  static u32 rtw_rates[] = {100, 200, 550, 1100,
 600, 900, 1200, 1800, 2400, 3600, 4800, 
5400};

--
2.18.0







Re: [PATCH v3 3/4] staging: rtl8723bs: use ether_addr_copy() in rtw_macaddr_cfg()

2018-06-26 Thread Michael Straube



On 06/26/18 22:17, Joe Perches wrote:

On Tue, 2018-06-26 at 21:44 +0200, Michael Straube wrote:

On 06/26/18 19:32, Andy Shevchenko wrote:

On Tue, Jun 26, 2018 at 11:14 AM, Michael Straube
 wrote:

Use ether_addr_copy() instead of memcpy() to copy the mac address.



Suggested-by ?



I'll add it. Sorry, I was not aware of the Suggested-by tag.


Btw, ensure that the source and destination buffers are aligned to u16
as required by API.


To be honest I'm not sure how to do that excactly.

Use __align(2) in the array declarations? e.g.:

  u8 mac[ETH_ALEN] __align(2);


All initial function automatics are naturally aligned.



So there is nothing to change? Now I'm confused.


Re: [PATCH v3 3/4] staging: rtl8723bs: use ether_addr_copy() in rtw_macaddr_cfg()

2018-06-26 Thread Michael Straube



On 06/26/18 22:17, Joe Perches wrote:

On Tue, 2018-06-26 at 21:44 +0200, Michael Straube wrote:

On 06/26/18 19:32, Andy Shevchenko wrote:

On Tue, Jun 26, 2018 at 11:14 AM, Michael Straube
 wrote:

Use ether_addr_copy() instead of memcpy() to copy the mac address.



Suggested-by ?



I'll add it. Sorry, I was not aware of the Suggested-by tag.


Btw, ensure that the source and destination buffers are aligned to u16
as required by API.


To be honest I'm not sure how to do that excactly.

Use __align(2) in the array declarations? e.g.:

  u8 mac[ETH_ALEN] __align(2);


All initial function automatics are naturally aligned.



So there is nothing to change? Now I'm confused.


Re: [PATCH v3 3/4] staging: rtl8723bs: use ether_addr_copy() in rtw_macaddr_cfg()

2018-06-26 Thread Michael Straube

On 06/26/18 19:32, Andy Shevchenko wrote:

On Tue, Jun 26, 2018 at 11:14 AM, Michael Straube
 wrote:

Use ether_addr_copy() instead of memcpy() to copy the mac address.



Suggested-by ?



I'll add it. Sorry, I was not aware of the Suggested-by tag.


Btw, ensure that the source and destination buffers are aligned to u16
as required by API.


To be honest I'm not sure how to do that excactly.

Use __align(2) in the array declarations? e.g.:

u8 mac[ETH_ALEN] __align(2);


Thanks for your help.
Michael


Re: [PATCH v3 3/4] staging: rtl8723bs: use ether_addr_copy() in rtw_macaddr_cfg()

2018-06-26 Thread Michael Straube

On 06/26/18 19:32, Andy Shevchenko wrote:

On Tue, Jun 26, 2018 at 11:14 AM, Michael Straube
 wrote:

Use ether_addr_copy() instead of memcpy() to copy the mac address.



Suggested-by ?



I'll add it. Sorry, I was not aware of the Suggested-by tag.


Btw, ensure that the source and destination buffers are aligned to u16
as required by API.


To be honest I'm not sure how to do that excactly.

Use __align(2) in the array declarations? e.g.:

u8 mac[ETH_ALEN] __align(2);


Thanks for your help.
Michael


Re: [PATCH v3 2/4] staging: rtl8723bs: refactor rtw_macaddr_cfg()

2018-06-26 Thread Michael Straube

On 06/26/18 19:29, Andy Shevchenko wrote:

On Tue, Jun 26, 2018 at 11:14 AM, Michael Straube
 wrote:

Using is_broadcast_ether_addr() and is_zero_ether_addr() instead of
testing each byte of the mac[] array for 0xff and 0x00 shortens the
code and improves readability.

If np == NULL, of_get_property() returns NULL, hence the "np" check
is not needed.

Instead of a fixed default mac address use a random one to reduce the
likelihood of mac address collision.




Thanks to Joe Perches and Dan Carpenter.


I guess you may use Suggested-by tag as well.



Thanks for the hint, I will add it.

Regards
Michael


Re: [PATCH v3 2/4] staging: rtl8723bs: refactor rtw_macaddr_cfg()

2018-06-26 Thread Michael Straube

On 06/26/18 19:29, Andy Shevchenko wrote:

On Tue, Jun 26, 2018 at 11:14 AM, Michael Straube
 wrote:

Using is_broadcast_ether_addr() and is_zero_ether_addr() instead of
testing each byte of the mac[] array for 0xff and 0x00 shortens the
code and improves readability.

If np == NULL, of_get_property() returns NULL, hence the "np" check
is not needed.

Instead of a fixed default mac address use a random one to reduce the
likelihood of mac address collision.




Thanks to Joe Perches and Dan Carpenter.


I guess you may use Suggested-by tag as well.



Thanks for the hint, I will add it.

Regards
Michael


[PATCH] staging: rtl8188eu: remove blank lines

2018-06-26 Thread Michael Straube
Remove unrequired blank lines after open and before close braces.
Reported by checkpatch.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_ap.c| 1 -
 drivers/staging/rtl8188eu/core/rtw_efuse.c | 2 --
 drivers/staging/rtl8188eu/core/rtw_ieee80211.c | 2 --
 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c  | 1 -
 drivers/staging/rtl8188eu/core/rtw_recv.c  | 4 
 drivers/staging/rtl8188eu/core/rtw_security.c  | 2 --
 drivers/staging/rtl8188eu/core/rtw_xmit.c  | 3 ---
 7 files changed, 15 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c 
b/drivers/staging/rtl8188eu/core/rtw_ap.c
index 17cd28b893a4..be1e8bf41e00 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ap.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ap.c
@@ -306,7 +306,6 @@ voidexpire_timeout_chk(struct adapter *padapter)
spin_lock_bh(>auth_list_lock);
}
}
-
}
spin_unlock_bh(>auth_list_lock);
 
diff --git a/drivers/staging/rtl8188eu/core/rtw_efuse.c 
b/drivers/staging/rtl8188eu/core/rtw_efuse.c
index 5b8414c568e5..3ac3dd796ec9 100644
--- a/drivers/staging/rtl8188eu/core/rtw_efuse.c
+++ b/drivers/staging/rtl8188eu/core/rtw_efuse.c
@@ -301,7 +301,6 @@ static s32 iol_read_efuse(struct adapter *padapter, u8 
txpktbuf_bndy, u16 offset
 
 void efuse_ReadEFuse(struct adapter *Adapter, u8 efuseType, u16 _offset, u16 
_size_byte, u8 *pbuf)
 {
-
if (rtw_IOL_applied(Adapter)) {
rtw_hal_power_on(Adapter);
iol_mode_enable(Adapter, 1);
@@ -476,7 +475,6 @@ int Efuse_PgPacketRead(struct adapter *pAdapter, u8 offset, 
u8 *data)
efuse_addr = efuse_addr + (word_cnts*2)+1;
ReadState = PG_STATE_HEADER;
}
-
}
 
if ((data[0] == 0xff) && (data[1] == 0xff) && (data[2] == 0xff)  && 
(data[3] == 0xff) &&
diff --git a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c 
b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
index 785f78fe51c5..e47927b9c3b8 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
@@ -178,7 +178,6 @@ u8 *rtw_get_ie(u8 *pbuf, int index, uint *len, int limit)
 
 void rtw_set_supported_rate(u8 *SupportedRates, uint mode)
 {
-
memset(SupportedRates, 0, NDIS_802_11_LENGTH_RATES_EX);
 
switch (mode) {
@@ -326,7 +325,6 @@ unsigned char *rtw_get_wpa_ie(unsigned char *pie, uint 
*wpa_ie_len, int limit)
 
 unsigned char *rtw_get_wpa2_ie(unsigned char *pie, uint *rsn_ie_len, int limit)
 {
-
return rtw_get_ie(pie, _WPA2_IE_ID_, rsn_ie_len, limit);
 }
 
diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
index c8c09ae9f5a4..f05658c9239e 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
@@ -5448,7 +5448,6 @@ u8 mlme_evt_hdl(struct adapter *padapter, unsigned char 
*pbuf)
if (peventbuf) {
event_callback = wlanevents[evt_code].event_callback;
event_callback(padapter, (u8 *)peventbuf);
-
}
 
 _abort_event_:
diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c 
b/drivers/staging/rtl8188eu/core/rtw_recv.c
index 965fe9afda7c..79567cf470de 100644
--- a/drivers/staging/rtl8188eu/core/rtw_recv.c
+++ b/drivers/staging/rtl8188eu/core/rtw_recv.c
@@ -36,13 +36,11 @@ static void rtw_signal_stat_timer_hdl(struct timer_list *t);
 
 void _rtw_init_sta_recv_priv(struct sta_recv_priv *psta_recvpriv)
 {
-
memset((u8 *)psta_recvpriv, 0, sizeof(struct sta_recv_priv));
 
spin_lock_init(_recvpriv->lock);
 
_rtw_init_queue(_recvpriv->defrag_q);
-
 }
 
 int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter)
@@ -98,7 +96,6 @@ void _rtw_free_recv_priv(struct recv_priv *precvpriv)
vfree(precvpriv->pallocated_frame_buf);
 
rtw_hal_free_recv_priv(padapter);
-
 }
 
 struct recv_frame *_rtw_alloc_recvframe(struct __queue *pfree_recv_queue)
@@ -193,7 +190,6 @@ void rtw_free_recvframe_queue(struct __queue *pframequeue,  
struct __queue *pfre
}
 
spin_unlock(>lock);
-
 }
 
 u32 rtw_free_uc_swdec_pending_queue(struct adapter *adapter)
diff --git a/drivers/staging/rtl8188eu/core/rtw_security.c 
b/drivers/staging/rtl8188eu/core/rtw_security.c
index 8e204dc4ab1b..5b8d7288a4e7 100644
--- a/drivers/staging/rtl8188eu/core/rtw_security.c
+++ b/drivers/staging/rtl8188eu/core/rtw_security.c
@@ -185,7 +185,6 @@ void rtw_wep_encrypt(struct adapter *padapter, u8 
*pxmitframe)
}
}
}
-
 }
 
 int rtw_wep_decrypt(struct adapter  *padapter, u8 *precvframe)
@@ -1030,7 +1029,6 @@ static void construct_mic_header2(u8 *mic_header2, u8 
*mpdu, int a4_exists, int
mic_header2[14] = mpdu[30] & 0

[PATCH] staging: rtl8188eu: remove blank lines

2018-06-26 Thread Michael Straube
Remove unrequired blank lines after open and before close braces.
Reported by checkpatch.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_ap.c| 1 -
 drivers/staging/rtl8188eu/core/rtw_efuse.c | 2 --
 drivers/staging/rtl8188eu/core/rtw_ieee80211.c | 2 --
 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c  | 1 -
 drivers/staging/rtl8188eu/core/rtw_recv.c  | 4 
 drivers/staging/rtl8188eu/core/rtw_security.c  | 2 --
 drivers/staging/rtl8188eu/core/rtw_xmit.c  | 3 ---
 7 files changed, 15 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c 
b/drivers/staging/rtl8188eu/core/rtw_ap.c
index 17cd28b893a4..be1e8bf41e00 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ap.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ap.c
@@ -306,7 +306,6 @@ voidexpire_timeout_chk(struct adapter *padapter)
spin_lock_bh(>auth_list_lock);
}
}
-
}
spin_unlock_bh(>auth_list_lock);
 
diff --git a/drivers/staging/rtl8188eu/core/rtw_efuse.c 
b/drivers/staging/rtl8188eu/core/rtw_efuse.c
index 5b8414c568e5..3ac3dd796ec9 100644
--- a/drivers/staging/rtl8188eu/core/rtw_efuse.c
+++ b/drivers/staging/rtl8188eu/core/rtw_efuse.c
@@ -301,7 +301,6 @@ static s32 iol_read_efuse(struct adapter *padapter, u8 
txpktbuf_bndy, u16 offset
 
 void efuse_ReadEFuse(struct adapter *Adapter, u8 efuseType, u16 _offset, u16 
_size_byte, u8 *pbuf)
 {
-
if (rtw_IOL_applied(Adapter)) {
rtw_hal_power_on(Adapter);
iol_mode_enable(Adapter, 1);
@@ -476,7 +475,6 @@ int Efuse_PgPacketRead(struct adapter *pAdapter, u8 offset, 
u8 *data)
efuse_addr = efuse_addr + (word_cnts*2)+1;
ReadState = PG_STATE_HEADER;
}
-
}
 
if ((data[0] == 0xff) && (data[1] == 0xff) && (data[2] == 0xff)  && 
(data[3] == 0xff) &&
diff --git a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c 
b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
index 785f78fe51c5..e47927b9c3b8 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
@@ -178,7 +178,6 @@ u8 *rtw_get_ie(u8 *pbuf, int index, uint *len, int limit)
 
 void rtw_set_supported_rate(u8 *SupportedRates, uint mode)
 {
-
memset(SupportedRates, 0, NDIS_802_11_LENGTH_RATES_EX);
 
switch (mode) {
@@ -326,7 +325,6 @@ unsigned char *rtw_get_wpa_ie(unsigned char *pie, uint 
*wpa_ie_len, int limit)
 
 unsigned char *rtw_get_wpa2_ie(unsigned char *pie, uint *rsn_ie_len, int limit)
 {
-
return rtw_get_ie(pie, _WPA2_IE_ID_, rsn_ie_len, limit);
 }
 
diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
index c8c09ae9f5a4..f05658c9239e 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
@@ -5448,7 +5448,6 @@ u8 mlme_evt_hdl(struct adapter *padapter, unsigned char 
*pbuf)
if (peventbuf) {
event_callback = wlanevents[evt_code].event_callback;
event_callback(padapter, (u8 *)peventbuf);
-
}
 
 _abort_event_:
diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c 
b/drivers/staging/rtl8188eu/core/rtw_recv.c
index 965fe9afda7c..79567cf470de 100644
--- a/drivers/staging/rtl8188eu/core/rtw_recv.c
+++ b/drivers/staging/rtl8188eu/core/rtw_recv.c
@@ -36,13 +36,11 @@ static void rtw_signal_stat_timer_hdl(struct timer_list *t);
 
 void _rtw_init_sta_recv_priv(struct sta_recv_priv *psta_recvpriv)
 {
-
memset((u8 *)psta_recvpriv, 0, sizeof(struct sta_recv_priv));
 
spin_lock_init(_recvpriv->lock);
 
_rtw_init_queue(_recvpriv->defrag_q);
-
 }
 
 int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter)
@@ -98,7 +96,6 @@ void _rtw_free_recv_priv(struct recv_priv *precvpriv)
vfree(precvpriv->pallocated_frame_buf);
 
rtw_hal_free_recv_priv(padapter);
-
 }
 
 struct recv_frame *_rtw_alloc_recvframe(struct __queue *pfree_recv_queue)
@@ -193,7 +190,6 @@ void rtw_free_recvframe_queue(struct __queue *pframequeue,  
struct __queue *pfre
}
 
spin_unlock(>lock);
-
 }
 
 u32 rtw_free_uc_swdec_pending_queue(struct adapter *adapter)
diff --git a/drivers/staging/rtl8188eu/core/rtw_security.c 
b/drivers/staging/rtl8188eu/core/rtw_security.c
index 8e204dc4ab1b..5b8d7288a4e7 100644
--- a/drivers/staging/rtl8188eu/core/rtw_security.c
+++ b/drivers/staging/rtl8188eu/core/rtw_security.c
@@ -185,7 +185,6 @@ void rtw_wep_encrypt(struct adapter *padapter, u8 
*pxmitframe)
}
}
}
-
 }
 
 int rtw_wep_decrypt(struct adapter  *padapter, u8 *precvframe)
@@ -1030,7 +1029,6 @@ static void construct_mic_header2(u8 *mic_header2, u8 
*mpdu, int a4_exists, int
mic_header2[14] = mpdu[30] & 0

[PATCH v3 1/4] staging: rtl8723bs: fix comparsion to NULL - coding style

2018-06-26 Thread Michael Straube
Fix comparsion to NULL issues found by checkpatch.
Use !x instead of x == NULL.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index 0822e440204e..e55895632921 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -747,7 +747,7 @@ u8 rtw_is_wps_ie(u8 *ie_ptr, uint *wps_ielen)
u8 match = false;
u8 eid, wps_oui[4] = {0x0, 0x50, 0xf2, 0x04};
 
-   if (ie_ptr == NULL)
+   if (!ie_ptr)
return match;
 
eid = ie_ptr[0];
@@ -1163,7 +1163,7 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
const unsigned char *addr;
int len;
 
-   if (mac_addr == NULL)
+   if (!mac_addr)
return;
 
if (rtw_initmac) {  /*  Users specify the mac address */
-- 
2.18.0



[PATCH v3 2/4] staging: rtl8723bs: refactor rtw_macaddr_cfg()

2018-06-26 Thread Michael Straube
Using is_broadcast_ether_addr() and is_zero_ether_addr() instead of
testing each byte of the mac[] array for 0xff and 0x00 shortens the
code and improves readability.

If np == NULL, of_get_property() returns NULL, hence the "np" check
is not needed.

Instead of a fixed default mac address use a random one to reduce the
likelihood of mac address collision.

Thanks to Joe Perches and Dan Carpenter.

Signed-off-by: Michael Straube 
---
 .../staging/rtl8723bs/core/rtw_ieee80211.c| 19 ---
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index e55895632921..7aa00d1391f7 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -1177,24 +1177,13 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
memcpy(mac, mac_addr, ETH_ALEN);
}
 
-   if (((mac[0] == 0xff) && (mac[1] == 0xff) && (mac[2] == 0xff) &&
-(mac[3] == 0xff) && (mac[4] == 0xff) && (mac[5] == 0xff)) ||
-   ((mac[0] == 0x00) && (mac[1] == 0x00) && (mac[2] == 0x00) &&
-(mac[3] == 0x00) && (mac[4] == 0x00) && (mac[5] == 0x00))) {
-   if (np &&
-   (addr = of_get_property(np, "local-mac-address", )) &&
+   if (is_broadcast_ether_addr(mac) || is_zero_ether_addr(mac)) {
+   if ((addr = of_get_property(np, "local-mac-address", )) &&
len == ETH_ALEN) {
memcpy(mac_addr, addr, ETH_ALEN);
} else {
-   mac[0] = 0x00;
-   mac[1] = 0xe0;
-   mac[2] = 0x4c;
-   mac[3] = 0x87;
-   mac[4] = 0x00;
-   mac[5] = 0x00;
-   /*  use default mac addresss */
-   memcpy(mac_addr, mac, ETH_ALEN);
-   DBG_871X("MAC Address from efuse error, assign default 
one !!!\n");
+   eth_random_addr(mac_addr);
+   DBG_871X("MAC Address from efuse error, assign random 
one !!!\n");
}
}
 
-- 
2.18.0



[PATCH v3 1/4] staging: rtl8723bs: fix comparsion to NULL - coding style

2018-06-26 Thread Michael Straube
Fix comparsion to NULL issues found by checkpatch.
Use !x instead of x == NULL.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index 0822e440204e..e55895632921 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -747,7 +747,7 @@ u8 rtw_is_wps_ie(u8 *ie_ptr, uint *wps_ielen)
u8 match = false;
u8 eid, wps_oui[4] = {0x0, 0x50, 0xf2, 0x04};
 
-   if (ie_ptr == NULL)
+   if (!ie_ptr)
return match;
 
eid = ie_ptr[0];
@@ -1163,7 +1163,7 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
const unsigned char *addr;
int len;
 
-   if (mac_addr == NULL)
+   if (!mac_addr)
return;
 
if (rtw_initmac) {  /*  Users specify the mac address */
-- 
2.18.0



[PATCH v3 2/4] staging: rtl8723bs: refactor rtw_macaddr_cfg()

2018-06-26 Thread Michael Straube
Using is_broadcast_ether_addr() and is_zero_ether_addr() instead of
testing each byte of the mac[] array for 0xff and 0x00 shortens the
code and improves readability.

If np == NULL, of_get_property() returns NULL, hence the "np" check
is not needed.

Instead of a fixed default mac address use a random one to reduce the
likelihood of mac address collision.

Thanks to Joe Perches and Dan Carpenter.

Signed-off-by: Michael Straube 
---
 .../staging/rtl8723bs/core/rtw_ieee80211.c| 19 ---
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index e55895632921..7aa00d1391f7 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -1177,24 +1177,13 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
memcpy(mac, mac_addr, ETH_ALEN);
}
 
-   if (((mac[0] == 0xff) && (mac[1] == 0xff) && (mac[2] == 0xff) &&
-(mac[3] == 0xff) && (mac[4] == 0xff) && (mac[5] == 0xff)) ||
-   ((mac[0] == 0x00) && (mac[1] == 0x00) && (mac[2] == 0x00) &&
-(mac[3] == 0x00) && (mac[4] == 0x00) && (mac[5] == 0x00))) {
-   if (np &&
-   (addr = of_get_property(np, "local-mac-address", )) &&
+   if (is_broadcast_ether_addr(mac) || is_zero_ether_addr(mac)) {
+   if ((addr = of_get_property(np, "local-mac-address", )) &&
len == ETH_ALEN) {
memcpy(mac_addr, addr, ETH_ALEN);
} else {
-   mac[0] = 0x00;
-   mac[1] = 0xe0;
-   mac[2] = 0x4c;
-   mac[3] = 0x87;
-   mac[4] = 0x00;
-   mac[5] = 0x00;
-   /*  use default mac addresss */
-   memcpy(mac_addr, mac, ETH_ALEN);
-   DBG_871X("MAC Address from efuse error, assign default 
one !!!\n");
+   eth_random_addr(mac_addr);
+   DBG_871X("MAC Address from efuse error, assign random 
one !!!\n");
}
}
 
-- 
2.18.0



[PATCH v3 3/4] staging: rtl8723bs: use ether_addr_copy() in rtw_macaddr_cfg()

2018-06-26 Thread Michael Straube
Use ether_addr_copy() instead of memcpy() to copy the mac address.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index 7aa00d1391f7..8af4a89e632f 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -1172,15 +1172,15 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
for (jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3) {
mac[jj] = key_2char2num(rtw_initmac[kk], rtw_initmac[kk 
+ 1]);
}
-   memcpy(mac_addr, mac, ETH_ALEN);
+   ether_addr_copy(mac_addr, mac);
} else{ /*  Use the mac address stored in the Efuse */
-   memcpy(mac, mac_addr, ETH_ALEN);
+   ether_addr_copy(mac, mac_addr);
}
 
if (is_broadcast_ether_addr(mac) || is_zero_ether_addr(mac)) {
if ((addr = of_get_property(np, "local-mac-address", )) &&
len == ETH_ALEN) {
-   memcpy(mac_addr, addr, ETH_ALEN);
+   ether_addr_copy(mac_addr, addr);
} else {
eth_random_addr(mac_addr);
DBG_871X("MAC Address from efuse error, assign random 
one !!!\n");
-- 
2.18.0



[PATCH v3 3/4] staging: rtl8723bs: use ether_addr_copy() in rtw_macaddr_cfg()

2018-06-26 Thread Michael Straube
Use ether_addr_copy() instead of memcpy() to copy the mac address.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index 7aa00d1391f7..8af4a89e632f 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -1172,15 +1172,15 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
for (jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3) {
mac[jj] = key_2char2num(rtw_initmac[kk], rtw_initmac[kk 
+ 1]);
}
-   memcpy(mac_addr, mac, ETH_ALEN);
+   ether_addr_copy(mac_addr, mac);
} else{ /*  Use the mac address stored in the Efuse */
-   memcpy(mac, mac_addr, ETH_ALEN);
+   ether_addr_copy(mac, mac_addr);
}
 
if (is_broadcast_ether_addr(mac) || is_zero_ether_addr(mac)) {
if ((addr = of_get_property(np, "local-mac-address", )) &&
len == ETH_ALEN) {
-   memcpy(mac_addr, addr, ETH_ALEN);
+   ether_addr_copy(mac_addr, addr);
} else {
eth_random_addr(mac_addr);
DBG_871X("MAC Address from efuse error, assign random 
one !!!\n");
-- 
2.18.0



[PATCH v3 4/4] staging: rtl8723bs: use mac_pton() in rtw_macaddr_cfg()

2018-06-26 Thread Michael Straube
Use the mac_pton() helper to convert the mac address string.

The functions key_char2num() and key_2char2num() are not used
anywhere else and can be removed.

This also has the benefit of validating the input since mac_pton()
returns false if the string is not valid.

Signed-off-by: Michael Straube 
---
 .../staging/rtl8723bs/core/rtw_ieee80211.c| 30 +++
 .../staging/rtl8723bs/os_dep/ioctl_linux.c|  3 --
 2 files changed, 4 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index 8af4a89e632f..8e0025e1ff14 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -1137,25 +1137,6 @@ ParseRes rtw_ieee802_11_parse_elems(u8 *start, uint len,
 
 }
 
-static u8 key_char2num(u8 ch);
-static u8 key_char2num(u8 ch)
-{
-   if ((ch >= '0') && (ch <= '9'))
-   return ch - '0';
-   else if ((ch >= 'a') && (ch <= 'f'))
-   return ch - 'a' + 10;
-   else if ((ch >= 'A') && (ch <= 'F'))
-   return ch - 'A' + 10;
-   else
-   return 0xff;
-}
-
-u8 key_2char2num(u8 hch, u8 lch);
-u8 key_2char2num(u8 hch, u8 lch)
-{
-   return ((key_char2num(hch) << 4) | key_char2num(lch));
-}
-
 void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
 {
u8 mac[ETH_ALEN];
@@ -1166,14 +1147,11 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
if (!mac_addr)
return;
 
-   if (rtw_initmac) {  /*  Users specify the mac address */
-   int jj, kk;
-
-   for (jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3) {
-   mac[jj] = key_2char2num(rtw_initmac[kk], rtw_initmac[kk 
+ 1]);
-   }
+   if (rtw_initmac && mac_pton(rtw_initmac, mac)) {
+   /* Users specify the mac address */
ether_addr_copy(mac_addr, mac);
-   } else{ /*  Use the mac address stored in the Efuse */
+   } else {
+   /* Use the mac address stored in the Efuse */
ether_addr_copy(mac, mac_addr);
}
 
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c 
b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index 39502156f652..4eb51f45b387 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -32,9 +32,6 @@
 #define WEXT_CSCAN_HOME_DWELL_SECTION  'H'
 #define WEXT_CSCAN_TYPE_SECTION'T'
 
-
-extern u8 key_2char2num(u8 hch, u8 lch);
-
 static u32 rtw_rates[] = {100, 200, 550, 1100,
600, 900, 1200, 1800, 2400, 3600, 4800, 
5400};
 
-- 
2.18.0



[PATCH v3 4/4] staging: rtl8723bs: use mac_pton() in rtw_macaddr_cfg()

2018-06-26 Thread Michael Straube
Use the mac_pton() helper to convert the mac address string.

The functions key_char2num() and key_2char2num() are not used
anywhere else and can be removed.

This also has the benefit of validating the input since mac_pton()
returns false if the string is not valid.

Signed-off-by: Michael Straube 
---
 .../staging/rtl8723bs/core/rtw_ieee80211.c| 30 +++
 .../staging/rtl8723bs/os_dep/ioctl_linux.c|  3 --
 2 files changed, 4 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index 8af4a89e632f..8e0025e1ff14 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -1137,25 +1137,6 @@ ParseRes rtw_ieee802_11_parse_elems(u8 *start, uint len,
 
 }
 
-static u8 key_char2num(u8 ch);
-static u8 key_char2num(u8 ch)
-{
-   if ((ch >= '0') && (ch <= '9'))
-   return ch - '0';
-   else if ((ch >= 'a') && (ch <= 'f'))
-   return ch - 'a' + 10;
-   else if ((ch >= 'A') && (ch <= 'F'))
-   return ch - 'A' + 10;
-   else
-   return 0xff;
-}
-
-u8 key_2char2num(u8 hch, u8 lch);
-u8 key_2char2num(u8 hch, u8 lch)
-{
-   return ((key_char2num(hch) << 4) | key_char2num(lch));
-}
-
 void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
 {
u8 mac[ETH_ALEN];
@@ -1166,14 +1147,11 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
if (!mac_addr)
return;
 
-   if (rtw_initmac) {  /*  Users specify the mac address */
-   int jj, kk;
-
-   for (jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3) {
-   mac[jj] = key_2char2num(rtw_initmac[kk], rtw_initmac[kk 
+ 1]);
-   }
+   if (rtw_initmac && mac_pton(rtw_initmac, mac)) {
+   /* Users specify the mac address */
ether_addr_copy(mac_addr, mac);
-   } else{ /*  Use the mac address stored in the Efuse */
+   } else {
+   /* Use the mac address stored in the Efuse */
ether_addr_copy(mac, mac_addr);
}
 
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c 
b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index 39502156f652..4eb51f45b387 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -32,9 +32,6 @@
 #define WEXT_CSCAN_HOME_DWELL_SECTION  'H'
 #define WEXT_CSCAN_TYPE_SECTION'T'
 
-
-extern u8 key_2char2num(u8 hch, u8 lch);
-
 static u32 rtw_rates[] = {100, 200, 550, 1100,
600, 900, 1200, 1800, 2400, 3600, 4800, 
5400};
 
-- 
2.18.0



Re: [PATCH v2 4/4] staging: rtl8723bs: use mac_pton() in rtw_macaddr_cfg()

2018-06-26 Thread Michael Straube

On 06/25/18 17:12, Michael Straube wrote:


+   } else{
+   /* Use the mac address stored in the Efuse */
ether_addr_copy(mac, mac_addr);
}


} else {

I'll resend the series with this corrected.

Regards,
Michael


Re: [PATCH v2 4/4] staging: rtl8723bs: use mac_pton() in rtw_macaddr_cfg()

2018-06-26 Thread Michael Straube

On 06/25/18 17:12, Michael Straube wrote:


+   } else{
+   /* Use the mac address stored in the Efuse */
ether_addr_copy(mac, mac_addr);
}


} else {

I'll resend the series with this corrected.

Regards,
Michael


[PATCH] staging: rtl8188eu: add SPDX identifiers

2018-06-25 Thread Michael Straube
This satisfies a checkpatch warning and is the preferred
method for notating the license.

The SPDX identifier is a legally binding shorthand, which
can be used instead of the full boiler plate text.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_ap.c| 10 +-
 drivers/staging/rtl8188eu/core/rtw_cmd.c   | 10 +-
 drivers/staging/rtl8188eu/core/rtw_debug.c | 10 +-
 drivers/staging/rtl8188eu/core/rtw_efuse.c | 10 +-
 drivers/staging/rtl8188eu/core/rtw_ieee80211.c | 10 +-
 drivers/staging/rtl8188eu/core/rtw_ioctl_set.c | 10 +-
 drivers/staging/rtl8188eu/core/rtw_iol.c   | 11 +--
 drivers/staging/rtl8188eu/core/rtw_led.c   | 11 +--
 drivers/staging/rtl8188eu/core/rtw_mlme.c  | 10 +-
 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c  | 10 +-
 drivers/staging/rtl8188eu/core/rtw_pwrctrl.c   | 10 +-
 drivers/staging/rtl8188eu/core/rtw_recv.c  | 10 +-
 drivers/staging/rtl8188eu/core/rtw_rf.c| 10 +-
 drivers/staging/rtl8188eu/core/rtw_security.c  | 10 +-
 drivers/staging/rtl8188eu/core/rtw_sreset.c| 10 +-
 drivers/staging/rtl8188eu/core/rtw_sta_mgt.c   | 10 +-
 drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 10 +-
 drivers/staging/rtl8188eu/core/rtw_xmit.c  | 10 +-
 drivers/staging/rtl8188eu/hal/bb_cfg.c | 10 +-
 drivers/staging/rtl8188eu/hal/fw.c | 13 +
 drivers/staging/rtl8188eu/hal/hal_com.c| 10 +-
 drivers/staging/rtl8188eu/hal/hal_intf.c   | 10 +-
 drivers/staging/rtl8188eu/hal/mac_cfg.c| 18 +-
 drivers/staging/rtl8188eu/hal/odm.c| 10 +-
 drivers/staging/rtl8188eu/hal/odm_HWConfig.c   | 10 +-
 drivers/staging/rtl8188eu/hal/odm_RTL8188E.c   | 10 +-
 drivers/staging/rtl8188eu/hal/phy.c| 10 +-
 drivers/staging/rtl8188eu/hal/pwrseq.c | 10 +-
 drivers/staging/rtl8188eu/hal/pwrseqcmd.c  | 10 +-
 drivers/staging/rtl8188eu/hal/rf.c | 10 +-
 drivers/staging/rtl8188eu/hal/rf_cfg.c | 18 +-
 drivers/staging/rtl8188eu/hal/rtl8188e_cmd.c   | 10 +-
 drivers/staging/rtl8188eu/hal/rtl8188e_dm.c| 10 +-
 .../staging/rtl8188eu/hal/rtl8188e_hal_init.c  | 10 +-
 .../staging/rtl8188eu/hal/rtl8188e_rxdesc.c| 10 +-
 drivers/staging/rtl8188eu/hal/rtl8188e_xmit.c  | 10 +-
 drivers/staging/rtl8188eu/hal/rtl8188eu_led.c  | 10 +-
 drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c | 10 +-
 drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c | 10 +-
 drivers/staging/rtl8188eu/hal/usb_halinit.c| 10 +-
 .../staging/rtl8188eu/include/Hal8188EPhyCfg.h | 10 +-
 .../staging/rtl8188eu/include/Hal8188EPhyReg.h | 10 +-
 drivers/staging/rtl8188eu/include/HalVerDef.h  | 10 +-
 .../staging/rtl8188eu/include/basic_types.h| 12 ++--
 drivers/staging/rtl8188eu/include/drv_types.h  | 10 +-
 drivers/staging/rtl8188eu/include/fw.h | 13 +
 drivers/staging/rtl8188eu/include/hal_com.h| 10 +-
 drivers/staging/rtl8188eu/include/hal_intf.h   | 10 +-
 drivers/staging/rtl8188eu/include/ieee80211.h  | 10 +-
 drivers/staging/rtl8188eu/include/mlme_osdep.h | 10 +-
 drivers/staging/rtl8188eu/include/mon.h| 10 +-
 .../staging/rtl8188eu/include/mp_custom_oid.h  | 10 +-
 drivers/staging/rtl8188eu/include/odm.h| 10 +-
 .../staging/rtl8188eu/include/odm_HWConfig.h   | 11 +--
 .../staging/rtl8188eu/include/odm_RTL8188E.h   | 10 +-
 .../rtl8188eu/include/odm_RegDefine11N.h   | 10 +-
 drivers/staging/rtl8188eu/include/odm_debug.h  | 10 +-
 .../staging/rtl8188eu/include/odm_precomp.h| 10 +-
 drivers/staging/rtl8188eu/include/odm_reg.h| 10 +-
 drivers/staging/rtl8188eu/include/odm_types.h  | 10 +-
 drivers/staging/rtl8188eu/include/osdep_intf.h | 10 +-
 .../staging/rtl8188eu/include/osdep_service.h  | 10 +-
 drivers/staging/rtl8188eu/include/pwrseq.h | 11 +--
 drivers/staging/rtl8188eu/include/pwrseqcmd.h  | 10 +-
 drivers/staging/rtl8188eu/include/recv_osdep.h | 10 +-
 .../staging/rtl8188eu/include/rtl8188e_cmd.h   | 10 +-
 .../staging/rtl8188eu/include/rtl8188e_dm.h| 10 +-
 .../staging/rtl8188eu/include/rtl8188e_hal.h   | 10 +-
 .../staging/rtl8188eu/include/rtl8188e_led.h   | 10 +-
 .../staging/rtl8188eu/include/rtl8188e_recv.h  | 10 +-
 .../staging/rtl8188eu/include/rtl8188e_spec.h  | 10 +-
 .../staging/rtl8188eu/include/rtl8188e_xmit.h  | 10 +-
 .../staging/rtl8188eu/include/rtw_android.h| 10 +-
 drivers/staging/rtl8188eu/include/rtw_ap.h | 10

[PATCH] staging: rtl8188eu: add SPDX identifiers

2018-06-25 Thread Michael Straube
This satisfies a checkpatch warning and is the preferred
method for notating the license.

The SPDX identifier is a legally binding shorthand, which
can be used instead of the full boiler plate text.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_ap.c| 10 +-
 drivers/staging/rtl8188eu/core/rtw_cmd.c   | 10 +-
 drivers/staging/rtl8188eu/core/rtw_debug.c | 10 +-
 drivers/staging/rtl8188eu/core/rtw_efuse.c | 10 +-
 drivers/staging/rtl8188eu/core/rtw_ieee80211.c | 10 +-
 drivers/staging/rtl8188eu/core/rtw_ioctl_set.c | 10 +-
 drivers/staging/rtl8188eu/core/rtw_iol.c   | 11 +--
 drivers/staging/rtl8188eu/core/rtw_led.c   | 11 +--
 drivers/staging/rtl8188eu/core/rtw_mlme.c  | 10 +-
 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c  | 10 +-
 drivers/staging/rtl8188eu/core/rtw_pwrctrl.c   | 10 +-
 drivers/staging/rtl8188eu/core/rtw_recv.c  | 10 +-
 drivers/staging/rtl8188eu/core/rtw_rf.c| 10 +-
 drivers/staging/rtl8188eu/core/rtw_security.c  | 10 +-
 drivers/staging/rtl8188eu/core/rtw_sreset.c| 10 +-
 drivers/staging/rtl8188eu/core/rtw_sta_mgt.c   | 10 +-
 drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 10 +-
 drivers/staging/rtl8188eu/core/rtw_xmit.c  | 10 +-
 drivers/staging/rtl8188eu/hal/bb_cfg.c | 10 +-
 drivers/staging/rtl8188eu/hal/fw.c | 13 +
 drivers/staging/rtl8188eu/hal/hal_com.c| 10 +-
 drivers/staging/rtl8188eu/hal/hal_intf.c   | 10 +-
 drivers/staging/rtl8188eu/hal/mac_cfg.c| 18 +-
 drivers/staging/rtl8188eu/hal/odm.c| 10 +-
 drivers/staging/rtl8188eu/hal/odm_HWConfig.c   | 10 +-
 drivers/staging/rtl8188eu/hal/odm_RTL8188E.c   | 10 +-
 drivers/staging/rtl8188eu/hal/phy.c| 10 +-
 drivers/staging/rtl8188eu/hal/pwrseq.c | 10 +-
 drivers/staging/rtl8188eu/hal/pwrseqcmd.c  | 10 +-
 drivers/staging/rtl8188eu/hal/rf.c | 10 +-
 drivers/staging/rtl8188eu/hal/rf_cfg.c | 18 +-
 drivers/staging/rtl8188eu/hal/rtl8188e_cmd.c   | 10 +-
 drivers/staging/rtl8188eu/hal/rtl8188e_dm.c| 10 +-
 .../staging/rtl8188eu/hal/rtl8188e_hal_init.c  | 10 +-
 .../staging/rtl8188eu/hal/rtl8188e_rxdesc.c| 10 +-
 drivers/staging/rtl8188eu/hal/rtl8188e_xmit.c  | 10 +-
 drivers/staging/rtl8188eu/hal/rtl8188eu_led.c  | 10 +-
 drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c | 10 +-
 drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c | 10 +-
 drivers/staging/rtl8188eu/hal/usb_halinit.c| 10 +-
 .../staging/rtl8188eu/include/Hal8188EPhyCfg.h | 10 +-
 .../staging/rtl8188eu/include/Hal8188EPhyReg.h | 10 +-
 drivers/staging/rtl8188eu/include/HalVerDef.h  | 10 +-
 .../staging/rtl8188eu/include/basic_types.h| 12 ++--
 drivers/staging/rtl8188eu/include/drv_types.h  | 10 +-
 drivers/staging/rtl8188eu/include/fw.h | 13 +
 drivers/staging/rtl8188eu/include/hal_com.h| 10 +-
 drivers/staging/rtl8188eu/include/hal_intf.h   | 10 +-
 drivers/staging/rtl8188eu/include/ieee80211.h  | 10 +-
 drivers/staging/rtl8188eu/include/mlme_osdep.h | 10 +-
 drivers/staging/rtl8188eu/include/mon.h| 10 +-
 .../staging/rtl8188eu/include/mp_custom_oid.h  | 10 +-
 drivers/staging/rtl8188eu/include/odm.h| 10 +-
 .../staging/rtl8188eu/include/odm_HWConfig.h   | 11 +--
 .../staging/rtl8188eu/include/odm_RTL8188E.h   | 10 +-
 .../rtl8188eu/include/odm_RegDefine11N.h   | 10 +-
 drivers/staging/rtl8188eu/include/odm_debug.h  | 10 +-
 .../staging/rtl8188eu/include/odm_precomp.h| 10 +-
 drivers/staging/rtl8188eu/include/odm_reg.h| 10 +-
 drivers/staging/rtl8188eu/include/odm_types.h  | 10 +-
 drivers/staging/rtl8188eu/include/osdep_intf.h | 10 +-
 .../staging/rtl8188eu/include/osdep_service.h  | 10 +-
 drivers/staging/rtl8188eu/include/pwrseq.h | 11 +--
 drivers/staging/rtl8188eu/include/pwrseqcmd.h  | 10 +-
 drivers/staging/rtl8188eu/include/recv_osdep.h | 10 +-
 .../staging/rtl8188eu/include/rtl8188e_cmd.h   | 10 +-
 .../staging/rtl8188eu/include/rtl8188e_dm.h| 10 +-
 .../staging/rtl8188eu/include/rtl8188e_hal.h   | 10 +-
 .../staging/rtl8188eu/include/rtl8188e_led.h   | 10 +-
 .../staging/rtl8188eu/include/rtl8188e_recv.h  | 10 +-
 .../staging/rtl8188eu/include/rtl8188e_spec.h  | 10 +-
 .../staging/rtl8188eu/include/rtl8188e_xmit.h  | 10 +-
 .../staging/rtl8188eu/include/rtw_android.h| 10 +-
 drivers/staging/rtl8188eu/include/rtw_ap.h | 10

[PATCH v2 2/4] staging: rtl8723bs: refactor rtw_macaddr_cfg()

2018-06-25 Thread Michael Straube
Using is_broadcast_ether_addr() and is_zero_ether_addr() instead of
testing each byte of the mac[] array for 0xff and 0x00 shortens the
code and improves readability.

If np == NULL, of_get_property() returns NULL, hence the "np" check
is not needed.

Instead of a fixed default mac address use a random one to reduce the
likelihood of mac address collision.

Thanks to Joe Perches and Dan Carpenter.

Signed-off-by: Michael Straube 
---
 .../staging/rtl8723bs/core/rtw_ieee80211.c| 19 ---
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index e55895632921..7aa00d1391f7 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -1177,24 +1177,13 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
memcpy(mac, mac_addr, ETH_ALEN);
}
 
-   if (((mac[0] == 0xff) && (mac[1] == 0xff) && (mac[2] == 0xff) &&
-(mac[3] == 0xff) && (mac[4] == 0xff) && (mac[5] == 0xff)) ||
-   ((mac[0] == 0x00) && (mac[1] == 0x00) && (mac[2] == 0x00) &&
-(mac[3] == 0x00) && (mac[4] == 0x00) && (mac[5] == 0x00))) {
-   if (np &&
-   (addr = of_get_property(np, "local-mac-address", )) &&
+   if (is_broadcast_ether_addr(mac) || is_zero_ether_addr(mac)) {
+   if ((addr = of_get_property(np, "local-mac-address", )) &&
len == ETH_ALEN) {
memcpy(mac_addr, addr, ETH_ALEN);
} else {
-   mac[0] = 0x00;
-   mac[1] = 0xe0;
-   mac[2] = 0x4c;
-   mac[3] = 0x87;
-   mac[4] = 0x00;
-   mac[5] = 0x00;
-   /*  use default mac addresss */
-   memcpy(mac_addr, mac, ETH_ALEN);
-   DBG_871X("MAC Address from efuse error, assign default 
one !!!\n");
+   eth_random_addr(mac_addr);
+   DBG_871X("MAC Address from efuse error, assign random 
one !!!\n");
}
}
 
-- 
2.18.0



[PATCH v2 2/4] staging: rtl8723bs: refactor rtw_macaddr_cfg()

2018-06-25 Thread Michael Straube
Using is_broadcast_ether_addr() and is_zero_ether_addr() instead of
testing each byte of the mac[] array for 0xff and 0x00 shortens the
code and improves readability.

If np == NULL, of_get_property() returns NULL, hence the "np" check
is not needed.

Instead of a fixed default mac address use a random one to reduce the
likelihood of mac address collision.

Thanks to Joe Perches and Dan Carpenter.

Signed-off-by: Michael Straube 
---
 .../staging/rtl8723bs/core/rtw_ieee80211.c| 19 ---
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index e55895632921..7aa00d1391f7 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -1177,24 +1177,13 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
memcpy(mac, mac_addr, ETH_ALEN);
}
 
-   if (((mac[0] == 0xff) && (mac[1] == 0xff) && (mac[2] == 0xff) &&
-(mac[3] == 0xff) && (mac[4] == 0xff) && (mac[5] == 0xff)) ||
-   ((mac[0] == 0x00) && (mac[1] == 0x00) && (mac[2] == 0x00) &&
-(mac[3] == 0x00) && (mac[4] == 0x00) && (mac[5] == 0x00))) {
-   if (np &&
-   (addr = of_get_property(np, "local-mac-address", )) &&
+   if (is_broadcast_ether_addr(mac) || is_zero_ether_addr(mac)) {
+   if ((addr = of_get_property(np, "local-mac-address", )) &&
len == ETH_ALEN) {
memcpy(mac_addr, addr, ETH_ALEN);
} else {
-   mac[0] = 0x00;
-   mac[1] = 0xe0;
-   mac[2] = 0x4c;
-   mac[3] = 0x87;
-   mac[4] = 0x00;
-   mac[5] = 0x00;
-   /*  use default mac addresss */
-   memcpy(mac_addr, mac, ETH_ALEN);
-   DBG_871X("MAC Address from efuse error, assign default 
one !!!\n");
+   eth_random_addr(mac_addr);
+   DBG_871X("MAC Address from efuse error, assign random 
one !!!\n");
}
}
 
-- 
2.18.0



[PATCH v2 3/4] staging: rtl8723bs: use ether_addr_copy() in rtw_macaddr_cfg()

2018-06-25 Thread Michael Straube
Use ether_addr_copy() instead of memcpy() to copy the mac address.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index 7aa00d1391f7..8af4a89e632f 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -1172,15 +1172,15 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
for (jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3) {
mac[jj] = key_2char2num(rtw_initmac[kk], rtw_initmac[kk 
+ 1]);
}
-   memcpy(mac_addr, mac, ETH_ALEN);
+   ether_addr_copy(mac_addr, mac);
} else{ /*  Use the mac address stored in the Efuse */
-   memcpy(mac, mac_addr, ETH_ALEN);
+   ether_addr_copy(mac, mac_addr);
}
 
if (is_broadcast_ether_addr(mac) || is_zero_ether_addr(mac)) {
if ((addr = of_get_property(np, "local-mac-address", )) &&
len == ETH_ALEN) {
-   memcpy(mac_addr, addr, ETH_ALEN);
+   ether_addr_copy(mac_addr, addr);
} else {
eth_random_addr(mac_addr);
DBG_871X("MAC Address from efuse error, assign random 
one !!!\n");
-- 
2.18.0



[PATCH v2 3/4] staging: rtl8723bs: use ether_addr_copy() in rtw_macaddr_cfg()

2018-06-25 Thread Michael Straube
Use ether_addr_copy() instead of memcpy() to copy the mac address.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index 7aa00d1391f7..8af4a89e632f 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -1172,15 +1172,15 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
for (jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3) {
mac[jj] = key_2char2num(rtw_initmac[kk], rtw_initmac[kk 
+ 1]);
}
-   memcpy(mac_addr, mac, ETH_ALEN);
+   ether_addr_copy(mac_addr, mac);
} else{ /*  Use the mac address stored in the Efuse */
-   memcpy(mac, mac_addr, ETH_ALEN);
+   ether_addr_copy(mac, mac_addr);
}
 
if (is_broadcast_ether_addr(mac) || is_zero_ether_addr(mac)) {
if ((addr = of_get_property(np, "local-mac-address", )) &&
len == ETH_ALEN) {
-   memcpy(mac_addr, addr, ETH_ALEN);
+   ether_addr_copy(mac_addr, addr);
} else {
eth_random_addr(mac_addr);
DBG_871X("MAC Address from efuse error, assign random 
one !!!\n");
-- 
2.18.0



[PATCH v2 1/4] staging: rtl8723bs: fix comparsion to NULL - coding style

2018-06-25 Thread Michael Straube
Fix comparsion to NULL issues found by checkpatch.
Use !x instead of x == NULL.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index 0822e440204e..e55895632921 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -747,7 +747,7 @@ u8 rtw_is_wps_ie(u8 *ie_ptr, uint *wps_ielen)
u8 match = false;
u8 eid, wps_oui[4] = {0x0, 0x50, 0xf2, 0x04};
 
-   if (ie_ptr == NULL)
+   if (!ie_ptr)
return match;
 
eid = ie_ptr[0];
@@ -1163,7 +1163,7 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
const unsigned char *addr;
int len;
 
-   if (mac_addr == NULL)
+   if (!mac_addr)
return;
 
if (rtw_initmac) {  /*  Users specify the mac address */
-- 
2.18.0



[PATCH v2 4/4] staging: rtl8723bs: use mac_pton() in rtw_macaddr_cfg()

2018-06-25 Thread Michael Straube
Use the mac_pton() helper to convert the mac address string.

The functions key_char2num() and key_2char2num() are not used
anywhere else and can be removed.

This also has the benefit of validating the input since mac_pton()
returns false if the string is not valid.

Signed-off-by: Michael Straube 
---
 .../staging/rtl8723bs/core/rtw_ieee80211.c| 30 +++
 .../staging/rtl8723bs/os_dep/ioctl_linux.c|  3 --
 2 files changed, 4 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index 8af4a89e632f..62d19cfebb06 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -1137,25 +1137,6 @@ ParseRes rtw_ieee802_11_parse_elems(u8 *start, uint len,
 
 }
 
-static u8 key_char2num(u8 ch);
-static u8 key_char2num(u8 ch)
-{
-   if ((ch >= '0') && (ch <= '9'))
-   return ch - '0';
-   else if ((ch >= 'a') && (ch <= 'f'))
-   return ch - 'a' + 10;
-   else if ((ch >= 'A') && (ch <= 'F'))
-   return ch - 'A' + 10;
-   else
-   return 0xff;
-}
-
-u8 key_2char2num(u8 hch, u8 lch);
-u8 key_2char2num(u8 hch, u8 lch)
-{
-   return ((key_char2num(hch) << 4) | key_char2num(lch));
-}
-
 void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
 {
u8 mac[ETH_ALEN];
@@ -1166,14 +1147,11 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
if (!mac_addr)
return;
 
-   if (rtw_initmac) {  /*  Users specify the mac address */
-   int jj, kk;
-
-   for (jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3) {
-   mac[jj] = key_2char2num(rtw_initmac[kk], rtw_initmac[kk 
+ 1]);
-   }
+   if (rtw_initmac && mac_pton(rtw_initmac, mac)) {
+   /* Users specify the mac address */
ether_addr_copy(mac_addr, mac);
-   } else{ /*  Use the mac address stored in the Efuse */
+   } else{
+   /* Use the mac address stored in the Efuse */
ether_addr_copy(mac, mac_addr);
}
 
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c 
b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index 39502156f652..4eb51f45b387 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -32,9 +32,6 @@
 #define WEXT_CSCAN_HOME_DWELL_SECTION  'H'
 #define WEXT_CSCAN_TYPE_SECTION'T'
 
-
-extern u8 key_2char2num(u8 hch, u8 lch);
-
 static u32 rtw_rates[] = {100, 200, 550, 1100,
600, 900, 1200, 1800, 2400, 3600, 4800, 
5400};
 
-- 
2.18.0



[PATCH v2 1/4] staging: rtl8723bs: fix comparsion to NULL - coding style

2018-06-25 Thread Michael Straube
Fix comparsion to NULL issues found by checkpatch.
Use !x instead of x == NULL.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index 0822e440204e..e55895632921 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -747,7 +747,7 @@ u8 rtw_is_wps_ie(u8 *ie_ptr, uint *wps_ielen)
u8 match = false;
u8 eid, wps_oui[4] = {0x0, 0x50, 0xf2, 0x04};
 
-   if (ie_ptr == NULL)
+   if (!ie_ptr)
return match;
 
eid = ie_ptr[0];
@@ -1163,7 +1163,7 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
const unsigned char *addr;
int len;
 
-   if (mac_addr == NULL)
+   if (!mac_addr)
return;
 
if (rtw_initmac) {  /*  Users specify the mac address */
-- 
2.18.0



[PATCH v2 4/4] staging: rtl8723bs: use mac_pton() in rtw_macaddr_cfg()

2018-06-25 Thread Michael Straube
Use the mac_pton() helper to convert the mac address string.

The functions key_char2num() and key_2char2num() are not used
anywhere else and can be removed.

This also has the benefit of validating the input since mac_pton()
returns false if the string is not valid.

Signed-off-by: Michael Straube 
---
 .../staging/rtl8723bs/core/rtw_ieee80211.c| 30 +++
 .../staging/rtl8723bs/os_dep/ioctl_linux.c|  3 --
 2 files changed, 4 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index 8af4a89e632f..62d19cfebb06 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -1137,25 +1137,6 @@ ParseRes rtw_ieee802_11_parse_elems(u8 *start, uint len,
 
 }
 
-static u8 key_char2num(u8 ch);
-static u8 key_char2num(u8 ch)
-{
-   if ((ch >= '0') && (ch <= '9'))
-   return ch - '0';
-   else if ((ch >= 'a') && (ch <= 'f'))
-   return ch - 'a' + 10;
-   else if ((ch >= 'A') && (ch <= 'F'))
-   return ch - 'A' + 10;
-   else
-   return 0xff;
-}
-
-u8 key_2char2num(u8 hch, u8 lch);
-u8 key_2char2num(u8 hch, u8 lch)
-{
-   return ((key_char2num(hch) << 4) | key_char2num(lch));
-}
-
 void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
 {
u8 mac[ETH_ALEN];
@@ -1166,14 +1147,11 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
if (!mac_addr)
return;
 
-   if (rtw_initmac) {  /*  Users specify the mac address */
-   int jj, kk;
-
-   for (jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3) {
-   mac[jj] = key_2char2num(rtw_initmac[kk], rtw_initmac[kk 
+ 1]);
-   }
+   if (rtw_initmac && mac_pton(rtw_initmac, mac)) {
+   /* Users specify the mac address */
ether_addr_copy(mac_addr, mac);
-   } else{ /*  Use the mac address stored in the Efuse */
+   } else{
+   /* Use the mac address stored in the Efuse */
ether_addr_copy(mac, mac_addr);
}
 
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c 
b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index 39502156f652..4eb51f45b387 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -32,9 +32,6 @@
 #define WEXT_CSCAN_HOME_DWELL_SECTION  'H'
 #define WEXT_CSCAN_TYPE_SECTION'T'
 
-
-extern u8 key_2char2num(u8 hch, u8 lch);
-
 static u32 rtw_rates[] = {100, 200, 550, 1100,
600, 900, 1200, 1800, 2400, 3600, 4800, 
5400};
 
-- 
2.18.0



[PATCH v2] staging: rtl8723bs: remove rtw_set_tx_chksum_offload()

2018-06-25 Thread Michael Straube
The function rtw_set_tx_chksum_offload() has empty definition.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_xmit.c  | 2 --
 drivers/staging/rtl8723bs/include/xmit_osdep.h | 2 --
 drivers/staging/rtl8723bs/os_dep/xmit_linux.c  | 5 -
 3 files changed, 9 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c 
b/drivers/staging/rtl8723bs/core/rtw_xmit.c
index aaabffb0a199..3e7c1f07b8b4 100644
--- a/drivers/staging/rtl8723bs/core/rtw_xmit.c
+++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c
@@ -845,8 +845,6 @@ static s32 update_attrib(struct adapter *padapter, _pkt 
*pkt, struct pkt_attrib
 
/* pattrib->priority = 5; force to used VI queue, for testing */
 
-   rtw_set_tx_chksum_offload(pkt, pattrib);
-
 exit:
return res;
 }
diff --git a/drivers/staging/rtl8723bs/include/xmit_osdep.h 
b/drivers/staging/rtl8723bs/include/xmit_osdep.h
index 377b453de199..a61412b54ec0 100644
--- a/drivers/staging/rtl8723bs/include/xmit_osdep.h
+++ b/drivers/staging/rtl8723bs/include/xmit_osdep.h
@@ -33,8 +33,6 @@ void rtw_os_xmit_schedule(struct adapter *padapter);
 int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf 
*pxmitbuf, u32 alloc_sz, u8 flag);
 void rtw_os_xmit_resource_free(struct adapter *padapter, struct xmit_buf 
*pxmitbuf, u32 free_sz, u8 flag);
 
-extern void rtw_set_tx_chksum_offload(_pkt *pkt, struct pkt_attrib *pattrib);
-
 extern uint rtw_remainder_len(struct pkt_file *pfile);
 extern void _rtw_open_pktfile(_pkt *pkt, struct pkt_file *pfile);
 extern uint _rtw_pktfile_read (struct pkt_file *pfile, u8 *rmem, uint rlen);
diff --git a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c 
b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
index 4da0c6f323d1..2cf903c66854 100644
--- a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
@@ -46,11 +46,6 @@ sint rtw_endofpktfile(struct pkt_file *pfile)
return false;
 }
 
-void rtw_set_tx_chksum_offload(_pkt *pkt, struct pkt_attrib *pattrib)
-{
-
-}
-
 int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf 
*pxmitbuf, u32 alloc_sz, u8 flag)
 {
if (alloc_sz > 0) {
-- 
2.18.0



[PATCH v2] staging: rtl8723bs: remove rtw_set_tx_chksum_offload()

2018-06-25 Thread Michael Straube
The function rtw_set_tx_chksum_offload() has empty definition.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_xmit.c  | 2 --
 drivers/staging/rtl8723bs/include/xmit_osdep.h | 2 --
 drivers/staging/rtl8723bs/os_dep/xmit_linux.c  | 5 -
 3 files changed, 9 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c 
b/drivers/staging/rtl8723bs/core/rtw_xmit.c
index aaabffb0a199..3e7c1f07b8b4 100644
--- a/drivers/staging/rtl8723bs/core/rtw_xmit.c
+++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c
@@ -845,8 +845,6 @@ static s32 update_attrib(struct adapter *padapter, _pkt 
*pkt, struct pkt_attrib
 
/* pattrib->priority = 5; force to used VI queue, for testing */
 
-   rtw_set_tx_chksum_offload(pkt, pattrib);
-
 exit:
return res;
 }
diff --git a/drivers/staging/rtl8723bs/include/xmit_osdep.h 
b/drivers/staging/rtl8723bs/include/xmit_osdep.h
index 377b453de199..a61412b54ec0 100644
--- a/drivers/staging/rtl8723bs/include/xmit_osdep.h
+++ b/drivers/staging/rtl8723bs/include/xmit_osdep.h
@@ -33,8 +33,6 @@ void rtw_os_xmit_schedule(struct adapter *padapter);
 int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf 
*pxmitbuf, u32 alloc_sz, u8 flag);
 void rtw_os_xmit_resource_free(struct adapter *padapter, struct xmit_buf 
*pxmitbuf, u32 free_sz, u8 flag);
 
-extern void rtw_set_tx_chksum_offload(_pkt *pkt, struct pkt_attrib *pattrib);
-
 extern uint rtw_remainder_len(struct pkt_file *pfile);
 extern void _rtw_open_pktfile(_pkt *pkt, struct pkt_file *pfile);
 extern uint _rtw_pktfile_read (struct pkt_file *pfile, u8 *rmem, uint rlen);
diff --git a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c 
b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
index 4da0c6f323d1..2cf903c66854 100644
--- a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
@@ -46,11 +46,6 @@ sint rtw_endofpktfile(struct pkt_file *pfile)
return false;
 }
 
-void rtw_set_tx_chksum_offload(_pkt *pkt, struct pkt_attrib *pattrib)
-{
-
-}
-
 int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf 
*pxmitbuf, u32 alloc_sz, u8 flag)
 {
if (alloc_sz > 0) {
-- 
2.18.0



[PATCH] staging: rtl8723bs: refactor rtw_macaddr_cfg()

2018-06-23 Thread Michael Straube
Using is_broadcast_ether_addr() and is_zero_ether_addr() instead of
testing each byte of the mac[] array for 0xff and 0x00 shortens the
code and improves readability.

If np == NULL, of_get_property() returns NULL, hence the "np" check
is not needed.

Instead of a fixed default mac address use a random one to reduce the
likelihood of mac address collision.

Thanks to Joe Perches and Dan Carpenter.

Signed-off-by: Michael Straube 
---
 .../staging/rtl8723bs/core/rtw_ieee80211.c| 19 ---
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index 0822e440204e..584695df0a48 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -1177,24 +1177,13 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
memcpy(mac, mac_addr, ETH_ALEN);
}
 
-   if (((mac[0] == 0xff) && (mac[1] == 0xff) && (mac[2] == 0xff) &&
-(mac[3] == 0xff) && (mac[4] == 0xff) && (mac[5] == 0xff)) ||
-   ((mac[0] == 0x00) && (mac[1] == 0x00) && (mac[2] == 0x00) &&
-(mac[3] == 0x00) && (mac[4] == 0x00) && (mac[5] == 0x00))) {
-   if (np &&
-   (addr = of_get_property(np, "local-mac-address", )) &&
+   if (is_broadcast_ether_addr(mac) || is_zero_ether_addr(mac)) {
+   if ((addr = of_get_property(np, "local-mac-address", )) &&
len == ETH_ALEN) {
memcpy(mac_addr, addr, ETH_ALEN);
} else {
-   mac[0] = 0x00;
-   mac[1] = 0xe0;
-   mac[2] = 0x4c;
-   mac[3] = 0x87;
-   mac[4] = 0x00;
-   mac[5] = 0x00;
-   /*  use default mac addresss */
-   memcpy(mac_addr, mac, ETH_ALEN);
-   DBG_871X("MAC Address from efuse error, assign default 
one !!!\n");
+   eth_random_addr(mac_addr);
+   DBG_871X("MAC Address from efuse error, assign random 
one !!!\n");
}
}
 
-- 
2.18.0



[PATCH] staging: rtl8723bs: refactor rtw_macaddr_cfg()

2018-06-23 Thread Michael Straube
Using is_broadcast_ether_addr() and is_zero_ether_addr() instead of
testing each byte of the mac[] array for 0xff and 0x00 shortens the
code and improves readability.

If np == NULL, of_get_property() returns NULL, hence the "np" check
is not needed.

Instead of a fixed default mac address use a random one to reduce the
likelihood of mac address collision.

Thanks to Joe Perches and Dan Carpenter.

Signed-off-by: Michael Straube 
---
 .../staging/rtl8723bs/core/rtw_ieee80211.c| 19 ---
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index 0822e440204e..584695df0a48 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -1177,24 +1177,13 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
memcpy(mac, mac_addr, ETH_ALEN);
}
 
-   if (((mac[0] == 0xff) && (mac[1] == 0xff) && (mac[2] == 0xff) &&
-(mac[3] == 0xff) && (mac[4] == 0xff) && (mac[5] == 0xff)) ||
-   ((mac[0] == 0x00) && (mac[1] == 0x00) && (mac[2] == 0x00) &&
-(mac[3] == 0x00) && (mac[4] == 0x00) && (mac[5] == 0x00))) {
-   if (np &&
-   (addr = of_get_property(np, "local-mac-address", )) &&
+   if (is_broadcast_ether_addr(mac) || is_zero_ether_addr(mac)) {
+   if ((addr = of_get_property(np, "local-mac-address", )) &&
len == ETH_ALEN) {
memcpy(mac_addr, addr, ETH_ALEN);
} else {
-   mac[0] = 0x00;
-   mac[1] = 0xe0;
-   mac[2] = 0x4c;
-   mac[3] = 0x87;
-   mac[4] = 0x00;
-   mac[5] = 0x00;
-   /*  use default mac addresss */
-   memcpy(mac_addr, mac, ETH_ALEN);
-   DBG_871X("MAC Address from efuse error, assign default 
one !!!\n");
+   eth_random_addr(mac_addr);
+   DBG_871X("MAC Address from efuse error, assign random 
one !!!\n");
}
}
 
-- 
2.18.0



Re: [PATCH] staging: rtl8723bs: do not use assignment in if condition

2018-06-22 Thread Michael Straube

On 06/22/18 19:28, Joe Perches wrote:

On Fri, 2018-06-22 at 14:48 +0200, Michael Straube wrote:

On 06/22/18 12:57, Dan Carpenter wrote:

On Fri, Jun 22, 2018 at 03:54:22AM -0700, Joe Perches wrote:

On Fri, 2018-06-22 at 13:40 +0300, Dan Carpenter wrote:

On Thu, Jun 21, 2018 at 08:22:30PM +0200, Michael Straube wrote:

Fix checkpatch error 'do not use assignment in if condition'.

[]

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index e55895632921..87a4ced41028 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/
@@ -1181,9 +1181,8 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
 (mac[3] == 0xff) && (mac[4] == 0xff) && (mac[5] == 0xff)) ||
((mac[0] == 0x00) && (mac[1] == 0x00) && (mac[2] == 0x00) &&
 (mac[3] == 0x00) && (mac[4] == 0x00) && (mac[5] == 0x00))) {


Should also use is_broadcast_ether_addr and is_zero_ether_addr


-   if (np &&
-   (addr = of_get_property(np, "local-mac-address", )) &&
-   len == ETH_ALEN) {
+   addr = of_get_property(np, "local-mac-address", );
+   if (np && addr && len == ETH_ALEN) {


You can remove the "np" check.

if (addr && len == ETH_ALEN) {


It looks more like the rewrite is incorrect
as np is tested before of_get_property



That's what I was worried about too, but if "np" is NULL then
of_get_property() just returns NULL so it's fine.


So it should be this?

  if (((mac[0] == 0xff) && (mac[1] == 0xff) && (mac[2] == 0xff) &&
   (mac[3] == 0xff) && (mac[4] == 0xff) && (mac[5] == 0xff)) ||
  ((mac[0] == 0x00) && (mac[1] == 0x00) && (mac[2] == 0x00) &&
   (mac[3] == 0x00) && (mac[4] == 0x00) && (mac[5] == 0x00)) &&
  (is_broadcast_ether_addr(mac) || is_zero_ether_addr(mac))) {


No as the mac[] tests are the same as is__ether_addr


Ok, I understand now.


and there's nothing really objectionable about embedding
the assignment in the if here.

Output from checkpatch is not gospel and can be ignored
whenever appropriate.


Ok, good to know.


memcpy(mac_addr, ""\x00\xe0\x4c\x87\x00\x00", ETH_ALEN);

Although the last memcpy of a fixed mac address could
probably use eth_random_addr to reduce the likelihood
of mac address collision so maybe

eth_random_addr(mac_addr);
 
Using a random address would be preffered?



Thanks for your help and patience.
Michael


Re: [PATCH] staging: rtl8723bs: do not use assignment in if condition

2018-06-22 Thread Michael Straube

On 06/22/18 19:28, Joe Perches wrote:

On Fri, 2018-06-22 at 14:48 +0200, Michael Straube wrote:

On 06/22/18 12:57, Dan Carpenter wrote:

On Fri, Jun 22, 2018 at 03:54:22AM -0700, Joe Perches wrote:

On Fri, 2018-06-22 at 13:40 +0300, Dan Carpenter wrote:

On Thu, Jun 21, 2018 at 08:22:30PM +0200, Michael Straube wrote:

Fix checkpatch error 'do not use assignment in if condition'.

[]

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index e55895632921..87a4ced41028 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/
@@ -1181,9 +1181,8 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
 (mac[3] == 0xff) && (mac[4] == 0xff) && (mac[5] == 0xff)) ||
((mac[0] == 0x00) && (mac[1] == 0x00) && (mac[2] == 0x00) &&
 (mac[3] == 0x00) && (mac[4] == 0x00) && (mac[5] == 0x00))) {


Should also use is_broadcast_ether_addr and is_zero_ether_addr


-   if (np &&
-   (addr = of_get_property(np, "local-mac-address", )) &&
-   len == ETH_ALEN) {
+   addr = of_get_property(np, "local-mac-address", );
+   if (np && addr && len == ETH_ALEN) {


You can remove the "np" check.

if (addr && len == ETH_ALEN) {


It looks more like the rewrite is incorrect
as np is tested before of_get_property



That's what I was worried about too, but if "np" is NULL then
of_get_property() just returns NULL so it's fine.


So it should be this?

  if (((mac[0] == 0xff) && (mac[1] == 0xff) && (mac[2] == 0xff) &&
   (mac[3] == 0xff) && (mac[4] == 0xff) && (mac[5] == 0xff)) ||
  ((mac[0] == 0x00) && (mac[1] == 0x00) && (mac[2] == 0x00) &&
   (mac[3] == 0x00) && (mac[4] == 0x00) && (mac[5] == 0x00)) &&
  (is_broadcast_ether_addr(mac) || is_zero_ether_addr(mac))) {


No as the mac[] tests are the same as is__ether_addr


Ok, I understand now.


and there's nothing really objectionable about embedding
the assignment in the if here.

Output from checkpatch is not gospel and can be ignored
whenever appropriate.


Ok, good to know.


memcpy(mac_addr, ""\x00\xe0\x4c\x87\x00\x00", ETH_ALEN);

Although the last memcpy of a fixed mac address could
probably use eth_random_addr to reduce the likelihood
of mac address collision so maybe

eth_random_addr(mac_addr);
 
Using a random address would be preffered?



Thanks for your help and patience.
Michael


Re: [PATCH] staging: rtl8723bs: fix brace coding style issues

2018-06-22 Thread Michael Straube

On 06/22/18 12:28, Dan Carpenter wrote:

if (count < 1)
return -EFAULT;
  
-	if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) {

+   if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp)))
sscanf(tmp, "%u", _wait_hiq_empty);
-   }



The original code is kind of bad.  The NULL check isn't required.


Just for clarification, NULL check refers to checking if buffer != NULL in the
if condition?

   if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp)))
   ~~


The sscanf call should have error checking.  The error code is wrong if
the copy from user fails.  The tmp buffer isn't NUL terminated.

if (copy_from_user(tmp, buffer, sizeof(tmp)))
return -EFAULT;
tmp[sizeof(tmp) - 1] = '\0';

if (sscanf(tmp, "%u", _wait_hiq_empty) != 1)
return -EINVAL;

return count;

regards,
dan carpenter



Regards,
Michael


Re: [PATCH] staging: rtl8723bs: fix brace coding style issues

2018-06-22 Thread Michael Straube

On 06/22/18 12:28, Dan Carpenter wrote:

if (count < 1)
return -EFAULT;
  
-	if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) {

+   if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp)))
sscanf(tmp, "%u", _wait_hiq_empty);
-   }



The original code is kind of bad.  The NULL check isn't required.


Just for clarification, NULL check refers to checking if buffer != NULL in the
if condition?

   if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp)))
   ~~


The sscanf call should have error checking.  The error code is wrong if
the copy from user fails.  The tmp buffer isn't NUL terminated.

if (copy_from_user(tmp, buffer, sizeof(tmp)))
return -EFAULT;
tmp[sizeof(tmp) - 1] = '\0';

if (sscanf(tmp, "%u", _wait_hiq_empty) != 1)
return -EINVAL;

return count;

regards,
dan carpenter



Regards,
Michael


Re: [PATCH] staging: rtl8723bs: do not use assignment in if condition

2018-06-22 Thread Michael Straube

On 06/22/18 12:57, Dan Carpenter wrote:

On Fri, Jun 22, 2018 at 03:54:22AM -0700, Joe Perches wrote:

On Fri, 2018-06-22 at 13:40 +0300, Dan Carpenter wrote:

On Thu, Jun 21, 2018 at 08:22:30PM +0200, Michael Straube wrote:

Fix checkpatch error 'do not use assignment in if condition'.

[]

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index e55895632921..87a4ced41028 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/
@@ -1181,9 +1181,8 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
 (mac[3] == 0xff) && (mac[4] == 0xff) && (mac[5] == 0xff)) ||
((mac[0] == 0x00) && (mac[1] == 0x00) && (mac[2] == 0x00) &&
 (mac[3] == 0x00) && (mac[4] == 0x00) && (mac[5] == 0x00))) {


Should also use is_broadcast_ether_addr and is_zero_ether_addr


-   if (np &&
-   (addr = of_get_property(np, "local-mac-address", )) &&
-   len == ETH_ALEN) {
+   addr = of_get_property(np, "local-mac-address", );
+   if (np && addr && len == ETH_ALEN) {


You can remove the "np" check.

if (addr && len == ETH_ALEN) {


It looks more like the rewrite is incorrect
as np is tested before of_get_property



That's what I was worried about too, but if "np" is NULL then
of_get_property() just returns NULL so it's fine.


So it should be this?

if (((mac[0] == 0xff) && (mac[1] == 0xff) && (mac[2] == 0xff) &&
 (mac[3] == 0xff) && (mac[4] == 0xff) && (mac[5] == 0xff)) ||
((mac[0] == 0x00) && (mac[1] == 0x00) && (mac[2] == 0x00) &&
 (mac[3] == 0x00) && (mac[4] == 0x00) && (mac[5] == 0x00)) &&
(is_broadcast_ether_addr(mac) || is_zero_ether_addr(mac))) {
addr = of_get_property(np, "local-mac-address", );
if (addr && len == ETH_ALEN) {
memcpy(mac_addr, addr, ETH_ALEN);
} else {
mac[0] = 0x00;
...
}
}

If yes, I'm not sure how to proceed as these are the very first patches I send.
Should I send a v2 patch with both changes or just a v2 with "np" removed and
another one for adding 'is_broadcast_ether_addr' and 'is_zero_ether_addr' 
checks?

Regards,
Michael



Re: [PATCH] staging: rtl8723bs: do not use assignment in if condition

2018-06-22 Thread Michael Straube

On 06/22/18 12:57, Dan Carpenter wrote:

On Fri, Jun 22, 2018 at 03:54:22AM -0700, Joe Perches wrote:

On Fri, 2018-06-22 at 13:40 +0300, Dan Carpenter wrote:

On Thu, Jun 21, 2018 at 08:22:30PM +0200, Michael Straube wrote:

Fix checkpatch error 'do not use assignment in if condition'.

[]

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index e55895632921..87a4ced41028 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/
@@ -1181,9 +1181,8 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
 (mac[3] == 0xff) && (mac[4] == 0xff) && (mac[5] == 0xff)) ||
((mac[0] == 0x00) && (mac[1] == 0x00) && (mac[2] == 0x00) &&
 (mac[3] == 0x00) && (mac[4] == 0x00) && (mac[5] == 0x00))) {


Should also use is_broadcast_ether_addr and is_zero_ether_addr


-   if (np &&
-   (addr = of_get_property(np, "local-mac-address", )) &&
-   len == ETH_ALEN) {
+   addr = of_get_property(np, "local-mac-address", );
+   if (np && addr && len == ETH_ALEN) {


You can remove the "np" check.

if (addr && len == ETH_ALEN) {


It looks more like the rewrite is incorrect
as np is tested before of_get_property



That's what I was worried about too, but if "np" is NULL then
of_get_property() just returns NULL so it's fine.


So it should be this?

if (((mac[0] == 0xff) && (mac[1] == 0xff) && (mac[2] == 0xff) &&
 (mac[3] == 0xff) && (mac[4] == 0xff) && (mac[5] == 0xff)) ||
((mac[0] == 0x00) && (mac[1] == 0x00) && (mac[2] == 0x00) &&
 (mac[3] == 0x00) && (mac[4] == 0x00) && (mac[5] == 0x00)) &&
(is_broadcast_ether_addr(mac) || is_zero_ether_addr(mac))) {
addr = of_get_property(np, "local-mac-address", );
if (addr && len == ETH_ALEN) {
memcpy(mac_addr, addr, ETH_ALEN);
} else {
mac[0] = 0x00;
...
}
}

If yes, I'm not sure how to proceed as these are the very first patches I send.
Should I send a v2 patch with both changes or just a v2 with "np" removed and
another one for adding 'is_broadcast_ether_addr' and 'is_zero_ether_addr' 
checks?

Regards,
Michael



[PATCH] staging: rtl8723bs: remove rtw_set_tx_chksum_offload()

2018-06-21 Thread Michael Straube
The function rtw_set_tx_chksum_offload() has empty definition.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_xmit.c  | 2 --
 drivers/staging/rtl8723bs/include/xmit_osdep.h | 2 --
 drivers/staging/rtl8723bs/os_dep/xmit_linux.c  | 5 -
 3 files changed, 9 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c 
b/drivers/staging/rtl8723bs/core/rtw_xmit.c
index aaabffb0a199..3e7c1f07b8b4 100644
--- a/drivers/staging/rtl8723bs/core/rtw_xmit.c
+++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c
@@ -845,8 +845,6 @@ static s32 update_attrib(struct adapter *padapter, _pkt 
*pkt, struct pkt_attrib
 
/* pattrib->priority = 5; force to used VI queue, for testing */
 
-   rtw_set_tx_chksum_offload(pkt, pattrib);
-
 exit:
return res;
 }
diff --git a/drivers/staging/rtl8723bs/include/xmit_osdep.h 
b/drivers/staging/rtl8723bs/include/xmit_osdep.h
index 377b453de199..a61412b54ec0 100644
--- a/drivers/staging/rtl8723bs/include/xmit_osdep.h
+++ b/drivers/staging/rtl8723bs/include/xmit_osdep.h
@@ -33,8 +33,6 @@ void rtw_os_xmit_schedule(struct adapter *padapter);
 int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf 
*pxmitbuf, u32 alloc_sz, u8 flag);
 void rtw_os_xmit_resource_free(struct adapter *padapter, struct xmit_buf 
*pxmitbuf, u32 free_sz, u8 flag);
 
-extern void rtw_set_tx_chksum_offload(_pkt *pkt, struct pkt_attrib *pattrib);
-
 extern uint rtw_remainder_len(struct pkt_file *pfile);
 extern void _rtw_open_pktfile(_pkt *pkt, struct pkt_file *pfile);
 extern uint _rtw_pktfile_read (struct pkt_file *pfile, u8 *rmem, uint rlen);
diff --git a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c 
b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
index 4da0c6f323d1..2cf903c66854 100644
--- a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
@@ -46,11 +46,6 @@ sint rtw_endofpktfile(struct pkt_file *pfile)
return false;
 }
 
-void rtw_set_tx_chksum_offload(_pkt *pkt, struct pkt_attrib *pattrib)
-{
-
-}
-
 int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf 
*pxmitbuf, u32 alloc_sz, u8 flag)
 {
if (alloc_sz > 0) {
-- 
2.17.1



[PATCH] staging: rtl8723bs: remove rtw_set_tx_chksum_offload()

2018-06-21 Thread Michael Straube
The function rtw_set_tx_chksum_offload() has empty definition.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_xmit.c  | 2 --
 drivers/staging/rtl8723bs/include/xmit_osdep.h | 2 --
 drivers/staging/rtl8723bs/os_dep/xmit_linux.c  | 5 -
 3 files changed, 9 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c 
b/drivers/staging/rtl8723bs/core/rtw_xmit.c
index aaabffb0a199..3e7c1f07b8b4 100644
--- a/drivers/staging/rtl8723bs/core/rtw_xmit.c
+++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c
@@ -845,8 +845,6 @@ static s32 update_attrib(struct adapter *padapter, _pkt 
*pkt, struct pkt_attrib
 
/* pattrib->priority = 5; force to used VI queue, for testing */
 
-   rtw_set_tx_chksum_offload(pkt, pattrib);
-
 exit:
return res;
 }
diff --git a/drivers/staging/rtl8723bs/include/xmit_osdep.h 
b/drivers/staging/rtl8723bs/include/xmit_osdep.h
index 377b453de199..a61412b54ec0 100644
--- a/drivers/staging/rtl8723bs/include/xmit_osdep.h
+++ b/drivers/staging/rtl8723bs/include/xmit_osdep.h
@@ -33,8 +33,6 @@ void rtw_os_xmit_schedule(struct adapter *padapter);
 int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf 
*pxmitbuf, u32 alloc_sz, u8 flag);
 void rtw_os_xmit_resource_free(struct adapter *padapter, struct xmit_buf 
*pxmitbuf, u32 free_sz, u8 flag);
 
-extern void rtw_set_tx_chksum_offload(_pkt *pkt, struct pkt_attrib *pattrib);
-
 extern uint rtw_remainder_len(struct pkt_file *pfile);
 extern void _rtw_open_pktfile(_pkt *pkt, struct pkt_file *pfile);
 extern uint _rtw_pktfile_read (struct pkt_file *pfile, u8 *rmem, uint rlen);
diff --git a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c 
b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
index 4da0c6f323d1..2cf903c66854 100644
--- a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
@@ -46,11 +46,6 @@ sint rtw_endofpktfile(struct pkt_file *pfile)
return false;
 }
 
-void rtw_set_tx_chksum_offload(_pkt *pkt, struct pkt_attrib *pattrib)
-{
-
-}
-
 int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf 
*pxmitbuf, u32 alloc_sz, u8 flag)
 {
if (alloc_sz > 0) {
-- 
2.17.1



[PATCH] staging: rtl8723bs: do not use assignment in if condition

2018-06-21 Thread Michael Straube
Fix checkpatch error 'do not use assignment in if condition'.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index e55895632921..87a4ced41028 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -1181,9 +1181,8 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
 (mac[3] == 0xff) && (mac[4] == 0xff) && (mac[5] == 0xff)) ||
((mac[0] == 0x00) && (mac[1] == 0x00) && (mac[2] == 0x00) &&
 (mac[3] == 0x00) && (mac[4] == 0x00) && (mac[5] == 0x00))) {
-   if (np &&
-   (addr = of_get_property(np, "local-mac-address", )) &&
-   len == ETH_ALEN) {
+   addr = of_get_property(np, "local-mac-address", );
+   if (np && addr && len == ETH_ALEN) {
memcpy(mac_addr, addr, ETH_ALEN);
} else {
mac[0] = 0x00;
-- 
2.17.1



[PATCH] staging: rtl8723bs: do not use assignment in if condition

2018-06-21 Thread Michael Straube
Fix checkpatch error 'do not use assignment in if condition'.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index e55895632921..87a4ced41028 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -1181,9 +1181,8 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
 (mac[3] == 0xff) && (mac[4] == 0xff) && (mac[5] == 0xff)) ||
((mac[0] == 0x00) && (mac[1] == 0x00) && (mac[2] == 0x00) &&
 (mac[3] == 0x00) && (mac[4] == 0x00) && (mac[5] == 0x00))) {
-   if (np &&
-   (addr = of_get_property(np, "local-mac-address", )) &&
-   len == ETH_ALEN) {
+   addr = of_get_property(np, "local-mac-address", );
+   if (np && addr && len == ETH_ALEN) {
memcpy(mac_addr, addr, ETH_ALEN);
} else {
mac[0] = 0x00;
-- 
2.17.1



[PATCH] staging: rtl8723bs: fix brace coding style issues

2018-06-21 Thread Michael Straube
Remove braces from single line if statements.
Also fix a comparsion to NULL in one of the conditions.
Issues found by checkpatch.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_debug.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_debug.c 
b/drivers/staging/rtl8723bs/core/rtw_debug.c
index f852fde47350..2244ed72ab9c 100644
--- a/drivers/staging/rtl8723bs/core/rtw_debug.c
+++ b/drivers/staging/rtl8723bs/core/rtw_debug.c
@@ -618,9 +618,8 @@ ssize_t proc_set_wait_hiq_empty(struct file *file, const 
char __user *buffer, si
if (count < 1)
return -EFAULT;
 
-   if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) {
+   if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp)))
sscanf(tmp, "%u", _wait_hiq_empty);
-   }
 
return count;
 }
@@ -1425,9 +1424,8 @@ int proc_get_btcoex_info(struct seq_file *m, void *v)
padapter = (struct adapter *)rtw_netdev_priv(dev);
 
pbuf = rtw_zmalloc(bufsize);
-   if (NULL == pbuf) {
+   if (!pbuf)
return -ENOMEM;
-   }
 
rtw_btcoex_DisplayBtCoexInfo(padapter, pbuf, bufsize);
 
-- 
2.17.1



[PATCH] staging: rtl8723bs: fix brace coding style issues

2018-06-21 Thread Michael Straube
Remove braces from single line if statements.
Also fix a comparsion to NULL in one of the conditions.
Issues found by checkpatch.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_debug.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_debug.c 
b/drivers/staging/rtl8723bs/core/rtw_debug.c
index f852fde47350..2244ed72ab9c 100644
--- a/drivers/staging/rtl8723bs/core/rtw_debug.c
+++ b/drivers/staging/rtl8723bs/core/rtw_debug.c
@@ -618,9 +618,8 @@ ssize_t proc_set_wait_hiq_empty(struct file *file, const 
char __user *buffer, si
if (count < 1)
return -EFAULT;
 
-   if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) {
+   if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp)))
sscanf(tmp, "%u", _wait_hiq_empty);
-   }
 
return count;
 }
@@ -1425,9 +1424,8 @@ int proc_get_btcoex_info(struct seq_file *m, void *v)
padapter = (struct adapter *)rtw_netdev_priv(dev);
 
pbuf = rtw_zmalloc(bufsize);
-   if (NULL == pbuf) {
+   if (!pbuf)
return -ENOMEM;
-   }
 
rtw_btcoex_DisplayBtCoexInfo(padapter, pbuf, bufsize);
 
-- 
2.17.1



[PATCH] staging: rtl8723bs: fix comparsion to NULL - coding style

2018-06-21 Thread Michael Straube
Fix comparsion to NULL issues found by checkpatch.
Use !x instead of x == NULL.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index 0822e440204e..e55895632921 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -747,7 +747,7 @@ u8 rtw_is_wps_ie(u8 *ie_ptr, uint *wps_ielen)
u8 match = false;
u8 eid, wps_oui[4] = {0x0, 0x50, 0xf2, 0x04};
 
-   if (ie_ptr == NULL)
+   if (!ie_ptr)
return match;
 
eid = ie_ptr[0];
@@ -1163,7 +1163,7 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
const unsigned char *addr;
int len;
 
-   if (mac_addr == NULL)
+   if (!mac_addr)
return;
 
if (rtw_initmac) {  /*  Users specify the mac address */
-- 
2.17.1



[PATCH] staging: rtl8723bs: fix comparsion to NULL - coding style

2018-06-21 Thread Michael Straube
Fix comparsion to NULL issues found by checkpatch.
Use !x instead of x == NULL.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index 0822e440204e..e55895632921 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -747,7 +747,7 @@ u8 rtw_is_wps_ie(u8 *ie_ptr, uint *wps_ielen)
u8 match = false;
u8 eid, wps_oui[4] = {0x0, 0x50, 0xf2, 0x04};
 
-   if (ie_ptr == NULL)
+   if (!ie_ptr)
return match;
 
eid = ie_ptr[0];
@@ -1163,7 +1163,7 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
const unsigned char *addr;
int len;
 
-   if (mac_addr == NULL)
+   if (!mac_addr)
return;
 
if (rtw_initmac) {  /*  Users specify the mac address */
-- 
2.17.1



<    4   5   6   7   8   9