From: Ajay Singh <ajay.kathat@microchip.com>
To: Claudiu Beznea <Claudiu.Beznea@microchip.com>
Cc: <linux-wireless@vger.kernel.org>, <devel@driverdev.osuosl.org>,
<gregkh@linuxfoundation.org>, <ganesh.krishna@microchip.com>,
<venkateswara.kaja@microchip.com>, <aditya.shankar@microchip.com>,
<adham.abozaeid@Microchip.com>
Subject: Re: [PATCH 14/30] staging: wilc1000: fix line over 80 chars in add_network_to_shadow()
Date: Mon, 14 May 2018 16:48:23 +0530 [thread overview]
Message-ID: <20180514164823.7d773e7e@ajaysk-VirtualBox> (raw)
In-Reply-To: <9aa5bfe8-2e41-6d37-4190-74dcbd301893@microchip.com>
Hi Claudiu,
On Mon, 14 May 2018 11:57:24 +0300
Claudiu Beznea <Claudiu.Beznea@microchip.com> wrote:
> Hi Ajay,
>
> On 10.05.2018 08:27, Claudiu Beznea wrote:
> >
> >
> > On 09.05.2018 21:42, Ajay Singh wrote:
> >> On Wed, 9 May 2018 16:43:14 +0300
> >> Claudiu Beznea <Claudiu.Beznea@microchip.com> wrote:
> >>
> >>> On 07.05.2018 11:43, Ajay Singh wrote:
> >>>> Fix line over 80 characters issue reported by checkpatch in
> >>>> add_network_to_shadow() by using temporary variable.
> >>>
> >>> I, personally, don't like this way of fixing line over 80. From my
> >>> point of view this introduces a new future patch. Maybe, in
> >>> future, somebody will remove this temporary variable stating that
> >>> there is no need for it.
> >>>
> >>
> >> In my opinion, just by removing this temporary variable the patch
> >> might not go through because it will definitely have line over
> >> 80 character issue. As per guideline its recommended to run the
> >> checkpatch before submitting the patch.
> >>
> >> Only using short variables names might help to resolve that issue
> >> but using short variable names will not give clear meaning for the
> >> code. I don't want to shorten the variable name as they don't
> >> convey the complete meaning.
> >>
> >> Do you have any suggestion/code which can help to understand how to
> >> resolve this without using temp/variables name changes.
> >
> > No, for this one I have not. Maybe further refactoring...
> >
>
> Looking over the v2 of this series you send, and over
> wilc_wfi_cfgoperations.c, and remembering your last question on this
> patch, I was thinking that one suggestion for this would be to
> replace last_scanned_shadow with just scanned_shadow or nw_info or
> scanned_nw_info. Just an idea.
>
I avoided use of short name for 'last_scanned_shadow' because it might
not give clear meaning as there are variables like 'last_scanned_cnt',
which also uses same prefix 'last_' and its helpful to know its related
data.
> >>
> >>>>
> >>>> Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
> >>>> ---
> >>>> drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 52
> >>>> +++++++++++------------ 1 file changed, 25 insertions(+), 27
> >>>> deletions(-)
> >>>>
> >>>> diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
> >>>> b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index
> >>>> f1ebaea..0ae2065 100644 ---
> >>>> a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++
> >>>> b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -300,6
> >>>> +300,7 @@ static void add_network_to_shadow(struct network_info
> >>>> *nw_info, int ap_found = is_network_in_shadow(nw_info,
> >>>> user_void); u32 ap_index = 0; u8 rssi_index = 0;
> >>>> + struct network_info *shadow_nw_info;
> >>>>
> >>>> if (last_scanned_cnt >= MAX_NUM_SCANNED_NETWORKS_SHADOW)
> >>>> return;
> >>>> @@ -310,37 +311,34 @@ static void add_network_to_shadow(struct
> >>>> network_info *nw_info, } else {
> >>>> ap_index = ap_found;
> >>>> }
> >>>> - rssi_index =
> >>>> last_scanned_shadow[ap_index].rssi_history.index;
> >>>> -
> >>>> last_scanned_shadow[ap_index].rssi_history.samples[rssi_index++]
> >>>> = nw_info->rssi;
> >>>> + shadow_nw_info = &last_scanned_shadow[ap_index];
> >>>> + rssi_index = shadow_nw_info->rssi_history.index;
> >>>> + shadow_nw_info->rssi_history.samples[rssi_index++] =
> >>>> nw_info->rssi; if (rssi_index == NUM_RSSI) {
> >>>> rssi_index = 0;
> >>>> - last_scanned_shadow[ap_index].rssi_history.full
> >>>> = true;
> >>>> - }
> >>>> - last_scanned_shadow[ap_index].rssi_history.index =
> >>>> rssi_index;
> >>>> - last_scanned_shadow[ap_index].rssi = nw_info->rssi;
> >>>> - last_scanned_shadow[ap_index].cap_info =
> >>>> nw_info->cap_info;
> >>>> - last_scanned_shadow[ap_index].ssid_len =
> >>>> nw_info->ssid_len;
> >>>> - memcpy(last_scanned_shadow[ap_index].ssid,
> >>>> - nw_info->ssid, nw_info->ssid_len);
> >>>> - memcpy(last_scanned_shadow[ap_index].bssid,
> >>>> - nw_info->bssid, ETH_ALEN);
> >>>> - last_scanned_shadow[ap_index].beacon_period =
> >>>> nw_info->beacon_period;
> >>>> - last_scanned_shadow[ap_index].dtim_period =
> >>>> nw_info->dtim_period;
> >>>> - last_scanned_shadow[ap_index].ch = nw_info->ch;
> >>>> - last_scanned_shadow[ap_index].ies_len =
> >>>> nw_info->ies_len;
> >>>> - last_scanned_shadow[ap_index].tsf_hi = nw_info->tsf_hi;
> >>>> + shadow_nw_info->rssi_history.full = true;
> >>>> + }
> >>>> + shadow_nw_info->rssi_history.index = rssi_index;
> >>>> + shadow_nw_info->rssi = nw_info->rssi;
> >>>> + shadow_nw_info->cap_info = nw_info->cap_info;
> >>>> + shadow_nw_info->ssid_len = nw_info->ssid_len;
> >>>> + memcpy(shadow_nw_info->ssid, nw_info->ssid,
> >>>> nw_info->ssid_len);
> >>>> + memcpy(shadow_nw_info->bssid, nw_info->bssid, ETH_ALEN);
> >>>> + shadow_nw_info->beacon_period = nw_info->beacon_period;
> >>>> + shadow_nw_info->dtim_period = nw_info->dtim_period;
> >>>> + shadow_nw_info->ch = nw_info->ch;
> >>>> + shadow_nw_info->ies_len = nw_info->ies_len;
> >>>> + shadow_nw_info->tsf_hi = nw_info->tsf_hi;
> >>>> if (ap_found != -1)
> >>>> - kfree(last_scanned_shadow[ap_index].ies);
> >>>> - last_scanned_shadow[ap_index].ies =
> >>>> kmalloc(nw_info->ies_len,
> >>>> - GFP_KERNEL);
> >>>> - memcpy(last_scanned_shadow[ap_index].ies,
> >>>> - nw_info->ies, nw_info->ies_len);
> >>>> - last_scanned_shadow[ap_index].time_scan = jiffies;
> >>>> - last_scanned_shadow[ap_index].time_scan_cached =
> >>>> jiffies;
> >>>> - last_scanned_shadow[ap_index].found = 1;
> >>>> + kfree(shadow_nw_info->ies);
> >>>> + shadow_nw_info->ies = kmalloc(nw_info->ies_len,
> >>>> GFP_KERNEL);
> >>>> + memcpy(shadow_nw_info->ies, nw_info->ies,
> >>>> nw_info->ies_len);
> >>>> + shadow_nw_info->time_scan = jiffies;
> >>>> + shadow_nw_info->time_scan_cached = jiffies;
> >>>> + shadow_nw_info->found = 1;
> >>>> if (ap_found != -1)
> >>>> -
> >>>> kfree(last_scanned_shadow[ap_index].join_params);
> >>>> - last_scanned_shadow[ap_index].join_params = join_params;
> >>>> + kfree(shadow_nw_info->join_params);
> >>>> + shadow_nw_info->join_params = join_params;
> >>>> }
> >>>>
> >>>> static void cfg_scan_result(enum scan_event scan_event,
> >>>>
> >>
> >>
> >>
> >
next prev parent reply other threads:[~2018-05-14 11:18 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-07 8:43 [PATCH 00/30] staging: wilc1000: checkpatch fixes and code cleanup Ajay Singh
2018-05-07 8:43 ` [PATCH 01/30] staging: wilc1000: added complete() call for error scenario in handle_key() Ajay Singh
2018-05-07 8:43 ` [PATCH 02/30] staging: wilc1000: remove 'ret' variable " Ajay Singh
2018-05-07 8:43 ` [PATCH 03/30] staging: wilc1000: fix line over 80 chars " Ajay Singh
2018-05-09 13:44 ` Claudiu Beznea
2018-05-09 18:36 ` Ajay Singh
2018-05-10 5:21 ` Claudiu Beznea
2018-05-15 8:22 ` Dan Carpenter
2018-05-07 8:43 ` [PATCH 04/30] staging: wilc1000: fix line over 80 characters issue in handle_connect() Ajay Singh
2018-05-07 8:43 ` [PATCH 05/30] staging: wilc1000: fix line over 80 chars in host_int_parse_assoc_resp_info() Ajay Singh
2018-05-09 13:44 ` Claudiu Beznea
2018-05-09 18:59 ` Ajay Singh
2018-05-07 8:43 ` [PATCH 06/30] staging: wilc1000: fix line over 80 chars issue in host_int_handle_disconnect() Ajay Singh
2018-05-09 13:44 ` Claudiu Beznea
2018-05-09 18:33 ` Ajay Singh
2018-05-07 8:43 ` [PATCH 07/30] staging: wilc1000: fix line over 80 characters in host_int_parse_join_bss_param() Ajay Singh
2018-05-09 13:43 ` Claudiu Beznea
2018-05-09 18:41 ` Ajay Singh
2018-05-07 8:43 ` [PATCH 08/30] staging: wilc1000: fix line over 80 chars in host_int_parse_assoc_resp_info() Ajay Singh
2018-05-09 13:43 ` Claudiu Beznea
2018-05-09 18:41 ` Ajay Singh
2018-05-07 8:43 ` [PATCH 09/30] staging: wilc1000: rename kmalloc with kmemdup() in handle_connect_timeout() Ajay Singh
2018-05-07 8:43 ` [PATCH 10/30] staging: wilc1000: fix line over 80 chars in linux_mon Ajay Singh
2018-05-07 8:43 ` [PATCH 11/30] staging: wilc1000: use sizeof(*wdev) to allocate memory in wilc_wfi_cfg_alloc() Ajay Singh
2018-05-07 8:43 ` [PATCH 12/30] staging: wilc1000: use kmalloc(sizeof(*mgmt_tx)...) in mgmt_tx() Ajay Singh
2018-05-07 8:43 ` [PATCH 13/30] staging: wilc1000: rename clear_duringIP() to avoid camelCase issue Ajay Singh
2018-05-09 13:43 ` Claudiu Beznea
2018-05-07 8:43 ` [PATCH 14/30] staging: wilc1000: fix line over 80 chars in add_network_to_shadow() Ajay Singh
2018-05-09 13:43 ` Claudiu Beznea
2018-05-09 18:42 ` Ajay Singh
2018-05-10 5:27 ` Claudiu Beznea
2018-05-14 8:57 ` Claudiu Beznea
2018-05-14 11:18 ` Ajay Singh [this message]
2018-05-07 8:43 ` [PATCH 15/30] staging: wilc1000: use kmemdup instead of kmalloc " Ajay Singh
2018-05-09 13:42 ` Claudiu Beznea
2018-05-09 19:17 ` Ajay Singh
2018-05-10 5:35 ` Claudiu Beznea
2018-05-10 7:47 ` Ajay Singh
2018-05-07 8:43 ` [PATCH 16/30] staging: wilc1000: fix line over 80 charas in wilc_wfi_remain_on_channel_expired() Ajay Singh
2018-05-07 8:43 ` [PATCH 17/30] staging: wilc1000: fix line over 80 chars in wilc_wfi_cfg_tx_vendor_spec() Ajay Singh
2018-05-09 13:42 ` Claudiu Beznea
2018-05-09 18:44 ` Ajay Singh
2018-05-07 8:43 ` [PATCH 18/30] staging: wilc1000: fix line over 80 chars in get_station() Ajay Singh
2018-05-07 8:43 ` [PATCH 19/30] staging: wilc1000: fix line over 80 chars in wilc_create_wiphy() declaration Ajay Singh
2018-05-07 8:43 ` [PATCH 20/30] staging: wilc1000: fix line over 80 characters in add_key() Ajay Singh
2018-05-07 8:43 ` [PATCH 21/30] staging: wilc1000: fix line over 80 chars in scan() Ajay Singh
2018-05-07 8:43 ` [PATCH 22/30] staging: wilc1000: fix line over 80 chars issue in connect() Ajay Singh
2018-05-07 8:43 ` [PATCH 23/30] staging: wilc1000: rename u8security to avoid datatype in variable name Ajay Singh
2018-05-07 8:43 ` [PATCH 24/30] staging: wilc1000: refactor del_station() to avoid parenthesis misalignment Ajay Singh
2018-05-15 9:01 ` Dan Carpenter
2018-05-15 11:46 ` Ajay Singh
2018-05-07 8:43 ` [PATCH 25/30] staging: wilc1000: fix line over 80 chars in wilc_sdio struct Ajay Singh
2018-05-07 8:43 ` [PATCH 26/30] staging: wilc1000: added #define for setting radiotap header Ajay Singh
2018-05-07 8:43 ` [PATCH 27/30] staging: wilc1000: remove 'flag' argument from wilc_mac_indicate() Ajay Singh
2018-05-07 8:43 ` [PATCH 28/30] staging: wilc1000: added comments for mutex and spinlock_t Ajay Singh
2018-05-09 13:42 ` Claudiu Beznea
2018-05-07 8:43 ` [PATCH 29/30] staging: wilc1000: remove unused 'lock' varible in 'wilc_priv' structure Ajay Singh
2018-05-07 8:43 ` [PATCH 30/30] staging: wilc1000: rename s8idxarray to avoid datatype in variable name Ajay Singh
2018-05-09 13:42 ` Claudiu Beznea
2018-05-09 18:44 ` Ajay Singh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180514164823.7d773e7e@ajaysk-VirtualBox \
--to=ajay.kathat@microchip.com \
--cc=Claudiu.Beznea@microchip.com \
--cc=adham.abozaeid@Microchip.com \
--cc=aditya.shankar@microchip.com \
--cc=devel@driverdev.osuosl.org \
--cc=ganesh.krishna@microchip.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-wireless@vger.kernel.org \
--cc=venkateswara.kaja@microchip.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).