From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751972AbbJMFlS (ORCPT ); Tue, 13 Oct 2015 01:41:18 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:40033 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750926AbbJMFlR (ORCPT ); Tue, 13 Oct 2015 01:41:17 -0400 Date: Mon, 12 Oct 2015 20:39:54 -0700 From: Greg Kroah-Hartman To: =?iso-8859-1?Q?Rapha=EBl?= Beamonte Cc: Cristina Opriceana , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCHv4 1/2] staging: rtl8192u: r8192U_core: add temporary variables to keep lines under 80 characters Message-ID: <20151013033954.GA16541@kroah.com> References: <60b3902967a2bad58673c5e03821cfef6ed7654a.1443999354.git.raphael.beamonte@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <60b3902967a2bad58673c5e03821cfef6ed7654a.1443999354.git.raphael.beamonte@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Oct 04, 2015 at 06:55:57PM -0400, Raphaël Beamonte wrote: > Add some temporary variables to reduce line length under the maximum > of 80 characters, as per the kernel code style. > > Signed-off-by: Raphaël Beamonte > --- > drivers/staging/rtl8192u/r8192U_core.c | 130 ++++++++++++++++++++++----------- > 1 file changed, 88 insertions(+), 42 deletions(-) > > diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c > index 28b54ba..e67be02 100644 > --- a/drivers/staging/rtl8192u/r8192U_core.c > +++ b/drivers/staging/rtl8192u/r8192U_core.c > @@ -171,6 +171,7 @@ static void rtl819x_set_channel_map(u8 channel_plan, struct r8192_priv *priv) > { > int i, max_chan = -1, min_chan = -1; > struct ieee80211_device *ieee = priv->ieee80211; > + struct CHANNEL_LIST *cl; > > switch (channel_plan) { > case COUNTRY_CODE_FCC: > @@ -194,15 +195,18 @@ static void rtl819x_set_channel_map(u8 channel_plan, struct r8192_priv *priv) > "unknown rf chip, can't set channel map in function:%s()\n", > __func__); > } > - if (ChannelPlan[channel_plan].Len != 0) { > + cl = &ChannelPlan[channel_plan]; > + if (cl->Len != 0) { > /* Clear old channel map */ > memset(GET_DOT11D_INFO(ieee)->channel_map, 0, > sizeof(GET_DOT11D_INFO(ieee)->channel_map)); > /* Set new channel map */ > - for (i = 0; i < ChannelPlan[channel_plan].Len; i++) { > - if (ChannelPlan[channel_plan].Channel[i] < min_chan || ChannelPlan[channel_plan].Channel[i] > max_chan) > + for (i = 0; i < cl->Len; i++) { > + u8 chan = cl->Channel[i]; > + > + if (chan < min_chan || chan > max_chan) > break; > - GET_DOT11D_INFO(ieee)->channel_map[ChannelPlan[channel_plan].Channel[i]] = 1; > + GET_DOT11D_INFO(ieee)->channel_map[chan] = 1; > } > } > break; > @@ -1649,9 +1653,11 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) > &zero, 0, tx_zero_isr, dev); > status = usb_submit_urb(tx_urb_zero, GFP_ATOMIC); > if (status) { > + int idx = tcb_desc->queue_index; > + > RT_TRACE(COMP_ERR, > "Error TX URB for zero byte %d, error %d", > - atomic_read(&priv->tx_pending[tcb_desc->queue_index]), > + atomic_read(&priv->tx_pending[idx]), No need to create a whole new variable when you only use it once. > status); > return -1; > } > @@ -1863,7 +1869,9 @@ static void rtl8192_qos_activate(struct work_struct *work) > */ > for (i = 0; i < QOS_QUEUE_NUM; i++) { > /* Mode G/A: slotTimeTimer = 9; Mode B: 20 */ > - u1bAIFS = qos_parameters->aifs[i] * ((mode & (IEEE_G | IEEE_N_24G)) ? 9 : 20) + aSifsTime; > + int slotTimeTimer = ((mode & (IEEE_G | IEEE_N_24G)) ? 9 : 20); > + > + u1bAIFS = qos_parameters->aifs[i] * slotTimeTimer + aSifsTime; Same here, you only used this once, if you just don't like the formatting, change that, but don't create a variable that is only used once please. thanks, greg k-h