staging: r8188eu: code cleanup and coding-style fix patches
cover staging: r8188eu: code cleanup and coding-style fix patches
This series of patches fixes the coding-style issues reported by checkpatch.pl for the staging/r8188eu driver.
Abhirup Deb (5):
staging: r8188eu: add blank line after declaration
staging: r8188eu: refactor block-comments
staging: r8188eu: remove redundant else after return
staging: r8188eu: Replace "<<" with BIT macro
staging: r8188eu: place constants on right side of comparison
drivers/staging/r8188eu/core/rtw_mlme_ext.c | 61 +++++++------- drivers/staging/r8188eu/hal/rtl8188e_cmd.c | 2 +- drivers/staging/r8188eu/hal/rtl8188e_dm.c | 2 +- .../staging/r8188eu/hal/rtl8188e_hal_init.c | 10 +-- drivers/staging/r8188eu/hal/rtl8188eu_xmit.c | 2 +- drivers/staging/r8188eu/hal/usb_halinit.c | 23 ++++-- drivers/staging/r8188eu/include/ieee80211.h | 82 +++++++++---------- drivers/staging/r8188eu/include/rtw_mlme.h | 4 +- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 6 +- 9 files changed, 98 insertions(+), 94 deletions(-)
Signature · 1 line
2.31.1
PATCH 1/5 staging: r8188eu: add blank line after declaration
Add a blank line after variable declaration to improve code-readability and resolve checkpatch warnings.
checkpatch warning produced:
WARNING: Missing a blank line after declarations
--- drivers/staging/r8188eu/hal/usb_halinit.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/staging/r8188eu/hal/usb_halinit.c +2 -0
@@ -93,6 +93,7 @@ u32 rtl8188eu_InitPowerOn(struct adapter *adapt)/* HW Power on sequence */ struct hal_data_8188e *haldata = &adapt->haldata; +if (haldata->bMacPwrCtrlOn)return _SUCCESS;
@@ -295,6 +296,7 @@ static void _InitTransferPageSize(struct adapter *Adapter)/* Tx page size is always 128. */ u8 value8; + value8 =_PSRX (PBP_128 ) |_PSTX (PBP_128 );rtw_write8 (Adapter,REG_PBP , value8); }
Signature · 1 line
2.31.1
PATCH 2/5 staging: r8188eu: refactor block-comments
In reply to Abhirup DebFix block comments by moving "/*" & "*/" symbols on separate lines in adherence to the linux kernel coding-style.
checkpatch warning produced:
WARNING: Block comments use a trailing */ on a separate line
--- drivers/staging/r8188eu/hal/usb_halinit.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/staging/r8188eu/hal/usb_halinit.c +8 -6
@@ -381,8 +381,8 @@ static void _InitRetryFunction(struct adapter *Adapter)/* Set ACK timeout */ rtw_write8 (Adapter,REG_ACKTO ,0x40 ); } - -/*----------------------------------------------------------------------------- +/* +*----------------------------------------------------------------------------- * Function: usb_AggSettingTxUpdate() * * Overview: Separate TX/RX parameters update independent for TP detection and
@@ -396,7 +396,8 @@ static void _InitRetryFunction(struct adapter *Adapter)* When Who Remark * 12/10/2010 MHC Separate to smaller function. * -*---------------------------------------------------------------------------*/ +*--------------------------------------------------------------------------- +*/ static void usb_AggSettingTxUpdate (struct adapter *Adapter) {u32 value32;
@@ -414,8 +415,8 @@ static void usb_AggSettingTxUpdate(struct adapter *Adapter)rtw_write32 (Adapter,REG_TDECTRL , value32); } - -/*----------------------------------------------------------------------------- +/* +*----------------------------------------------------------------------------- * Function: usb_AggSettingRxUpdate() * * Overview: Separate TX/RX parameters update independent for TP detection and
@@ -429,7 +430,8 @@ static void usb_AggSettingTxUpdate(struct adapter *Adapter)* When Who Remark * 12/10/2010 MHC Separate to smaller function. * -*---------------------------------------------------------------------------*/ +*--------------------------------------------------------------------------- +*/ static void usb_AggSettingRxUpdate ( struct adapter *Adapter
Signature · 1 line
2.31.1
PATCH 3/5 staging: r8188eu: remove redundant else after return
In reply to Abhirup Debremove 'else'-clause that is not required after a
'return' statement.
checkpatch warning produced:
WARNING: else is not generally useful after a break or return
--- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 61 ++++++++++----------- drivers/staging/r8188eu/hal/usb_halinit.c | 7 ++- 2 files changed, 34 insertions(+), 34 deletions(-)
drivers/staging/r8188eu/core/rtw_mlme_ext.c +30 -31
@@ -7721,49 +7721,48 @@ u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf) {if (send_beacon (padapter) == _FAIL) {return H2C_PARAMETERS_ERROR ; - }else { -/* tx bc/mc frames after update TIM */ -struct sta_info *psta_bmc; -struct list_head *xmitframe_plist, *xmitframe_phead; -struct xmit_frame *pxmitframe =NULL ; -struct sta_priv *pstapriv = &padapter->stapriv; + } +/* tx bc/mc frames after update TIM */ +struct sta_info *psta_bmc; +struct list_head *xmitframe_plist, *xmitframe_phead; +struct xmit_frame *pxmitframe =NULL ; +struct sta_priv *pstapriv = &padapter->stapriv; -/* for BC/MC Frames */ - psta_bmc =rtw_get_bcmc_stainfo (padapter); -if (!psta_bmc) -return H2C_SUCCESS ; +/* for BC/MC Frames */ + psta_bmc =rtw_get_bcmc_stainfo (padapter); +if (!psta_bmc) +return H2C_SUCCESS ; -if ((pstapriv->tim_bitmap &BIT (0 )) && (psta_bmc->sleepq_len >0 )) { -msleep (10 );/* 10ms, ATIM(HIQ) Windows */ -spin_lock_bh (&psta_bmc->sleep_q.lock); +if ((pstapriv->tim_bitmap &BIT (0 )) && (psta_bmc->sleepq_len >0 )) { +msleep (10 );/* 10ms, ATIM(HIQ) Windows */ +spin_lock_bh (&psta_bmc->sleep_q.lock); - xmitframe_phead =get_list_head (&psta_bmc->sleep_q); - xmitframe_plist = xmitframe_phead->next; + xmitframe_phead =get_list_head (&psta_bmc->sleep_q); + xmitframe_plist = xmitframe_phead->next; -while (xmitframe_phead != xmitframe_plist) { - pxmitframe = container_of(xmitframe_plist, struct xmit_frame, list); +while (xmitframe_phead != xmitframe_plist) { + pxmitframe = container_of(xmitframe_plist, struct xmit_frame, list); - xmitframe_plist = xmitframe_plist->next; + xmitframe_plist = xmitframe_plist->next; -list_del_init (&pxmitframe->list); +list_del_init (&pxmitframe->list); - psta_bmc->sleepq_len--; -if (psta_bmc->sleepq_len >0 ) - pxmitframe->attrib.mdata =1 ; -else - pxmitframe->attrib.mdata =0 ; + psta_bmc->sleepq_len--; +if (psta_bmc->sleepq_len >0 ) + pxmitframe->attrib.mdata =1 ; +else + pxmitframe->attrib.mdata =0 ; - pxmitframe->attrib.triggered =1 ; + pxmitframe->attrib.triggered =1 ; - pxmitframe->attrib.qsel =0x11 ;/* HIQ */ + pxmitframe->attrib.qsel =0x11 ;/* HIQ */ -spin_unlock_bh (&psta_bmc->sleep_q.lock); -if (rtl8188eu_hal_xmit (padapter, pxmitframe)) -rtw_xmit_complete (padapter, pxmitframe); -spin_lock_bh (&psta_bmc->sleep_q.lock); - }spin_unlock_bh (&psta_bmc->sleep_q.lock); +if (rtl8188eu_hal_xmit (padapter, pxmitframe)) +rtw_xmit_complete (padapter, pxmitframe); +spin_lock_bh (&psta_bmc->sleep_q.lock); } +spin_unlock_bh (&psta_bmc->sleep_q.lock); }return H2C_SUCCESS ; }
drivers/staging/r8188eu/hal/usb_halinit.c +4 -3
@@ -596,10 +596,11 @@ u32 rtl8188eu_hal_init(struct adapter *Adapter) Adapter->bFWReady = false; haldata->fw_ractrl = false;return status; - }else { - Adapter->bFWReady = true; - haldata->fw_ractrl = false; } + + Adapter->bFWReady = true; + haldata->fw_ractrl = false; +/* Initialize firmware vars */ Adapter->pwrctrlpriv.bFwCurrentInPSMode = false; haldata->LastHMEBoxNum =0 ;
Signature · 1 line
2.31.1
PATCH 4/5 staging: r8188eu: Replace "<<" with BIT macro
In reply to Abhirup DebReplace the "<<" operator with BIT macro, in accordance to the checkpatch.pl script and Linux kernel coding-style guidelines.
--- drivers/staging/r8188eu/include/ieee80211.h | 82 ++++++++++----------- 1 file changed, 41 insertions(+), 41 deletions(-)
drivers/staging/r8188eu/include/ieee80211.h +41 -41
@@ -300,15 +300,15 @@ struct ieee80211_snap_hdr {#define WLAN_AUTH_CHALLENGE_LEN 128 -#define WLAN_CAPABILITY_BSS (1<<0) -#define WLAN_CAPABILITY_IBSS (1<<1) -#define WLAN_CAPABILITY_CF_POLLABLE (1<<2) -#define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3) -#define WLAN_CAPABILITY_PRIVACY (1<<4) -#define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5) -#define WLAN_CAPABILITY_PBCC (1<<6) -#define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7) -#define WLAN_CAPABILITY_SHORT_SLOT (1<<10) +#define WLAN_CAPABILITY_BSS BIT(0) +#define WLAN_CAPABILITY_IBSS BIT(1) +#define WLAN_CAPABILITY_CF_POLLABLE BIT(2) +#define WLAN_CAPABILITY_CF_POLL_REQUEST BIT(3) +#define WLAN_CAPABILITY_PRIVACY BIT(4) +#define WLAN_CAPABILITY_SHORT_PREAMBLE BIT(5) +#define WLAN_CAPABILITY_PBCC BIT(6) +#define WLAN_CAPABILITY_CHANNEL_AGILITY BIT(7) +#define WLAN_CAPABILITY_SHORT_SLOT BIT(10)/* Status codes */ #define WLAN_STATUS_SUCCESS 0
@@ -382,17 +382,17 @@ struct ieee80211_snap_hdr {#define IEEE80211_DATA_HDR3_LEN 24#define IEEE80211_DATA_HDR4_LEN 30 -#define IEEE80211_STATMASK_SIGNAL (1<<0) -#define IEEE80211_STATMASK_RSSI (1<<1) -#define IEEE80211_STATMASK_NOISE (1<<2) -#define IEEE80211_STATMASK_RATE (1<<3) +#define IEEE80211_STATMASK_SIGNAL BIT(0) +#define IEEE80211_STATMASK_RSSI BIT(1) +#define IEEE80211_STATMASK_NOISE BIT(2) +#define IEEE80211_STATMASK_RATE BIT(3)#define IEEE80211_STATMASK_WEMASK 0x7#define IEEE80211_CCK_MODULATION (1<<0)#define IEEE80211_OFDM_MODULATION (1<<1) -#define IEEE80211_24GHZ_BAND (1<<0) -#define IEEE80211_52GHZ_BAND (1<<1) +#define IEEE80211_24GHZ_BAND BIT(0) +#define IEEE80211_52GHZ_BAND BIT(1)#define IEEE80211_CCK_RATE_LEN 4#define IEEE80211_NUM_OFDM_RATESLEN 8
@@ -412,18 +412,18 @@ struct ieee80211_snap_hdr {#define IEEE80211_OFDM_RATE_54MB 0x6C#define IEEE80211_BASIC_RATE_MASK 0x80 -#define IEEE80211_CCK_RATE_1MB_MASK (1<<0) -#define IEEE80211_CCK_RATE_2MB_MASK (1<<1) -#define IEEE80211_CCK_RATE_5MB_MASK (1<<2) -#define IEEE80211_CCK_RATE_11MB_MASK (1<<3) -#define IEEE80211_OFDM_RATE_6MB_MASK (1<<4) -#define IEEE80211_OFDM_RATE_9MB_MASK (1<<5) -#define IEEE80211_OFDM_RATE_12MB_MASK (1<<6) -#define IEEE80211_OFDM_RATE_18MB_MASK (1<<7) -#define IEEE80211_OFDM_RATE_24MB_MASK (1<<8) -#define IEEE80211_OFDM_RATE_36MB_MASK (1<<9) -#define IEEE80211_OFDM_RATE_48MB_MASK (1<<10) -#define IEEE80211_OFDM_RATE_54MB_MASK (1<<11) +#define IEEE80211_CCK_RATE_1MB_MASK BIT(0) +#define IEEE80211_CCK_RATE_2MB_MASK BIT(1) +#define IEEE80211_CCK_RATE_5MB_MASK BIT(2) +#define IEEE80211_CCK_RATE_11MB_MASK BIT(3) +#define IEEE80211_OFDM_RATE_6MB_MASK BIT(4) +#define IEEE80211_OFDM_RATE_9MB_MASK BIT(5) +#define IEEE80211_OFDM_RATE_12MB_MASK BIT(6) +#define IEEE80211_OFDM_RATE_18MB_MASK BIT(7) +#define IEEE80211_OFDM_RATE_24MB_MASK BIT(8) +#define IEEE80211_OFDM_RATE_36MB_MASK BIT(9) +#define IEEE80211_OFDM_RATE_48MB_MASK BIT(10) +#define IEEE80211_OFDM_RATE_54MB_MASK BIT(11)#define IEEE80211_CCK_RATES_MASK 0x0000000F#define IEEE80211_CCK_BASIC_RATES_MASK (IEEE80211_CCK_RATE_1MB_MASK | \
@@ -458,15 +458,15 @@ struct ieee80211_snap_hdr {* 2 kB of RAM and increasing cache size will slow down frame reassembly. */ #define IEEE80211_FRAG_CACHE_LEN 4 -#define SEC_KEY_1 (1<<0) -#define SEC_KEY_2 (1<<1) -#define SEC_KEY_3 (1<<2) -#define SEC_KEY_4 (1<<3) -#define SEC_ACTIVE_KEY (1<<4) -#define SEC_AUTH_MODE (1<<5) -#define SEC_UNICAST_GROUP (1<<6) -#define SEC_LEVEL (1<<7) -#define SEC_ENABLED (1<<8) +#define SEC_KEY_1 BIT(0) +#define SEC_KEY_2 BIT(1) +#define SEC_KEY_3 BIT(2) +#define SEC_KEY_4 BIT(3) +#define SEC_ACTIVE_KEY BIT(4) +#define SEC_AUTH_MODE BIT(5) +#define SEC_UNICAST_GROUP BIT(6) +#define SEC_LEVEL BIT(7) +#define SEC_ENABLED BIT(8)#define SEC_LEVEL_0 0/* None */ #define SEC_LEVEL_1 1/* WEP 40 and 104 bit */
@@ -550,9 +550,9 @@ Total: 28-2340 bytes#define MAX_P2P_IE_LEN (256)#define MAX_WFD_IE_LEN (128) -#define NETWORK_EMPTY_ESSID (1<<0) -#define NETWORK_HAS_OFDM (1<<1) -#define NETWORK_HAS_CCK (1<<2) +#define NETWORK_EMPTY_ESSID BIT(0) +#define NETWORK_HAS_OFDM BIT(1) +#define NETWORK_HAS_CCK BIT(2)#define IEEE80211_DTIM_MBCAST 4#define IEEE80211_DTIM_UCAST 2
@@ -584,8 +584,8 @@ static inline int is_broadcast_mac_addr(const u8 *addr) (addr[3 ] ==0xff ) && (addr[4 ] ==0xff ) && (addr[5 ] ==0xff ); } -#define CFG_IEEE80211_RESERVE_FCS (1<<0) -#define CFG_IEEE80211_COMPUTE_FCS (1<<1) +#define CFG_IEEE80211_RESERVE_FCS BIT(0) +#define CFG_IEEE80211_COMPUTE_FCS BIT(1)#define MAXTID 16
Signature · 1 line
2.31.1
PATCH 5/5 staging: r8188eu: place constants on right side of comparison
In reply to Abhirup DebFix comparison statements to place constants on the right hand side of the equation to improve code-readability and adhering to the linux kernel coding-style.
checkpatch warning produced:
WARNING: Comparisons should place the constant on the right side of the test
--- drivers/staging/r8188eu/hal/rtl8188e_cmd.c | 2 +- drivers/staging/r8188eu/hal/rtl8188e_dm.c | 2 +- drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 10 +++++----- drivers/staging/r8188eu/hal/rtl8188eu_xmit.c | 2 +- drivers/staging/r8188eu/include/rtw_mlme.h | 4 ++-- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 6 +++--- 6 files changed, 13 insertions(+), 13 deletions(-)
drivers/staging/r8188eu/hal/rtl8188e_cmd.c +1 -1
@@ -28,7 +28,7 @@ static u8 _is_fw_read_cmd_down(struct adapter *adapt, u8 msgbox_num)continue ; valid = reg &BIT (msgbox_num); -if (0 == valid) +if (valid ==0 ) read_down = true; }while ((!read_down) && (retry_cnts--));
drivers/staging/r8188eu/hal/rtl8188e_dm.c +1 -1
@@ -108,7 +108,7 @@ void AntDivCompare8188E(struct adapter *Adapter, struct wlan_bssid_ex *dst, stru {struct hal_data_8188e *hal_data = &Adapter->haldata; -if (0 != hal_data->AntDivCfg) { +if (hal_data->AntDivCfg !=0 ) {/* select optimum_antenna for before linked =>For antenna diversity */ if (dst->Rssi >= src->Rssi) {/* keep org parameter */ src->Rssi = dst->Rssi;
drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +5 -5
@@ -519,7 +519,7 @@ void rtl8188e_ReadEFuse(struct adapter *Adapter, u16 _size_byte, u8 *pbuf) ret =iol_read_efuse (Adapter, _size_byte, pbuf);iol_mode_enable (Adapter,0 ); -if (_SUCCESS == ret) +if (ret == _SUCCESS)return ; }
@@ -648,13 +648,13 @@ s32 InitLLTTable(struct adapter *padapter, u8 txpktbuf_bndy) }else {for (i =0 ; i < (txpktbuf_bndy -1 ); i++) { status =_LLTWrite (padapter, i, i +1 ); -if (_SUCCESS != status) +if (status != _SUCCESS)return status; }/* end of list */ status =_LLTWrite (padapter, (txpktbuf_bndy -1 ),0xFF ); -if (_SUCCESS != status) +if (status != _SUCCESS)return status;/* Make the other pages as ring buffer */
@@ -662,13 +662,13 @@ s32 InitLLTTable(struct adapter *padapter, u8 txpktbuf_bndy)/* Otherwise used as local loopback buffer. */ for (i = txpktbuf_bndy; i < Last_Entry_Of_TxPktBuf; i++) { status =_LLTWrite (padapter, i, (i +1 )); -if (_SUCCESS != status) +if (status != _SUCCESS)return status; }/* Let last entry point to the start entry of ring buffer */ status =_LLTWrite (padapter, Last_Entry_Of_TxPktBuf, txpktbuf_bndy); -if (_SUCCESS != status) { +if (status != _SUCCESS) {return status; } }
drivers/staging/r8188eu/hal/rtl8188eu_xmit.c +1 -1
@@ -513,7 +513,7 @@ bool rtl8188eu_xmitframe_complete(struct adapter *adapt, struct xmit_priv *pxmit pbuf =round_up (pbuf_tail,8 ); pfirstframe->agg_num++; -if (MAX_TX_AGG_PACKET_NUMBER == pfirstframe->agg_num) +if (pfirstframe->agg_num ==MAX_TX_AGG_PACKET_NUMBER )break ;if (pbuf < bulkptr) {
drivers/staging/r8188eu/include/rtw_mlme.h +2 -2
@@ -454,7 +454,7 @@ static inline void set_fwstate(struct mlme_priv *pmlmepriv, int state) { pmlmepriv->fw_state |= state;/* FOR HW integration */ -if (_FW_UNDER_SURVEY == state) +if (state == _FW_UNDER_SURVEY) pmlmepriv->bScanInProcess = true; }
@@ -462,7 +462,7 @@ static inline void _clr_fwstate_(struct mlme_priv *pmlmepriv, int state) { pmlmepriv->fw_state &= ~state;/* FOR HW integration */ -if (_FW_UNDER_SURVEY == state) +if (state == _FW_UNDER_SURVEY) pmlmepriv->bScanInProcess = false; }
drivers/staging/r8188eu/os_dep/ioctl_linux.c +3 -3
@@ -3071,11 +3071,11 @@ static int rtw_rereg_nd_name(struct net_device *dev,if (copy_from_user (new_ifname, wrqu->data.pointer,IFNAMSIZ ))return -EFAULT ; -if (0 ==strcmp (rereg_priv->old_ifname, new_ifname)) +if (strcmp (rereg_priv->old_ifname, new_ifname) ==0 )return ret; ret =rtw_change_ifname (padapter, new_ifname); -if (0 != ret) +if (ret !=0 ) goto exit;if (!memcmp (rereg_priv->old_ifname,"disable%d" ,9 )) {
@@ -3558,7 +3558,7 @@ static int rtw_wx_set_priv(struct net_device *dev,int probereq_wpsie_len = len;u8 wps_oui[4 ] = {0x0 ,0x50 ,0xf2 ,0x04 }; -if ((_VENDOR_SPECIFIC_IE_ == probereq_wpsie[0 ]) && +if ((probereq_wpsie[0 ] == _VENDOR_SPECIFIC_IE_) && (!memcmp (&probereq_wpsie[2 ], wps_oui,4 ))) { cp_sz =min (probereq_wpsie_len,MAX_WPS_IE_LEN );
Signature · 1 line
2.31.1
Quoted 10 lines · Abhirup Deb
This series of patches fixes the coding-style issues reported by checkpatch.pl for the staging/r8188eu driver.
Abhirup Deb (5):
staging: r8188eu: add blank line after declaration
staging: r8188eu: refactor block-comments
staging: r8188eu: remove redundant else after return
staging: r8188eu: Replace "<<" with BIT macro
staging: r8188eu: place constants on right side of comparison
Quoted 11 lines
drivers/staging/r8188eu/core/rtw_mlme_ext.c | 61 +++++++------- drivers/staging/r8188eu/hal/rtl8188e_cmd.c | 2 +- drivers/staging/r8188eu/hal/rtl8188e_dm.c | 2 +- .../staging/r8188eu/hal/rtl8188e_hal_init.c | 10 +-- drivers/staging/r8188eu/hal/rtl8188eu_xmit.c | 2 +- drivers/staging/r8188eu/hal/usb_halinit.c | 23 ++++-- drivers/staging/r8188eu/include/ieee80211.h | 82 +++++++++---------- drivers/staging/r8188eu/include/rtw_mlme.h | 4 +- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 6 +- 9 files changed, 98 insertions(+), 94 deletions(-)
Hi,
sorry this driver was deleted: Please read:
https://lore.kernel.org/linux-staging/[email protected]/
Please also check on which tree you are working on. This seems to be the wrong one.
If you need support I will help you.
Thanks for your support.
Bye Philipp