* [PATCH v2] Fix line too long warning @ 2017-10-29 17:12 Kien Ha 2017-10-30 12:02 ` Dan Carpenter 2017-11-01 8:06 ` [PATCH v2] " kbuild test robot 0 siblings, 2 replies; 6+ messages in thread From: Kien Ha @ 2017-10-29 17:12 UTC (permalink / raw) To: linux-kernel, devel >From dbe17bd47c0e76372a5ca391543dc15ddb35c9dd Mon Sep 17 00:00:00 2001 From: Kien Ha <kienha9922@gmail.com> Date: Fri, 27 Oct 2017 14:07:55 -0400 Subject: [PATCH v2] Fix line too long warning Signed-off-by: Kien Ha <kienha9922@gmail.com> --- drivers/staging/rtlwifi/base.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/drivers/staging/rtlwifi/base.c b/drivers/staging/rtlwifi/base.c index b88b0e8edd3d..fdd1ab1e38c5 100644 --- a/drivers/staging/rtlwifi/base.c +++ b/drivers/staging/rtlwifi/base.c @@ -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)) -- 2.14.3 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2] Fix line too long warning 2017-10-29 17:12 [PATCH v2] Fix line too long warning Kien Ha @ 2017-10-30 12:02 ` Dan Carpenter 2017-10-31 4:48 ` [PATCH v2] staging: rtlwifi: " Kien Ha 2017-11-01 8:06 ` [PATCH v2] " kbuild test robot 1 sibling, 1 reply; 6+ messages in thread From: Dan Carpenter @ 2017-10-30 12:02 UTC (permalink / raw) To: Kien Ha; +Cc: linux-kernel, devel The subject should say the subsytem name: [PATCH v2] Staging: rtlwifi: Fix line too long warning On Sun, Oct 29, 2017 at 01:12:56PM -0400, Kien Ha wrote: > >From dbe17bd47c0e76372a5ca391543dc15ddb35c9dd Mon Sep 17 00:00:00 2001 > From: Kien Ha <kienha9922@gmail.com> > Date: Fri, 27 Oct 2017 14:07:55 -0400 > Subject: [PATCH v2] Fix line too long warning > Fix this. Add a changelog. > Signed-off-by: Kien Ha <kienha9922@gmail.com> > --- Say what changed here under the --- between v1 and v2. regards, dan carpenter ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2] staging: rtlwifi: Fix line too long warning 2017-10-30 12:02 ` Dan Carpenter @ 2017-10-31 4:48 ` Kien Ha 2017-11-01 16:47 ` Greg KH 0 siblings, 1 reply; 6+ messages in thread From: Kien Ha @ 2017-10-31 4:48 UTC (permalink / raw) To: Dan Carpenter; +Cc: linux-kernel, devel >From aa0f4ae8c325545b1fd794d6bbf8c4d2f64e2ec2 Mon Sep 17 00:00:00 2001 From: Kien Ha <kienha9922@gmail.com> 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. Signed-off-by: Kien Ha <kienha9922@gmail.com> --- Changes in v2: - Improve block of code to be more concise drivers/staging/rtlwifi/base.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/drivers/staging/rtlwifi/base.c b/drivers/staging/rtlwifi/base.c index b88b0e8edd3d..fdd1ab1e38c5 100644 --- a/drivers/staging/rtlwifi/base.c +++ b/drivers/staging/rtlwifi/base.c @@ -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)) -- 2.14.3 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2] staging: rtlwifi: Fix line too long warning 2017-10-31 4:48 ` [PATCH v2] staging: rtlwifi: " Kien Ha @ 2017-11-01 16:47 ` Greg KH 2017-11-02 18:51 ` Kien Ha 0 siblings, 1 reply; 6+ messages in thread From: Greg KH @ 2017-11-01 16:47 UTC (permalink / raw) To: Kien Ha; +Cc: Dan Carpenter, devel, linux-kernel On Tue, Oct 31, 2017 at 12:48:04AM -0400, Kien Ha wrote: > >From aa0f4ae8c325545b1fd794d6bbf8c4d2f64e2ec2 Mon Sep 17 00:00:00 2001 > From: Kien Ha <kienha9922@gmail.com> > 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? > > Made nested if else statement more concise to help conform to coding > style. > > Signed-off-by: Kien Ha <kienha9922@gmail.com> > --- > Changes in v2: > - Improve block of code to be more concise > > drivers/staging/rtlwifi/base.c | 25 ++++++++----------------- > 1 file changed, 8 insertions(+), 17 deletions(-) > > diff --git a/drivers/staging/rtlwifi/base.c b/drivers/staging/rtlwifi/base.c > index b88b0e8edd3d..fdd1ab1e38c5 100644 > --- a/drivers/staging/rtlwifi/base.c > +++ b/drivers/staging/rtlwifi/base.c > @@ -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]; 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] staging: rtlwifi: Fix line too long warning 2017-11-01 16:47 ` Greg KH @ 2017-11-02 18:51 ` Kien Ha 0 siblings, 0 replies; 6+ messages in thread From: Kien Ha @ 2017-11-02 18:51 UTC (permalink / raw) To: Greg KH; +Cc: Dan Carpenter, devel, linux-kernel On Wed, 2017-11-01 at 17:47 +0100, Greg KH wrote: > On Tue, Oct 31, 2017 at 12:48:04AM -0400, Kien Ha wrote: > > > From aa0f4ae8c325545b1fd794d6bbf8c4d2f64e2ec2 Mon Sep 17 00:00:00 > > > 2001 > > > > From: Kien Ha <kienha9922@gmail.com> > > 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? Noted. And thanks! > > > > > Made nested if else statement more concise to help conform to > > coding > > style. > > > > Signed-off-by: Kien Ha <kienha9922@gmail.com> > > --- > > Changes in v2: > > - Improve block of code to be more concise > > > > drivers/staging/rtlwifi/base.c | 25 ++++++++----------------- > > 1 file changed, 8 insertions(+), 17 deletions(-) > > > > diff --git a/drivers/staging/rtlwifi/base.c > > b/drivers/staging/rtlwifi/base.c > > index b88b0e8edd3d..fdd1ab1e38c5 100644 > > --- a/drivers/staging/rtlwifi/base.c > > +++ b/drivers/staging/rtlwifi/base.c > > @@ -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_rat > > e(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]; > > 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] Fix line too long warning 2017-10-29 17:12 [PATCH v2] Fix line too long warning Kien Ha 2017-10-30 12:02 ` Dan Carpenter @ 2017-11-01 8:06 ` kbuild test robot 1 sibling, 0 replies; 6+ messages in thread From: kbuild test robot @ 2017-11-01 8:06 UTC (permalink / raw) To: Kien Ha; +Cc: kbuild-all, linux-kernel, devel [-- Attachment #1: Type: text/plain, Size: 4544 bytes --] 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 [-- Attachment #2: .config.gz --] [-- Type: application/gzip, Size: 51596 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-11-02 18:51 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-10-29 17:12 [PATCH v2] Fix line too long warning Kien Ha 2017-10-30 12:02 ` Dan Carpenter 2017-10-31 4:48 ` [PATCH v2] staging: rtlwifi: " Kien Ha 2017-11-01 16:47 ` Greg KH 2017-11-02 18:51 ` Kien Ha 2017-11-01 8:06 ` [PATCH v2] " kbuild test robot
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).