Fix line too long warning
PATCH v2 1/1 Fix line too long warning
Quoted 1 line
From
dbe17bd47c0e76372a5ca391543dc15ddb35c9ddMon Sep 17 00:00:00 2001
From: Kien Ha <[email protected]>
Date: Fri, 27 Oct 2017 14:07:55 -0400
Subject: [PATCH v2] Fix line too long warning
--- drivers/staging/rtlwifi/base.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-)
drivers/staging/rtlwifi/base.c +8 -17
@@ -1273,23 +1273,14 @@ void rtl_get_tcb_desc(struct ieee80211_hw *hw,* and N rate will all be controlled by FW * when tcb_desc->use_driver_rate = false */ -if (sta && sta->vht_cap.vht_supported) { - tcb_desc->hw_rate = -_rtl_get_vht_highest_n_rate (hw, sta); - }else { -if (sta && (sta->ht_cap.ht_supported)) { - tcb_desc->hw_rate = -_rtl_get_highest_n_rate (hw, sta); - }else { -if (rtlmac->mode ==WIRELESS_MODE_B ) { - tcb_desc->hw_rate = - rtlpriv->cfg->maps[RTL_RC_CCK_RATE11M ]; - }else { - tcb_desc->hw_rate = - rtlpriv->cfg->maps[RTL_RC_OFDM_RATE54M ]; - } - } - } + tcb_desc->hw_rate = + sta && sta->vht_cap.vht_supported ? +rtl_get_vht_highest_n_rate (hw, sta) : + sta && sta->ht_cap.ht_supported ? +_rtl_get_highest_n_rate (hw, sta) : + rtlmac->mode ==WIRELESS_MODE_B ? + rtlpriv->cfg->maps[RTL_RC_CCK_RATE11M ] : + rtlpriv->cfg->maps[RTL_RC_OFDM_RATE54M ]; }if (is_multicast_ether_addr (hdr->addr1))
Signature · 1 line
2.14.3
The subject should say the subsytem name:
[PATCH v2] Staging: rtlwifi: Fix line too long warning
Quoted 5 lines · Kien Ha
Quoted 1 line
From
dbe17bd47c0e76372a5ca391543dc15ddb35c9ddMon Sep 17 00:00:00 2001From: Kien Ha <[email protected]>
Date: Fri, 27 Oct 2017 14:07:55 -0400
Subject: [PATCH v2] Fix line too long warning
Fix this. Add a changelog.
Quoted 2 lines
Signed-off-by Kien Ha <[email protected]>---
Say what changed here under the --- between v1 and v2.
regards,
dan carpenter
PATCH v2 1/1 staging: rtlwifi: Fix line too long warning
Quoted 1 line
From
aa0f4ae8c325545b1fd794d6bbf8c4d2f64e2ec2Mon Sep 17 00:00:00 2001
From: Kien Ha <[email protected]>
Date: Fri, 27 Oct 2017 14:07:55 -0400
Subject: [PATCH v2] staging: rtlwifi: Fix line too long warning
Made nested if else statement more concise to help conform to coding style.
---
Changes in v2:
- Improve block of code to be more concise
drivers/staging/rtlwifi/base.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-)
drivers/staging/rtlwifi/base.c +8 -17
@@ -1273,23 +1273,14 @@ void rtl_get_tcb_desc(struct ieee80211_hw *hw,* and N rate will all be controlled by FW * when tcb_desc->use_driver_rate = false */ -if (sta && sta->vht_cap.vht_supported) { - tcb_desc->hw_rate = -_rtl_get_vht_highest_n_rate (hw, sta); - }else { -if (sta && (sta->ht_cap.ht_supported)) { - tcb_desc->hw_rate = -_rtl_get_highest_n_rate (hw, sta); - }else { -if (rtlmac->mode ==WIRELESS_MODE_B ) { - tcb_desc->hw_rate = - rtlpriv->cfg->maps[RTL_RC_CCK_RATE11M ]; - }else { - tcb_desc->hw_rate = - rtlpriv->cfg->maps[RTL_RC_OFDM_RATE54M ]; - } - } - } + tcb_desc->hw_rate = + sta && sta->vht_cap.vht_supported ? +rtl_get_vht_highest_n_rate (hw, sta) : + sta && sta->ht_cap.ht_supported ? +_rtl_get_highest_n_rate (hw, sta) : + rtlmac->mode ==WIRELESS_MODE_B ? + rtlpriv->cfg->maps[RTL_RC_CCK_RATE11M ] : + rtlpriv->cfg->maps[RTL_RC_OFDM_RATE54M ]; }if (is_multicast_ether_addr (hdr->addr1))
Signature · 1 line
2.14.3
Greg KH
maintainerRe: [PATCH v2] staging: rtlwifi: Fix line too long warning
Quoted 4 lines · Kien Ha
Quoted 1 line
From
aa0f4ae8c325545b1fd794d6bbf8c4d2f64e2ec2Mon Sep 17 00:00:00 2001From: Kien Ha <[email protected]>
Date: Fri, 27 Oct 2017 14:07:55 -0400
Subject: [PATCH v2] staging: rtlwifi: Fix line too long warning
Why is all of this here in the "changelog body" of the patch?
Quoted 35 lines
Made nested if else statement more concise to help conform to coding style.
Signed-off-by Kien Ha <[email protected]>---
Changes in v2:
- Improve block of code to be more concisedrivers/staging/rtlwifi/base.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-)drivers/staging/rtlwifi/base.c +0
-15@@ -1273,23 +1273,14 @@ void rtl_get_tcb_desc(struct ieee80211_hw *hw,* and N rate will all be controlled by FW * when tcb_desc->use_driver_rate = false */ -if (sta && sta->vht_cap.vht_supported) { - tcb_desc->hw_rate = -_rtl_get_vht_highest_n_rate (hw, sta); - }else { -if (sta && (sta->ht_cap.ht_supported)) { - tcb_desc->hw_rate = -_rtl_get_highest_n_rate (hw, sta); - }else { -if (rtlmac->mode ==WIRELESS_MODE_B ) { - tcb_desc->hw_rate = - rtlpriv->cfg->maps[RTL_RC_CCK_RATE11M ]; - }else { - tcb_desc->hw_rate = - rtlpriv->cfg->maps[RTL_RC_OFDM_RATE54M ]; - }
drivers/staging/rtlwifi/base.c void rtl_get_tcb_desc(struct ieee80211_hw *hw, · line 1283
Quoted 10 lines
drivers/staging/rtlwifi/base.c +8
-2- } - } + tcb_desc->hw_rate = + sta && sta->vht_cap.vht_supported ? +rtl_get_vht_highest_n_rate (hw, sta) : + sta && sta->ht_cap.ht_supported ? +_rtl_get_highest_n_rate (hw, sta) : + rtlmac->mode ==WIRELESS_MODE_B ? + rtlpriv->cfg->maps[RTL_RC_CCK_RATE11M ] : + rtlpriv->cfg->maps[RTL_RC_OFDM_RATE54M ];
That's horrible to read, can you understand it?
I hate ? : logic, please write code for people to read, not compilers.
thanks,
greg k-h
Re: [PATCH v2] staging: rtlwifi: Fix line too long warning
Quoted 9 lines · Greg KH
Quoted 6 lines · Kien Ha
Quoted 2 lines
From
aa0f4ae8c325545b1fd794d6bbf8c4d2f64e2ec2Mon Sep 17 00:00:00 2001From: Kien Ha <[email protected]>
Date: Fri, 27 Oct 2017 14:07:55 -0400
Subject: [PATCH v2] staging: rtlwifi: Fix line too long warningWhy is all of this here in the "changelog body" of the patch?
Noted. And thanks!
Quoted 59 lines
Quoted 59 lines
Made nested if else statement more concise to help conform to coding
style.Signed-off-by Kien Ha <[email protected]>---
Changes in v2:
- Improve block of code to be more concisedrivers/staging/rtlwifi/base.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-)drivers/staging/rtlwifi/base.c +0
-10@@ -1273,23 +1273,14 @@ void rtl_get_tcb_desc(struct ieee80211_hw*hw, * and N rate will all be controlled by FW * when tcb_desc->use_driver_rate = false */ -if (sta && sta->vht_cap.vht_supported) { - tcb_desc->hw_rate = -_rtl_get_vht_highest_n_rate (hw, sta); - }else { -if (sta && (sta- >ht_cap.ht_supported)) { - tcb_desc->hw_rate = - _rtl_get_highest_n_rate (hw, sta); - }else { -if (rtlmac->mode == WIRELESS_MODE_B) { - tcb_desc->hw_rate=
drivers/staging/rtlwifi/base.c +0
-1- rtlpriv->cfg-Quoted 1 line
maps[RTL_RC_CCK_RATE11M];
drivers/staging/rtlwifi/base.c +0
-2- }else { - tcb_desc->hw_rate=
drivers/staging/rtlwifi/base.c +0
-1- rtlpriv->cfg-Quoted 1 line
maps[RTL_RC_OFDM_RATE54M];
drivers/staging/rtlwifi/base.c +2
-3- } - } - } + tcb_desc->hw_rate = + sta && sta->vht_cap.vht_supported?
drivers/staging/rtlwifi/base.c +1
-0+ rtl_get_vht_highest_n_rate(hw, sta) :
drivers/staging/rtlwifi/base.c +2
-0+ sta && sta->ht_cap.ht_supported ? + _rtl_get_highest_n_rate(hw, sta) :
drivers/staging/rtlwifi/base.c +2
-0+ rtlmac->mode == WIRELESS_MODE_B ? + rtlpriv->cfg-
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
maps[RTL_RC_CCK_RATE11M] :
drivers/staging/rtlwifi/base.c +1
-0+ rtlpriv->cfg-Quoted 1 line
maps[RTL_RC_OFDM_RATE54M];
That's horrible to read, can you understand it?
I hate ? : logic, please write code for people to read, not compilers.
I agree, I find it difficult to read. I'm wondering, is it necessary to have these nested if and else statements? Sorry if it isn't terribly obvious at a glance since I'm writing this while in class. Maybe something like the code snippet below would be better.
if (sta && sta->vht_cap.vht_supported) {
tcb_desc->hw_rate =
- _rtl_get_vht_highest_n_rate(hw, sta);
+ _rtl_get_vht_highest_n_rate(hw, sta);
+ } else if (sta && sta->ht_cap.ht_supported) {
+ tcb_desc->hw_rate =
+ _rtl_get_highest_n_rate(hw, sta);
+ } else if (rtlmac->mode == WIRELESS_MODE_B) {
+ tcb_desc->hw_rate =
+ rtlpriv->cfg->maps[RTL_RC_CCK_RATE11M];
} else {
- if (sta && (sta->ht_cap.ht_supported)) {
- tcb_desc->hw_rate =
- _rtl_get_highest_n_rate(hw, sta);
- } else {
- if (rtlmac->mode == WIRELESS_MODE_B) {
- tcb_desc->hw_rate =
- rtlpriv->cfg->maps[RTL_RC_CCK_RATE11M];
- } else {
- tcb_desc->hw_rate =
- rtlpriv->cfg->maps[RTL_RC_OFDM_RATE54M];
- }
- }
+ tcb_desc_hw_rate =
+ rtlpriv->cfg->maps[RTL_RC_OFDM_RATE54M];
}
}
Thanks,
Kien Ha
kbuild test robot
build botThank you for the patch! Yet something to improve:
Hi Kien,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v4.14-rc7 next-20171018]
[cannot apply to staging/staging-testing]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Kien-Ha/Fix-line-too-long-warning/20171101-151946
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=xtensa
All errors (new ones prefixed by >>):
drivers/staging//rtlwifi/base.c: In function 'rtl_get_tcb_desc':
>> drivers/staging//rtlwifi/base.c:1278:6: error: implicit declaration of function 'rtl_get_vht_highest_n_rate' [-Werror=implicit-function-declaration]
rtl_get_vht_highest_n_rate(hw, sta) :
^
drivers/staging//rtlwifi/base.c: At top level:
drivers/staging//rtlwifi/base.c:906:11: warning: '_rtl_get_vht_highest_n_rate' defined but not used [-Wunused-function]
static u8 _rtl_get_vht_highest_n_rate(struct ieee80211_hw *hw,
^cc1: some warnings being treated as errors
vim +/rtl_get_vht_highest_n_rate +1278 drivers/staging//rtlwifi/base.c
1225
1226 void rtl_get_tcb_desc(struct ieee80211_hw *hw,
1227 struct ieee80211_tx_info *info,
1228 struct ieee80211_sta *sta,
1229 struct sk_buff *skb, struct rtl_tcb_desc *tcb_desc)
1230 {
1231 #define SET_RATE_ID(rate_id) \
1232 ((rtlpriv->cfg->spec_ver & RTL_SPEC_NEW_RATEID) ? \
1233 rtl_mrate_idx_to_arfr_id(hw, rate_id, \
1234 (sta_entry ? sta_entry->wireless_mode : \
1235 WIRELESS_MODE_G)) : \
1236 rate_id)
1237
1238 struct rtl_priv *rtlpriv = rtl_priv(hw);
1239 struct rtl_mac *rtlmac = rtl_mac(rtl_priv(hw));
1240 struct ieee80211_hdr *hdr = rtl_get_hdr(skb);
1241 struct rtl_sta_info *sta_entry =
1242 (sta ? (struct rtl_sta_info *)sta->drv_priv : NULL);
1243
1244 __le16 fc = rtl_get_fc(skb);
1245
1246 tcb_desc->hw_rate = _rtl_get_tx_hw_rate(hw, info);
1247
1248 if (rtl_is_tx_report_skb(hw, skb))
1249 tcb_desc->use_spe_rpt = 1;
1250
1251 if (ieee80211_is_data(fc)) {
1252 /*
1253 *we set data rate INX 0
1254 *in rtl_rc.c if skb is special data or
1255 *mgt which need low data rate.
1256 */
1257
1258 /*
1259 *So tcb_desc->hw_rate is just used for
1260 *special data and mgt frames
1261 */
1262 if (info->control.rates[0].idx == 0 ||
1263 ieee80211_is_nullfunc(fc)) {
1264 tcb_desc->use_driver_rate = true;
1265 tcb_desc->ratr_index =
1266 SET_RATE_ID(RATR_INX_WIRELESS_MC);
1267
1268 tcb_desc->disable_ratefallback = 1;
1269 } else {
1270 /* because hw will never use hw_rate
1271 * when tcb_desc->use_driver_rate = false
1272 * so we never set highest N rate here,
1273 * and N rate will all be controlled by FW
1274 * when tcb_desc->use_driver_rate = false
1275 */
1276 tcb_desc->hw_rate =
1277 sta && sta->vht_cap.vht_supported ?
> 1278 rtl_get_vht_highest_n_rate(hw, sta) : 1279 sta && sta->ht_cap.ht_supported ?
1280 _rtl_get_highest_n_rate(hw, sta) :
1281 rtlmac->mode == WIRELESS_MODE_B ?
1282 rtlpriv->cfg->maps[RTL_RC_CCK_RATE11M] :
1283 rtlpriv->cfg->maps[RTL_RC_OFDM_RATE54M];
1284 }
1285
1286 if (is_multicast_ether_addr(hdr->addr1))
1287 tcb_desc->multicast = 1;
1288 else if (is_broadcast_ether_addr(hdr->addr1))
1289 tcb_desc->broadcast = 1;
1290
1291 _rtl_txrate_selectmode(hw, sta, tcb_desc);
1292 _rtl_query_bandwidth_mode(hw, sta, tcb_desc);
1293 _rtl_qurey_shortpreamble_mode(hw, tcb_desc, info);
1294 _rtl_query_shortgi(hw, sta, tcb_desc, info);
1295 _rtl_query_protection_mode(hw, tcb_desc, info);
1296 } else {
1297 tcb_desc->use_driver_rate = true;
1298 tcb_desc->ratr_index = SET_RATE_ID(RATR_INX_WIRELESS_MC);
1299 tcb_desc->disable_ratefallback = 1;
1300 tcb_desc->mac_id = 0;
1301 tcb_desc->packet_bw = false;
1302 }
1303 #undef SET_RATE_ID
1304 }
1305
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation