Re: [PATCH] iwlwifi: pcie: align licensing to dual GPL/BSD

2018-10-24 Thread Kirtika Ruchandani
On Wed, Oct 24, 2018 at 12:05 AM Johannes Berg
 wrote:
>
> From: Johannes Berg 
>
> These files have a long history of code changes, but analysing
> the remaining code leads to having only a few changes that are
> not already owned by Intel, notably from
>  - Andy Lutomirski 
>  - Joonwoo Park 
>  - Kirtika Ruchandani 
>  - Rajat Jain 
>  - Stanislaw Gruszka 
> remaining in the code today.
>
> Note that
>  - I myself was working for Intel and for any possibly code
>that might be before my employment there give permission
>  - Wizery employees were working for Intel
>
> More specifically, we identified the following commits that
> (partially may) remain today:
>
> 25c03d8e8c13 Joonwoo Park   ("iwlwifi: do not 
> schedule tasklet when rcv unused irq")
> f36d04abe684 Stanislaw Gruszka("iwlwifi: use 
> dma_alloc_coherent")
> 387f3381f732 Stanislaw Gruszka("iwlwifi: fix dma 
> mappings and skbs leak")
> 2624e96ce16b Stanislaw Gruszka("iwlwifi: fix 
> possible data overwrite in hcmd callback")
> bfe4b80e9f73 Stanislaw Gruszka("iwlwifi: always 
> check if got h/w access before write")
> d536c32b45d2 Andy Lutomirski  ("iwlwifi: pcie: log 
> when waking the NIC for hcmd submission fails")
> a6d24fad00d9 Rajat Jain("iwlwifi: pcie: dump 
> registers when HW becomes inaccessible")
> fb12777ab59b Kirtika Ruchandani  ("iwlwifi: Add more 
> call-sites for pcie reg dumper")
> 3a73a30049f2 Stanislaw Gruszka("iwlwifi: cleanup/fix 
> memory barriers")
> aa5affbacb24 Stanislaw Gruszka("iwlwifi: dump stack 
> when fail to gain access to the device")
>
> Align the licenses with their permission to clean up and to
> make it all identical.
>
> CC: Joonwoo Park 
> CC: Stanislaw Gruszka 
> CC: Andy Lutomirski 
> CC: Rajat Jain 
> CC: Kirtika Ruchandani 
> Acked-by: Johannes Berg 

Acked-by: Kirtika Ruchandani 

> Signed-off-by: Johannes Berg 
> ---
> I'd appreciate if you (in CC lines) could provide your acked-by here.
> ---
>  drivers/net/wireless/intel/iwlwifi/iwl-io.c   | 41 +++--
>  drivers/net/wireless/intel/iwlwifi/iwl-io.h   | 38 ++--
>  .../wireless/intel/iwlwifi/pcie/internal.h| 44 +--
>  drivers/net/wireless/intel/iwlwifi/pcie/rx.c  | 44 +--
>  drivers/net/wireless/intel/iwlwifi/pcie/tx.c  | 44 +--
>  5 files changed, 192 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-io.c 
> b/drivers/net/wireless/intel/iwlwifi/iwl-io.c
> index 4f10914f6048..ffd1e649bfa0 100644
> --- a/drivers/net/wireless/intel/iwlwifi/iwl-io.c
> +++ b/drivers/net/wireless/intel/iwlwifi/iwl-io.c
> @@ -1,10 +1,13 @@
>  
> /**
> + *
> + * This file is provided under a dual BSD/GPLv2 license.  When using or
> + * redistributing this file, you may do so under either license.
> + *
> + * GPL LICENSE SUMMARY
>   *
>   * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved.
>   * Copyright(c) 2015 - 2016 Intel Deutschland GmbH
>   *
> - * Portions of this file are derived from the ipw3945 project.
> - *
>   * This program is free software; you can redistribute it and/or modify it
>   * under the terms of version 2 of the GNU General Public License as
>   * published by the Free Software Foundation.
> @@ -15,12 +18,44 @@
>   * more details.
>   *
>   * The full GNU General Public License is included in this distribution in 
> the
> - * file called LICENSE.
> + * file called COPYING.
>   *
>   * Contact Information:
>   *  Intel Linux Wireless 
>   * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
>   *
> + * BSD LICENSE
> + *
> + * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved.
> + * Copyright(c) 2015 - 2016 Intel Deutschland GmbH
> + * All rights reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + *
> + *  * Redistributions of source code must retain the above copyright
> + *notice, this list of conditions and the following disclaimer.
> + *  * Redistributions in binary form must reproduce the above copyright
> + *notice, this list of conditions and the following disclaimer in
> + *the documentation and/or other materials provided with the
> + *distribution.
> + *  * Neither the name Intel Corporation nor the names of its
> + *contributors may be used to endorse or promote products de

[PATCH 0/5] Fix -Wunused-but-set-variable in ath10k/

2016-11-24 Thread Kirtika Ruchandani
This patchset is part of the effort led by Arnd Bergmann to clean up
warnings in the kernel. This and following patchsets will focus on
"-Wunused-but-set-variable" as it among the noisier ones. These were
found compiling with W=1.

Kirtika Ruchandani (5):
  ath10k: Remove unused 'buf_len' variable
  ath10k: Remove unused 'num_vdev_stats' variable
  ath10k: Remove unused wmi_p2p_noa_descriptor 'noa' in wmi-tlv
  ath10k: Removed unused 'dev' in ath10k_ahb_clock_enable()
  ath10k: Removed unused 'dev' in ath10k_ahb_resource_init

 drivers/net/wireless/ath/ath10k/ahb.c |  5 -
 drivers/net/wireless/ath/ath10k/wmi-tlv.c |  2 --
 drivers/net/wireless/ath/ath10k/wmi.c | 14 ++
 3 files changed, 2 insertions(+), 19 deletions(-)

--
2.8.0.rc3.226.g39d4020


[PATCH 5/5] ath10k: Removed unused 'dev' in ath10k_ahb_resource_init

2016-11-24 Thread Kirtika Ruchandani
Commit 704dc4e36769 introduced ath10k_ahb_resource_init() which
defines and sets 'struct device* dev' but does not use it.
Compiling with W=1 gives the following warning, fix it.

drivers/net/wireless/ath/ath10k/ahb.c: In function ‘ath10k_ahb_resource_init’:
drivers/net/wireless/ath/ath10k/ahb.c:449:17: warning: variable ‘dev’ set but 
not used [-Wunused-but-set-variable]

This is a harmless warning, and is only being fixed to reduce the
noise with W=1 in the kernel.

Fixes: 704dc4e36769 ("ath10k: add resource init and deinit in ahb")
Cc: Raja Mani <rm...@qti.qualcomm.com>
Cc: Kalle Valo <kv...@qca.qualcomm.com>
Signed-off-by: Kirtika Ruchandani <kirt...@chromium.org>
---
 drivers/net/wireless/ath/ath10k/ahb.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/ahb.c 
b/drivers/net/wireless/ath/ath10k/ahb.c
index 8078d64..19507fe 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.c
+++ b/drivers/net/wireless/ath/ath10k/ahb.c
@@ -443,12 +443,10 @@ static int ath10k_ahb_resource_init(struct ath10k *ar)
 {
struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
struct platform_device *pdev;
-   struct device *dev;
struct resource *res;
int ret;

pdev = ar_ahb->pdev;
-   dev = >dev;

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
--
2.8.0.rc3.226.g39d4020


[PATCH 1/5] ath10k: Remove unused 'buf_len' variable

2016-11-24 Thread Kirtika Ruchandani
Commit 32653cf19554 removed the call to 'skb_trim(skb, buf_len)'
in ath10k_wmi_event_mgmt_rx(), leaving the buf_len variable set but
unused. Compiling with W=1 gives the following warning, fix it.
drivers/net/wireless/ath/ath10k/wmi.c: In function ‘ath10k_wmi_event_mgmt_rx’:
drivers/net/wireless/ath/ath10k/wmi.c:2280:6: warning: variable ‘buf_len’ set 
but not used [-Wunused-but-set-variable]

This is a harmless warning, and is only being fixed to reduce the
noise with W=1 in the kernel.

Fixes: 32653cf19554 ("ath10k: implement intermediate event args")
Cc: Michal Kazior <michal.kaz...@tieto.com>
Cc: Kalle Valo <kv...@qca.qualcomm.com>
Signed-off-by: Kirtika Ruchandani <kirt...@chromium.org>
---
 drivers/net/wireless/ath/ath10k/wmi.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 387c4ee..1f28187 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -2277,7 +2277,6 @@ int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct 
sk_buff *skb)
u32 phy_mode;
u32 snr;
u32 rate;
-   u32 buf_len;
u16 fc;
int ret;

@@ -2289,7 +2288,6 @@ int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct 
sk_buff *skb)
}

channel = __le32_to_cpu(arg.channel);
-   buf_len = __le32_to_cpu(arg.buf_len);
rx_status = __le32_to_cpu(arg.status);
snr = __le32_to_cpu(arg.snr);
phy_mode = __le32_to_cpu(arg.phy_mode);
--
2.8.0.rc3.226.g39d4020


[PATCH 4/5] ath10k: Removed unused 'dev' in ath10k_ahb_clock_enable()

2016-11-24 Thread Kirtika Ruchandani
Commit 8beff219c528 introduced ath10k_ahb_clock_enable() which
defines and sets 'struct device* dev' but does not use it.
Compiling with W=1 gives the following warning, fix it.
drivers/net/wireless/ath/ath10k/ahb.c: In function ‘ath10k_ahb_clock_enable’:
drivers/net/wireless/ath/ath10k/ahb.c:133:17: warning: variable ‘dev’ set but 
not used [-Wunused-but-set-variable]

This is a harmless warning, and is only being fixed to reduce the
noise with W=1 in the kernel.

Fixes: 8beff219c528("ath10k: add clock ctrl related functions in ahb")
Cc: Raja Mani <rm...@qti.qualcomm.com>
Cc: Kalle Valo <kv...@qca.qualcomm.com>
Signed-off-by: Kirtika Ruchandani <kirt...@chromium.org>
---
 drivers/net/wireless/ath/ath10k/ahb.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/ahb.c 
b/drivers/net/wireless/ath/ath10k/ahb.c
index 766c63b..8078d64 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.c
+++ b/drivers/net/wireless/ath/ath10k/ahb.c
@@ -130,11 +130,8 @@ static void ath10k_ahb_clock_deinit(struct ath10k *ar)
 static int ath10k_ahb_clock_enable(struct ath10k *ar)
 {
struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
-   struct device *dev;
int ret;

-   dev = _ahb->pdev->dev;
-
if (IS_ERR_OR_NULL(ar_ahb->cmd_clk) ||
IS_ERR_OR_NULL(ar_ahb->ref_clk) ||
IS_ERR_OR_NULL(ar_ahb->rtc_clk)) {
--
2.8.0.rc3.226.g39d4020


[PATCH 2/5] ath10k: Remove unused 'num_vdev_stats' variable

2016-11-24 Thread Kirtika Ruchandani
Several functions for wmi stats parsing define and set num_vdev_stats
but do not use it. Compiling with W=1 gives the following warnings,
fix them.

drivers/net/wireless/ath/ath10k/wmi.c: In function 
‘ath10k_wmi_main_op_pull_fw_stats’:
drivers/net/wireless/ath/ath10k/wmi.c:2680:22: warning: variable 
‘num_vdev_stats’ set but not used [-Wunused-but-set-variable]
  u32 num_pdev_stats, num_vdev_stats, num_peer_stats;
  ^
drivers/net/wireless/ath/ath10k/wmi.c: In function 
‘ath10k_wmi_10x_op_pull_fw_stats’:
drivers/net/wireless/ath/ath10k/wmi.c:2735:22: warning: variable 
‘num_vdev_stats’ set but not used [-Wunused-but-set-variable]
  u32 num_pdev_stats, num_vdev_stats, num_peer_stats;
  ^
drivers/net/wireless/ath/ath10k/wmi.c: In function 
‘ath10k_wmi_10_2_op_pull_fw_stats’:
drivers/net/wireless/ath/ath10k/wmi.c:2796:6: warning: variable 
‘num_vdev_stats’ set but not used [-Wunused-but-set-variable]
  u32 num_vdev_stats;
  ^
drivers/net/wireless/ath/ath10k/wmi.c: In function 
‘ath10k_wmi_10_2_4_op_pull_fw_stats’:
drivers/net/wireless/ath/ath10k/wmi.c:2875:6: warning: variable 
‘num_vdev_stats’ set but not used [-Wunused-but-set-variable]
  u32 num_vdev_stats;
  ^
drivers/net/wireless/ath/ath10k/wmi.c: In function 
‘ath10k_wmi_10_4_op_pull_fw_stats’:
drivers/net/wireless/ath/ath10k/wmi.c:2963:6: warning: variable 
‘num_vdev_stats’ set but not used [-Wunused-but-set-variable]
  u32 num_vdev_stats;
  ^

These are harmless warnings and are only being fixed to reduce the
noise with W=1 in the kernel.

Fixes: d15fb5200664 ("ath10k: split wmi stats parsing")
Fixes: 20de2229c634 ("ath10k: fix 10.2 fw stats parsing")
Cc: Michal Kazior <michal.kaz...@tieto.com>
Cc: Kalle Valo <kv...@qca.qualcomm.com>
Signed-off-by: Kirtika Ruchandani <kirt...@chromium.org>
---
 drivers/net/wireless/ath/ath10k/wmi.c | 12 ++--
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 1f28187..10ec5a5 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -2675,14 +2675,13 @@ static int ath10k_wmi_main_op_pull_fw_stats(struct 
ath10k *ar,
struct ath10k_fw_stats *stats)
 {
const struct wmi_stats_event *ev = (void *)skb->data;
-   u32 num_pdev_stats, num_vdev_stats, num_peer_stats;
+   u32 num_pdev_stats, num_peer_stats;
int i;

if (!skb_pull(skb, sizeof(*ev)))
return -EPROTO;

num_pdev_stats = __le32_to_cpu(ev->num_pdev_stats);
-   num_vdev_stats = __le32_to_cpu(ev->num_vdev_stats);
num_peer_stats = __le32_to_cpu(ev->num_peer_stats);

for (i = 0; i < num_pdev_stats; i++) {
@@ -2730,14 +2729,13 @@ static int ath10k_wmi_10x_op_pull_fw_stats(struct 
ath10k *ar,
   struct ath10k_fw_stats *stats)
 {
const struct wmi_stats_event *ev = (void *)skb->data;
-   u32 num_pdev_stats, num_vdev_stats, num_peer_stats;
+   u32 num_pdev_stats, num_peer_stats;
int i;

if (!skb_pull(skb, sizeof(*ev)))
return -EPROTO;

num_pdev_stats = __le32_to_cpu(ev->num_pdev_stats);
-   num_vdev_stats = __le32_to_cpu(ev->num_vdev_stats);
num_peer_stats = __le32_to_cpu(ev->num_peer_stats);

for (i = 0; i < num_pdev_stats; i++) {
@@ -2791,7 +2789,6 @@ static int ath10k_wmi_10_2_op_pull_fw_stats(struct ath10k 
*ar,
const struct wmi_10_2_stats_event *ev = (void *)skb->data;
u32 num_pdev_stats;
u32 num_pdev_ext_stats;
-   u32 num_vdev_stats;
u32 num_peer_stats;
int i;

@@ -2800,7 +2797,6 @@ static int ath10k_wmi_10_2_op_pull_fw_stats(struct ath10k 
*ar,

num_pdev_stats = __le32_to_cpu(ev->num_pdev_stats);
num_pdev_ext_stats = __le32_to_cpu(ev->num_pdev_ext_stats);
-   num_vdev_stats = __le32_to_cpu(ev->num_vdev_stats);
num_peer_stats = __le32_to_cpu(ev->num_peer_stats);

for (i = 0; i < num_pdev_stats; i++) {
@@ -2870,7 +2866,6 @@ static int ath10k_wmi_10_2_4_op_pull_fw_stats(struct 
ath10k *ar,
const struct wmi_10_2_stats_event *ev = (void *)skb->data;
u32 num_pdev_stats;
u32 num_pdev_ext_stats;
-   u32 num_vdev_stats;
u32 num_peer_stats;
int i;

@@ -2879,7 +2874,6 @@ static int ath10k_wmi_10_2_4_op_pull_fw_stats(struct 
ath10k *ar,

num_pdev_stats = __le32_to_cpu(ev->num_pdev_stats);
num_pdev_ext_stats = __le32_to_cpu(ev->num_pdev_ext_stats);
-   num_vdev_stats = __le32_to_cpu(ev->num_vdev_stats);
num_peer_stats = __le32_to_cpu(ev->num_peer_stats);

for (i = 0; i < num_pdev_stats; i++) {
@@ -2958,7 +2952,6 @@ static int ath10k_wmi_10_4_op_pull_fw_stats(struct ath10k 
*ar,
const struct 

[PATCH 3/5] ath10k: Remove unused wmi_p2p_noa_descriptor 'noa' in wmi-tlv

2016-11-24 Thread Kirtika Ruchandani
Commit ca996ec56608 (ath10k: implement wmi-tlv backend)
introduced ath10k_wmi_tlv_op_gen_vdev_start() where
'struct wmi_p2p_noa_descriptor *noa' is defined and set but not used.
Compiling with W=1 gives the following warning, fix it.
drivers/net/wireless/ath/ath10k/wmi-tlv.c: In function 
‘ath10k_wmi_tlv_op_gen_vdev_start’:
drivers/net/wireless/ath/ath10k/wmi-tlv.c:1647:33: warning: variable ‘noa’ set 
but not used [-Wunused-but-set-variable]

Fixes: ca996ec56608 ("ath10k: implement wmi-tlv backend")
Cc: Michal Kazior <michal.kaz...@tieto.com>
Cc: Kalle Valo <kv...@qca.qualcomm.com>
Signed-off-by: Kirtika Ruchandani <kirt...@chromium.org>
---
 drivers/net/wireless/ath/ath10k/wmi-tlv.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c 
b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index e64f593..0e4bd29 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -1644,7 +1644,6 @@ ath10k_wmi_tlv_op_gen_vdev_start(struct ath10k *ar,
 {
struct wmi_tlv_vdev_start_cmd *cmd;
struct wmi_channel *ch;
-   struct wmi_p2p_noa_descriptor *noa;
struct wmi_tlv *tlv;
struct sk_buff *skb;
size_t len;
@@ -1702,7 +1701,6 @@ ath10k_wmi_tlv_op_gen_vdev_start(struct ath10k *ar,
tlv = ptr;
tlv->tag = __cpu_to_le16(WMI_TLV_TAG_ARRAY_STRUCT);
tlv->len = 0;
-   noa = (void *)tlv->value;

/* Note: This is a nested TLV containing:
 * [wmi_tlv][wmi_p2p_noa_descriptor][wmi_tlv]..
--
2.8.0.rc3.226.g39d4020


[PATCH] adm80211: Removed unused 'io_addr' 'mem_addr' variables

2016-11-23 Thread Kirtika Ruchandani
Initial commit cc0b88cf5ecf ([PATCH] Add adm8211 802.11b wireless driver)
introduced variables mem_addr and io_addr in adm80211_probe() that are
set but not used. Compiling with W=1 gives the following warnings,
fix them.

drivers/net/wireless/admtek/adm8211.c: In function ‘adm8211_probe’:
drivers/net/wireless/admtek/adm8211.c:1769:15: warning: variable ‘io_addr’ set 
but not used [-Wunused-but-set-variable]
  unsigned int io_addr, io_len;
   ^
drivers/net/wireless/admtek/adm8211.c:1768:16: warning: variable ‘mem_addr’ set 
but not used [-Wunused-but-set-variable]
  unsigned long mem_addr, mem_len;
^

These are harmless warnings and are only being fixed to reduce the
noise with W=1 in the kernel. The calls to pci_resource_start do not
have any side-effects and are safe to remove.

Fixes: cc0b88cf5ecf ("[PATCH] Add adm8211 802.11b wireless driver")
Cc: Michael Wu <flaming...@sourmilk.net>
Cc: John W. Linville <linvi...@tuxdriver.com>
Signed-off-by: Kirtika Ruchandani <kirt...@chromium.org>
---
 drivers/net/wireless/admtek/adm8211.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/admtek/adm8211.c 
b/drivers/net/wireless/admtek/adm8211.c
index 70ecd82..70b4da0 100644
--- a/drivers/net/wireless/admtek/adm8211.c
+++ b/drivers/net/wireless/admtek/adm8211.c
@@ -1765,8 +1765,8 @@ static int adm8211_probe(struct pci_dev *pdev,
 {
struct ieee80211_hw *dev;
struct adm8211_priv *priv;
-   unsigned long mem_addr, mem_len;
-   unsigned int io_addr, io_len;
+   unsigned long mem_len;
+   unsigned int io_len;
int err;
u32 reg;
u8 perm_addr[ETH_ALEN];
@@ -1778,9 +1778,7 @@ static int adm8211_probe(struct pci_dev *pdev,
return err;
}

-   io_addr = pci_resource_start(pdev, 0);
io_len = pci_resource_len(pdev, 0);
-   mem_addr = pci_resource_start(pdev, 1);
mem_len = pci_resource_len(pdev, 1);
if (io_len < 256 || mem_len < 1024) {
printk(KERN_ERR "%s (adm8211): Too short PCI resources\n",
--
2.8.0.rc3.226.g39d4020


[PATCH 3/4] mac80211: Removed unused 'struct ieee80211_supported_band*' variable

2016-11-23 Thread Kirtika Ruchandani
Commit b1bce14a7954 (mac80211: update opmode when adding new station)
refactored ieee80211_vht_handle_opmode into __ieee80211_vht_handle_opmode
and ieee80211_vht_handle_opmode leaving a set but unused variable
(sband) in the former. Compiling with W=1 gives the following warning,
fix it.

net/mac80211/vht.c: In function ‘__ieee80211_vht_handle_opmode’:
net/mac80211/vht.c:424:35: warning: variable ‘sband’ set but not used 
[-Wunused-but-set-variable]

Remove 'struct ieee80211_local* local' as well, it was only used to
set sband.

This is a harmless warning, and is only being fixed to reduce the
noise with W=1 in the kernel.

Fixes: b1bce14a7954 ("mac80211: update opmode when adding new station")
Cc: Marek Kwaczynski <marek.kwaczyn...@tieto.com>
Cc: Johannes Berg <johannes.b...@intel.com>
Signed-off-by: Kirtika Ruchandani <kirt...@chromium.org>
---
 net/mac80211/vht.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/net/mac80211/vht.c b/net/mac80211/vht.c
index ee71576..14920e3 100644
--- a/net/mac80211/vht.c
+++ b/net/mac80211/vht.c
@@ -420,14 +420,10 @@ u32 __ieee80211_vht_handle_opmode(struct 
ieee80211_sub_if_data *sdata,
  struct sta_info *sta, u8 opmode,
  enum nl80211_band band)
 {
-   struct ieee80211_local *local = sdata->local;
-   struct ieee80211_supported_band *sband;
enum ieee80211_sta_rx_bandwidth new_bw;
u32 changed = 0;
u8 nss;
 
-   sband = local->hw.wiphy->bands[band];
-
/* ignore - no support for BF yet */
if (opmode & IEEE80211_OPMODE_NOTIF_RX_NSS_TYPE_BF)
return 0;
-- 
2.8.0.rc3.226.g39d4020



[PATCH 4/4] mac80211: Remove unused 'beaconint_us' variable

2016-11-23 Thread Kirtika Ruchandani
Commit 4a733ef1bea7 (mac80211: remove PM-QoS listener) removed all use
of 'beaconint_us' from ieee80211_recalc_ps() but left the variable
intact. Compiling with W=1 gives the following warning, fix it.
net/mac80211/mlme.c: In function ‘ieee80211_recalc_ps’:
net/mac80211/mlme.c:1481:7: warning: variable ‘beaconint_us’ set but not used 
[-Wunused-but-set-variable]

iee80211_tu_to_usec has no side-effects and is safe to remove.

Fixes: 4a733ef1bea7 ("mac80211: remove PM-QoS listener")
Cc: Johannes Berg <johannes.b...@intel.com>
Signed-off-by: Kirtika Ruchandani <kirt...@chromium.org>
---
 net/mac80211/mlme.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 7486f2d..e883345 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1478,10 +1478,6 @@ void ieee80211_recalc_ps(struct ieee80211_local *local)
 
if (count == 1 && ieee80211_powersave_allowed(found)) {
u8 dtimper = found->u.mgd.dtim_period;
-   s32 beaconint_us;
-
-   beaconint_us = ieee80211_tu_to_usec(
-   found->vif.bss_conf.beacon_int);
 
timeout = local->dynamic_ps_forced_timeout;
if (timeout < 0)
-- 
2.8.0.rc3.226.g39d4020



[PATCH 1/4] mac80211: Removed unused 'i' variable

2016-11-23 Thread Kirtika Ruchandani
Commit 5bcae31d9 (mac80211: implement multi-vif in-place reservations)
introduced ieee80211_vif_use_reserved_switch() with a counter variable
'i' that is set but not used. Compiling with W=1 gives the following
warning, fix it.
net/mac80211/chan.c: In function ‘ieee80211_vif_use_reserved_switch’:
net/mac80211/chan.c:1273:6: warning: variable ‘i’ set but not used 
[-Wunused-but-set-variable]

This is a harmless warning, and is only being fixed to reduce the
noise obtained with W=1 in the kernel.

Fixes: 5bcae31d9 ("mac80211: implement multi-vif in-place reservations")
Cc: Michal Kazior <michal.kaz...@tieto.com>
Cc: Johannes Berg <johannes.b...@intel.com>
Signed-off-by: Kirtika Ruchandani <kirt...@chromium.org>
---
 net/mac80211/chan.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
index e75cbf6..7550fd2 100644
--- a/net/mac80211/chan.c
+++ b/net/mac80211/chan.c
@@ -1270,7 +1270,7 @@ static int ieee80211_vif_use_reserved_switch(struct 
ieee80211_local *local)
struct ieee80211_sub_if_data *sdata, *sdata_tmp;
struct ieee80211_chanctx *ctx, *ctx_tmp, *old_ctx;
struct ieee80211_chanctx *new_ctx = NULL;
-   int i, err, n_assigned, n_reserved, n_ready;
+   int err, n_assigned, n_reserved, n_ready;
int n_ctx = 0, n_vifs_switch = 0, n_vifs_assign = 0, n_vifs_ctxless = 0;
 
lockdep_assert_held(>mtx);
@@ -1391,8 +1391,6 @@ static int ieee80211_vif_use_reserved_switch(struct 
ieee80211_local *local)
 * Update all structures, values and pointers to point to new channel
 * context(s).
 */
-
-   i = 0;
list_for_each_entry(ctx, >chanctx_list, list) {
if (ctx->replace_state != IEEE80211_CHANCTX_REPLACES_OTHER)
continue;
-- 
2.8.0.rc3.226.g39d4020



[PATCH 2/4] mac80211: Remove unused 'len' variable

2016-11-23 Thread Kirtika Ruchandani
Commit 633e27132625 (mac80211: split sched scan IEs) introduced the
len variable to keep track of the return value of
ieee80211_build_preq_ies() but did not use it. Compiling with W=1
gives the following warning, fix it.

net/mac80211/scan.c: In function ‘__ieee80211_request_sched_scan_start’:
net/mac80211/scan.c:1123:9: warning: variable ‘len’ set but not used 
[-Wunused-but-set-variable]

This is a harmless warning and is only being fixed to reduce the noise
with W=1 in the kernel.

Fixes: 633e27132625 ("mac80211: split sched scan IEs")
Cc: David Spinadel <david.spina...@intel.com>
Cc: Alexander Bondar <alexander.bon...@intel.com>
Cc: Johannes Berg <johannes.b...@intel.com>
Signed-off-by: Kirtika Ruchandani <kirt...@chromium.org>
---
 net/mac80211/scan.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index 23d8ac8..faab3c4 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -1120,7 +1120,6 @@ int __ieee80211_request_sched_scan_start(struct 
ieee80211_sub_if_data *sdata,
u32 rate_masks[NUM_NL80211_BANDS] = {};
u8 bands_used = 0;
u8 *ie;
-   size_t len;
 
iebufsz = local->scan_ies_len + req->ie_len;
 
@@ -1145,10 +1144,9 @@ int __ieee80211_request_sched_scan_start(struct 
ieee80211_sub_if_data *sdata,
 
ieee80211_prepare_scan_chandef(, req->scan_width);
 
-   len = ieee80211_build_preq_ies(local, ie, num_bands * iebufsz,
-  _scan_ies, req->ie,
-  req->ie_len, bands_used,
-  rate_masks, );
+   ieee80211_build_preq_ies(local, ie, num_bands * iebufsz,
+_scan_ies, req->ie,
+req->ie_len, bands_used, rate_masks, );
 
ret = drv_sched_scan_start(local, sdata, req, _scan_ies);
if (ret == 0) {
-- 
2.8.0.rc3.226.g39d4020



[PATCH 0/4] Fix -Wunused-but-set-variable in net/mac80211/

2016-11-23 Thread Kirtika Ruchandani
This patchset is part of the effort led by Arnd Bergmann to clean up
warnings in the kernel. This and following patchsets will focus on
"-Wunused-but-set-variable" as it among the noisier ones. These were
found compiling with W=1.

Kirtika Ruchandani (4):
  mac80211: Removed unused 'i' variable
  mac80211: Remove unused 'len' variable
  mac80211: Removed unused 'struct ieee80211_supported_band*' variable
  mac80211: Remove unused 'beaconint_us' variable

 net/mac80211/chan.c | 4 +---
 net/mac80211/mlme.c | 4 
 net/mac80211/scan.c | 8 +++-
 net/mac80211/vht.c  | 4 
 4 files changed, 4 insertions(+), 16 deletions(-)

-- 
2.8.0.rc3.226.g39d4020



[PATCH v2 7/7] mwifiex: Remove unused 'bcd_usb' variable

2016-11-23 Thread Kirtika Ruchandani
mwifiex_usb_probe() defines and sets bcd_usb but does not use it,
Compiling with W=1 gives the following warning, fix it.
mwifiex/usb.c: In function ‘mwifiex_usb_probe’:
mwifiex/usb.c:383:41: warning: variable ‘bcd_usb’ set but not used 
[-Wunused-but-set-variable]

The unused variable seems to be present since 4daffe354366 which introduced
mwifiex_usb_probe().

Fixes: 4daffe354366 ("mwifiex: add support for Marvell USB8797 chipset")
Cc: Amitkumar Karwar <akar...@marvell.com>
Signed-off-by: Kirtika Ruchandani <kirt...@google.com>
---
 drivers/net/wireless/marvell/mwifiex/usb.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/usb.c 
b/drivers/net/wireless/marvell/mwifiex/usb.c
index c3f696a..c563160 100644
--- a/drivers/net/wireless/marvell/mwifiex/usb.c
+++ b/drivers/net/wireless/marvell/mwifiex/usb.c
@@ -379,7 +379,7 @@ static int mwifiex_usb_probe(struct usb_interface *intf,
struct usb_endpoint_descriptor *epd;
int ret, i;
struct usb_card_rec *card;
-   u16 id_vendor, id_product, bcd_device, bcd_usb;
+   u16 id_vendor, id_product, bcd_device;
 
card = devm_kzalloc(>dev, sizeof(*card), GFP_KERNEL);
if (!card)
@@ -390,7 +390,6 @@ static int mwifiex_usb_probe(struct usb_interface *intf,
id_vendor = le16_to_cpu(udev->descriptor.idVendor);
id_product = le16_to_cpu(udev->descriptor.idProduct);
bcd_device = le16_to_cpu(udev->descriptor.bcdDevice);
-   bcd_usb = le16_to_cpu(udev->descriptor.bcdUSB);
pr_debug("info: VID/PID = %X/%X, Boot2 version = %X\n",
 id_vendor, id_product, bcd_device);
 
-- 
2.8.0.rc3.226.g39d4020



[PATCH v2 5/7] mwifiex: Remove unused 'pm_flag' variable

2016-11-23 Thread Kirtika Ruchandani
mwifiex_sdio_resume() intializes pm_flag, just like
mwifiex_sdio_suspend(), but does not use it. Compiling with W=1 gives
the following warning, fix it.
mwifiex/sdio.c: In function ‘mwifiex_sdio_resume’:
mwifiex/sdio.c:234:16: warning: variable ‘pm_flag’ set but not used 
[-Wunused-but-set-variable]

sdio_get_host_pm_caps() is just an acessor, so the call to it is safe
to remove. The unused variable seems to be present since
5e6e3a92b9a4 which introduced mwifiex_sdio_resume().

Fixes: 5e6e3a92b9a4 ("wireless: mwifiex: initial commit for Marvell mwifiex 
driver")
Cc: Bing Zhao <bz...@marvell.com>
Cc: Amitkumar Karwar <akar...@marvell.com>
Signed-off-by: Kirtika Ruchandani <kirt...@google.com>
---
 drivers/net/wireless/marvell/mwifiex/sdio.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c 
b/drivers/net/wireless/marvell/mwifiex/sdio.c
index 0d00db5..6c9f16e 100644
--- a/drivers/net/wireless/marvell/mwifiex/sdio.c
+++ b/drivers/net/wireless/marvell/mwifiex/sdio.c
@@ -186,9 +186,7 @@ static int mwifiex_sdio_resume(struct device *dev)
struct sdio_func *func = dev_to_sdio_func(dev);
struct sdio_mmc_card *card;
struct mwifiex_adapter *adapter;
-   mmc_pm_flag_t pm_flag = 0;
 
-   pm_flag = sdio_get_host_pm_caps(func);
card = sdio_get_drvdata(func);
if (!card || !card->adapter) {
dev_err(dev, "resume: invalid card or adapter\n");
-- 
2.8.0.rc3.226.g39d4020



[PATCH v2 6/7] mwifiex: Removed unused 'pkt_type' variable

2016-11-23 Thread Kirtika Ruchandani
Commit 92263a841b15 introduced mwifiex_deaggr_sdio_pkt which initializes
variable pkt_type but does not use it. Compiling with W=1 gives the following
warning, fix it.
mwifiex/sdio.c: In function ‘mwifiex_deaggr_sdio_pkt’:
mwifiex/sdio.c:1198:6: warning: variable ‘pkt_type’ set but not used 
[-Wunused-but-set-variable]

Fixes: 92263a841b15 ("mwifiex: add SDIO rx single port aggregation")
Cc: Zhaoyang Liu <li...@marvell.com>
Cc: Amitkumar Karwar <akar...@marvell.com>
Signed-off-by: Kirtika Ruchandani <kirt...@google.com>
---
 drivers/net/wireless/marvell/mwifiex/sdio.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c 
b/drivers/net/wireless/marvell/mwifiex/sdio.c
index 6c9f16e..09c586f 100644
--- a/drivers/net/wireless/marvell/mwifiex/sdio.c
+++ b/drivers/net/wireless/marvell/mwifiex/sdio.c
@@ -1134,7 +1134,6 @@ static void mwifiex_deaggr_sdio_pkt(struct 
mwifiex_adapter *adapter,
 {
u32 total_pkt_len, pkt_len;
struct sk_buff *skb_deaggr;
-   u32 pkt_type;
u16 blk_size;
u8 blk_num;
u8 *data;
@@ -1155,8 +1154,6 @@ static void mwifiex_deaggr_sdio_pkt(struct 
mwifiex_adapter *adapter,
break;
}
pkt_len = le16_to_cpu(*(__le16 *)(data + SDIO_HEADER_OFFSET));
-   pkt_type = le16_to_cpu(*(__le16 *)(data + SDIO_HEADER_OFFSET +
-2));
if ((pkt_len + SDIO_HEADER_OFFSET) > blk_size) {
mwifiex_dbg(adapter, ERROR,
"%s: error in pkt_len,\t"
-- 
2.8.0.rc3.226.g39d4020



[PATCH v2 3/7] mwifiex: Remove unused 'sta_ptr' variable

2016-11-23 Thread Kirtika Ruchandani
Commit 429d90d2212b introduced mwifiex_cmd_tdls_oper() which initializes
struct mwifiex_sta_node* sta_ptr, but does not use it. Compiling with W=1 gives
the following warning, fix it.
mwifiex/sta_cmd.c: In function ‘mwifiex_cmd_tdls_oper’:
mwifiex/sta_cmd.c:1732:27: warning: variable ‘sta_ptr’ set but not used 
[-Wunused-but-set-variable]

Fixes: 429d90d2212b ("mwifiex: add cfg80211 tdls_oper handler support")
Cc: Avinash Patil <pat...@marvell.com>
Signed-off-by: Kirtika Ruchandani <kirt...@google.com>
---
 drivers/net/wireless/marvell/mwifiex/sta_cmd.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c 
b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
index bcd6408..768c519 100644
--- a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
+++ b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
@@ -1746,7 +1746,6 @@ mwifiex_cmd_tdls_oper(struct mwifiex_private *priv,
 {
struct host_cmd_ds_tdls_oper *tdls_oper = >params.tdls_oper;
struct mwifiex_ds_tdls_oper *oper = data_buf;
-   struct mwifiex_sta_node *sta_ptr;
struct host_cmd_tlv_rates *tlv_rates;
struct mwifiex_ie_types_htcap *ht_capab;
struct mwifiex_ie_types_qos_info *wmm_qos_info;
@@ -1764,7 +1763,6 @@ mwifiex_cmd_tdls_oper(struct mwifiex_private *priv,
 
tdls_oper->reason = 0;
memcpy(tdls_oper->peer_mac, oper->peer_mac, ETH_ALEN);
-   sta_ptr = mwifiex_get_sta_entry(priv, oper->peer_mac);
 
pos = (u8 *)tdls_oper + sizeof(struct host_cmd_ds_tdls_oper);
 
-- 
2.8.0.rc3.226.g39d4020



[PATCH v2 4/7] mwifiex: Remove unused 'adapter'variable

2016-11-23 Thread Kirtika Ruchandani
Commit 3935ccc14d2c introduced mwifiex_tm_cmd() which initializes
struct mwifiex_adapter* adapter, but doesn't use it.
Compiling with W=1 gives the following warning, fix it.
mwifiex/cfg80211.c: In function ‘mwifiex_tm_cmd’:
mwifiex/cfg80211.c:3973:26: warning: variable ‘adapter’ set but not used 
[-Wunused-but-set-variable]

Fixes: 3935ccc14d2c ("mwifiex: add cfg80211 testmode support")
Cc: Xinming Hu <h...@marvell.com>
Cc: Amitkumar Karwar <akar...@marvell.com>
Signed-off-by: Kirtika Ruchandani <kirt...@google.com>
---
 drivers/net/wireless/marvell/mwifiex/cfg80211.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c 
b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index c26469a..a231f09 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -3980,13 +3980,11 @@ static int mwifiex_tm_cmd(struct wiphy *wiphy, struct 
wireless_dev *wdev,
struct mwifiex_private *priv = mwifiex_netdev_get_priv(wdev->netdev);
struct mwifiex_ds_misc_cmd *hostcmd;
struct nlattr *tb[MWIFIEX_TM_ATTR_MAX + 1];
-   struct mwifiex_adapter *adapter;
struct sk_buff *skb;
int err;
 
if (!priv)
return -EINVAL;
-   adapter = priv->adapter;
 
err = nla_parse(tb, MWIFIEX_TM_ATTR_MAX, data, len,
mwifiex_tm_policy);
-- 
2.8.0.rc3.226.g39d4020



[PATCH v2 2/7] mwifiex: Remove unused 'chan_num' variable

2016-11-23 Thread Kirtika Ruchandani
Commit b5413e6b2228 removed all uses of chan_num in mwifiex_config_scan().
Compiling mwifiex with W=1 gives the following warning, fix it.

mwifiex/scan.c: In function ‘mwifiex_config_scan’:
mwifiex/scan.c:830:6: warning: variable ‘chan_num’ set but not used 
[-Wunused-but-set-variable]

Fixes: b5413e6b2228 ("mwifiex: increase the number of nodes in command pool")
Cc: Amitkumar Karwar <akar...@marvell.com>
Signed-off-by: Kirtika Ruchandani <kirt...@google.com>
---
 drivers/net/wireless/marvell/mwifiex/scan.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/scan.c 
b/drivers/net/wireless/marvell/mwifiex/scan.c
index 98ce072..1816916 100644
--- a/drivers/net/wireless/marvell/mwifiex/scan.c
+++ b/drivers/net/wireless/marvell/mwifiex/scan.c
@@ -827,7 +827,6 @@ mwifiex_config_scan(struct mwifiex_private *priv,
u32 num_probes;
u32 ssid_len;
u32 chan_idx;
-   u32 chan_num;
u32 scan_type;
u16 scan_dur;
u8 channel;
@@ -1105,13 +1104,12 @@ mwifiex_config_scan(struct mwifiex_private *priv,
mwifiex_dbg(adapter, INFO,
"info: Scan: Scanning current channel 
only\n");
}
-   chan_num = chan_idx;
} else {
mwifiex_dbg(adapter, INFO,
"info: Scan: Creating full region channel list\n");
-   chan_num = mwifiex_scan_create_channel_list(priv, user_scan_in,
-   scan_chan_list,
-   *filtered_scan);
+   mwifiex_scan_create_channel_list(priv, user_scan_in,
+scan_chan_list,
+*filtered_scan);
}
 
 }
-- 
2.8.0.rc3.226.g39d4020



[PATCH v2 1/7] mwifiex: Removed unused mwifiex_private* 'priv' variable

2016-11-23 Thread Kirtika Ruchandani
Commit bec568ff5107 removed the last remaining usage of struct
mwifiex_private* priv in mwifiex_fw_dpc(), by removing the call to
mwifiex_del_virtual_intf().
Compiling mwifiex/ with W=1 gives the following warning, fix it.
mwifiex/main.c: In function ‘mwifiex_fw_dpc’:
mwifiex/main.c:520:26: warning: variable ‘priv’ set but not used 
[-Wunused-but-set-variable]

Fixes: bec568ff5107 ("mwifiex: failure path handling in 
mwifiex_add_virtual_intf()")
Cc: Amitkumar Karwar <akar...@marvell.com>
Signed-off-by: Kirtika Ruchandani <kirt...@google.com>
---
 drivers/net/wireless/marvell/mwifiex/main.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/main.c 
b/drivers/net/wireless/marvell/mwifiex/main.c
index eac44fe..e5c3a8a 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.c
+++ b/drivers/net/wireless/marvell/mwifiex/main.c
@@ -518,7 +518,6 @@ static void mwifiex_fw_dpc(const struct firmware *firmware, 
void *context)
 {
int ret;
char fmt[64];
-   struct mwifiex_private *priv;
struct mwifiex_adapter *adapter = context;
struct mwifiex_fw_image fw;
bool init_failed = false;
@@ -576,8 +575,6 @@ static void mwifiex_fw_dpc(const struct firmware *firmware, 
void *context)
goto err_init_fw;
}
 
-   priv = adapter->priv[MWIFIEX_BSS_ROLE_STA];
-
if (!adapter->wiphy) {
if (mwifiex_register_cfg80211(adapter)) {
mwifiex_dbg(adapter, ERROR,
-- 
2.8.0.rc3.226.g39d4020



[PATCH] mac80211: Remove unused 'struct rate_control_ref' variable

2016-11-21 Thread Kirtika Ruchandani
Commit 3b17fbf87d5d introduced sta_get_expected_throughput()
leaving variable 'struct rate_control_ref* ref' set but unused.
Compiling with W=1 gives the following warning, fix it.

net/mac80211/sta_info.c: In function ‘sta_set_sinfo’:
net/mac80211/sta_info.c:2052:27: warning: variable ‘ref’ set but not used 
[-Wunused-but-set-variable]

Fixes: 3b17fbf87d5d ("mac80211: mesh: Add support for HW RC implementation")
Cc: Johannes Berg <johannes.b...@intel.com>
Cc: Maxim Altshul <maxim.alts...@ti.com>
Signed-off-by: Kirtika Ruchandani <kirt...@google.com>
---
 net/mac80211/sta_info.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 1711bae..4ab75a9 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -2049,16 +2049,12 @@ void sta_set_sinfo(struct sta_info *sta, struct 
station_info *sinfo)
 {
struct ieee80211_sub_if_data *sdata = sta->sdata;
struct ieee80211_local *local = sdata->local;
-   struct rate_control_ref *ref = NULL;
u32 thr = 0;
int i, ac, cpu;
struct ieee80211_sta_rx_stats *last_rxstats;

last_rxstats = sta_get_last_rx_stats(sta);

-   if (test_sta_flag(sta, WLAN_STA_RATE_CONTROL))
-   ref = local->rate_ctrl;
-
sinfo->generation = sdata->local->sta_generation;

/* do before driver, so beacon filtering drivers have a
--
2.8.0.rc3.226.g39d4020



[PATCH] mac80211: Remove unused 'rates_idx' variable

2016-11-21 Thread Kirtika Ruchandani
Commit f027c2aca0cf introduced 'rates_idx' in
ieee80211_tx_status_noskb but did not use it. Compiling with W=1
gives the following warning, fix it.

mac80211/status.c: In function ‘ieee80211_tx_status_noskb’:
mac80211/status.c:636:6: warning: variable ‘rates_idx’ set but not used 
[-Wunused-but-set-variable]

This is a harmless warning, and is only being fixed to reduce the
noise generated with W=1.

Fixes: f027c2aca0cf ("mac80211: add ieee80211_tx_status_noskb")
Cc: Johannes Berg <johannes.b...@intel.com>
Cc: Felix Fietkau <n...@openwrt.org>
Signed-off-by: Kirtika Ruchandani <kirt...@google.com>
---
 net/mac80211/status.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/mac80211/status.c b/net/mac80211/status.c
index ddf71c6..f7c5ae5 100644
--- a/net/mac80211/status.c
+++ b/net/mac80211/status.c
@@ -633,10 +633,9 @@ void ieee80211_tx_status_noskb(struct ieee80211_hw *hw,
struct ieee80211_local *local = hw_to_local(hw);
struct ieee80211_supported_band *sband;
int retry_count;
-   int rates_idx;
bool acked, noack_success;

-   rates_idx = ieee80211_tx_get_rates(hw, info, _count);
+   ieee80211_tx_get_rates(hw, info, _count);

sband = hw->wiphy->bands[info->band];

--
2.8.0.rc3.226.g39d4020



[PATCH] mac80211: Remove unused 'struct ieee80211_rx_status' ptr

2016-11-21 Thread Kirtika Ruchandani
Commit 554891e63a29 introduced 'struct ieee80211_rx_status' in
ieee80211_rx_h_defragment but did not use it. Compiling with W=1
gives the following warning, fix it.

net/mac80211/rx.c: In function ‘ieee80211_rx_h_defragment’:
net/mac80211/rx.c:1911:30: warning: variable ‘status’ set but not used 
[-Wunused-but-set-variable]

Fixes: 554891e63a29 ("mac80211: move packet flags into packet")
Cc: Johannes Berg <johannes.b...@intel.com>
Cc: John W. Linville <linvi...@tuxdriver.com>
Signed-off-by: Kirtika Ruchandani <kirt...@google.com>
---
 net/mac80211/rx.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index eeab725..d2a00f2 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -1908,7 +1908,6 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx)
unsigned int frag, seq;
struct ieee80211_fragment_entry *entry;
struct sk_buff *skb;
-   struct ieee80211_rx_status *status;

hdr = (struct ieee80211_hdr *)rx->skb->data;
fc = hdr->frame_control;
@@ -2034,9 +2033,6 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx)
dev_kfree_skb(skb);
}

-   /* Complete frame has been reassembled - process it now */
-   status = IEEE80211_SKB_RXCB(rx->skb);
-
  out:
ieee80211_led_rx(rx->local);
  out_no_led:
--
2.8.0.rc3.226.g39d4020



[PATCH 6/7] mwifiex: Removed unused 'pkt_type' variable

2016-11-18 Thread Kirtika Ruchandani
Commit 92263a841b15 introduced mwifiex_deaggr_sdio_pkt which initializes
variable pkt_type but does not use it. Compiling with W=1 gives the following
warning, fix it.
mwifiex/sdio.c: In function ‘mwifiex_deaggr_sdio_pkt’:
mwifiex/sdio.c:1198:6: warning: variable ‘pkt_type’ set but not used 
[-Wunused-but-set-variable]

Fixes: 92263a841b15 ("mwifiex: add SDIO rx single port aggregation")
Cc: Zhaoyang Liu <li...@marvell.com>
Cc: Amitkumar Karwar <akar...@marvell.com>
Signed-off-by: Kirtika Ruchandani <kirt...@google.com>
---
 drivers/net/wireless/marvell/mwifiex/sdio.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c 
b/drivers/net/wireless/marvell/mwifiex/sdio.c
index 41ec59d7..4028a8c 100644
--- a/drivers/net/wireless/marvell/mwifiex/sdio.c
+++ b/drivers/net/wireless/marvell/mwifiex/sdio.c
@@ -1193,7 +1193,6 @@ static void mwifiex_deaggr_sdio_pkt(struct 
mwifiex_adapter *adapter,
 {
u32 total_pkt_len, pkt_len;
struct sk_buff *skb_deaggr;
-   u32 pkt_type;
u16 blk_size;
u8 blk_num;
u8 *data;
@@ -1214,8 +1213,6 @@ static void mwifiex_deaggr_sdio_pkt(struct 
mwifiex_adapter *adapter,
break;
}
pkt_len = le16_to_cpu(*(__le16 *)(data + SDIO_HEADER_OFFSET));
-   pkt_type = le16_to_cpu(*(__le16 *)(data + SDIO_HEADER_OFFSET +
-2));
if ((pkt_len + SDIO_HEADER_OFFSET) > blk_size) {
mwifiex_dbg(adapter, ERROR,
"%s: error in pkt_len,\t"
--
2.8.0.rc3.226.g39d4020



[PATCH 7/7] mwifiex: Remove unused 'bcd_usb' variable

2016-11-18 Thread Kirtika Ruchandani
mwifiex_usb_probe() defines and sets bcd_usb but does not use it,
Compiling with W=1 gives the following warning, fix it.
mwifiex/usb.c: In function ‘mwifiex_usb_probe’:
mwifiex/usb.c:383:41: warning: variable ‘bcd_usb’ set but not used 
[-Wunused-but-set-variable]

The unused variable seems to be present since 4daffe354366 which introduced
mwifiex_usb_probe().

Fixes: 4daffe354366 ("mwifiex: add support for Marvell USB8797 chipset")
Cc: Amitkumar Karwar <akar...@marvell.com>
Signed-off-by: Kirtika Ruchandani <kirt...@google.com>
---
 drivers/net/wireless/marvell/mwifiex/usb.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/usb.c 
b/drivers/net/wireless/marvell/mwifiex/usb.c
index 73eb084..67a15c1 100644
--- a/drivers/net/wireless/marvell/mwifiex/usb.c
+++ b/drivers/net/wireless/marvell/mwifiex/usb.c
@@ -380,7 +380,7 @@ static int mwifiex_usb_probe(struct usb_interface *intf,
struct usb_endpoint_descriptor *epd;
int ret, i;
struct usb_card_rec *card;
-   u16 id_vendor, id_product, bcd_device, bcd_usb;
+   u16 id_vendor, id_product, bcd_device;

card = kzalloc(sizeof(struct usb_card_rec), GFP_KERNEL);
if (!card)
@@ -389,7 +389,6 @@ static int mwifiex_usb_probe(struct usb_interface *intf,
id_vendor = le16_to_cpu(udev->descriptor.idVendor);
id_product = le16_to_cpu(udev->descriptor.idProduct);
bcd_device = le16_to_cpu(udev->descriptor.bcdDevice);
-   bcd_usb = le16_to_cpu(udev->descriptor.bcdUSB);
pr_debug("info: VID/PID = %X/%X, Boot2 version = %X\n",
 id_vendor, id_product, bcd_device);

--
2.8.0.rc3.226.g39d4020



[PATCH 5/7] mwifiex: Remove unused 'pm_flag' variable

2016-11-18 Thread Kirtika Ruchandani
mwifiex_sdio_resume() intializes pm_flag, just like mwifiex_sdio_suspend(), but
does not use it. Compiling with W=1 gives the following warning, fix it.
mwifiex/sdio.c: In function ‘mwifiex_sdio_resume’:
mwifiex/sdio.c:234:16: warning: variable ‘pm_flag’ set but not used 
[-Wunused-but-set-variable]

sdio_get_host_pm_caps() is just an acessor, so the call to it is safe to
remove.
The unused variable seems to be present since 5e6e3a92b9a4 which introduced
mwifiex_sdio_resume().

Fixes: 5e6e3a92b9a4 ("wireless: mwifiex: initial commit for Marvell mwifiex 
driver")
Cc: Bing Zhao <bz...@marvell.com>
Cc: Amitkumar Karwar <akar...@marvell.com>
Signed-off-by: Kirtika Ruchandani <kirt...@google.com>
---
 drivers/net/wireless/marvell/mwifiex/sdio.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c 
b/drivers/net/wireless/marvell/mwifiex/sdio.c
index 8718950..41ec59d7 100644
--- a/drivers/net/wireless/marvell/mwifiex/sdio.c
+++ b/drivers/net/wireless/marvell/mwifiex/sdio.c
@@ -231,10 +231,8 @@ static int mwifiex_sdio_resume(struct device *dev)
struct sdio_func *func = dev_to_sdio_func(dev);
struct sdio_mmc_card *card;
struct mwifiex_adapter *adapter;
-   mmc_pm_flag_t pm_flag = 0;

if (func) {
-   pm_flag = sdio_get_host_pm_caps(func);
card = sdio_get_drvdata(func);
if (!card || !card->adapter) {
pr_err("resume: invalid card or adapter\n");
--
2.8.0.rc3.226.g39d4020



[PATCH 4/7] mwifiex: Remove unused 'adapter'variable

2016-11-18 Thread Kirtika Ruchandani
Commit 3935ccc14d2c introduced mwifiex_tm_cmd() which initializes
struct mwifiex_adapter* adapter, but doesn't use it.
Compiling with W=1 gives the following warning, fix it.
mwifiex/cfg80211.c: In function ‘mwifiex_tm_cmd’:
mwifiex/cfg80211.c:3973:26: warning: variable ‘adapter’ set but not used 
[-Wunused-but-set-variable]

Fixes: 3935ccc14d2c ("mwifiex: add cfg80211 testmode support")
Cc: Xinming Hu <h...@marvell.com>
Cc: Amitkumar Karwar <akar...@marvell.com>
Signed-off-by: Kirtika Ruchandani <kirt...@google.com>
---
 drivers/net/wireless/marvell/mwifiex/cfg80211.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c 
b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index 39ce76a..dd93cda 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -3970,13 +3970,11 @@ static int mwifiex_tm_cmd(struct wiphy *wiphy, struct 
wireless_dev *wdev,
struct mwifiex_private *priv = mwifiex_netdev_get_priv(wdev->netdev);
struct mwifiex_ds_misc_cmd *hostcmd;
struct nlattr *tb[MWIFIEX_TM_ATTR_MAX + 1];
-   struct mwifiex_adapter *adapter;
struct sk_buff *skb;
int err;

if (!priv)
return -EINVAL;
-   adapter = priv->adapter;

err = nla_parse(tb, MWIFIEX_TM_ATTR_MAX, data, len,
mwifiex_tm_policy);
--
2.8.0.rc3.226.g39d4020



[PATCH 1/7] mwifiex: Removed unused mwifiex_private* 'priv' variable

2016-11-18 Thread Kirtika Ruchandani
Commit bec568ff5107 removed the last remaining usage of struct
mwifiex_private* priv in mwifiex_fw_dpc(), by removing the call to
mwifiex_del_virtual_intf().
Compiling mwifiex/ with W=1 gives the following warning, fix it.
mwifiex/main.c: In function ‘mwifiex_fw_dpc’:
mwifiex/main.c:520:26: warning: variable ‘priv’ set but not used 
[-Wunused-but-set-variable]

Fixes: bec568ff5107 ("mwifiex: failure path handling in 
mwifiex_add_virtual_intf()")
Cc: Amitkumar Karwar <akar...@marvell.com>
Signed-off-by: Kirtika Ruchandani <kirt...@google.com>
---
 drivers/net/wireless/marvell/mwifiex/main.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/main.c 
b/drivers/net/wireless/marvell/mwifiex/main.c
index 2478ccd..fff96be 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.c
+++ b/drivers/net/wireless/marvell/mwifiex/main.c
@@ -517,7 +517,6 @@ static void mwifiex_fw_dpc(const struct firmware *firmware, 
void *context)
 {
int ret;
char fmt[64];
-   struct mwifiex_private *priv;
struct mwifiex_adapter *adapter = context;
struct mwifiex_fw_image fw;
struct semaphore *sem = adapter->card_sem;
@@ -575,8 +574,6 @@ static void mwifiex_fw_dpc(const struct firmware *firmware, 
void *context)
goto err_init_fw;
}

-   priv = adapter->priv[MWIFIEX_BSS_ROLE_STA];
-
if (!adapter->wiphy) {
if (mwifiex_register_cfg80211(adapter)) {
mwifiex_dbg(adapter, ERROR,
--
2.8.0.rc3.226.g39d4020



[PATCH 2/7] mwifiex: Remove unused 'chan_num' variable

2016-11-18 Thread Kirtika Ruchandani
Commit b5413e6b2228 removed all uses of chan_num in mwifiex_config_scan().
Compiling mwifiex with W=1 gives the following warning, fix it.

mwifiex/scan.c: In function ‘mwifiex_config_scan’:
mwifiex/scan.c:830:6: warning: variable ‘chan_num’ set but not used 
[-Wunused-but-set-variable]

Fixes: b5413e6b2228 ("mwifiex: increase the number of nodes in command pool")
Cc: Amitkumar Karwar <akar...@marvell.com>
Signed-off-by: Kirtika Ruchandani <kirt...@google.com>
---
 drivers/net/wireless/marvell/mwifiex/scan.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/scan.c 
b/drivers/net/wireless/marvell/mwifiex/scan.c
index 97c9765..436e628 100644
--- a/drivers/net/wireless/marvell/mwifiex/scan.c
+++ b/drivers/net/wireless/marvell/mwifiex/scan.c
@@ -827,7 +827,6 @@ mwifiex_config_scan(struct mwifiex_private *priv,
u32 num_probes;
u32 ssid_len;
u32 chan_idx;
-   u32 chan_num;
u32 scan_type;
u16 scan_dur;
u8 channel;
@@ -1105,13 +1104,12 @@ mwifiex_config_scan(struct mwifiex_private *priv,
mwifiex_dbg(adapter, INFO,
"info: Scan: Scanning current channel 
only\n");
}
-   chan_num = chan_idx;
} else {
mwifiex_dbg(adapter, INFO,
"info: Scan: Creating full region channel list\n");
-   chan_num = mwifiex_scan_create_channel_list(priv, user_scan_in,
-   scan_chan_list,
-   *filtered_scan);
+   mwifiex_scan_create_channel_list(priv, user_scan_in,
+scan_chan_list,
+*filtered_scan);
}

 }
--
2.8.0.rc3.226.g39d4020



[PATCH 0/7] Fix -Wunused-but-set-variable in mwifiex/

2016-11-18 Thread Kirtika Ruchandani
This patchset is part of the effort led by Arnd Bergmann to clean up
warnings in the kernel. This and following patchsets will focus on
"-Wunused-but-set-variable" as it among the noisier ones. These were
found compiling with W=1.

Kirtika Ruchandani (7):
  mwifiex: Removed unused mwifiex_private* 'priv' variable
  mwifiex: Remove unused  'chan_num' variable
  mwifiex: Remove unused 'sta_ptr' variable
  mwifiex: Remove unused 'adapter'variable
  mwifiex: Remove unused 'pm_flag' variable
  mwifiex: Removed unused 'pkt_type' variable
  mwifiex: Remove unused 'bcd_usb' variable

 drivers/net/wireless/marvell/mwifiex/cfg80211.c | 2 --
 drivers/net/wireless/marvell/mwifiex/main.c | 3 ---
 drivers/net/wireless/marvell/mwifiex/scan.c | 8 +++-
 drivers/net/wireless/marvell/mwifiex/sdio.c | 5 -
 drivers/net/wireless/marvell/mwifiex/sta_cmd.c  | 2 --
 drivers/net/wireless/marvell/mwifiex/usb.c  | 3 +--
 6 files changed, 4 insertions(+), 19 deletions(-)

--
2.8.0.rc3.226.g39d4020



[PATCH v2 3/3] iwlwifi: pcie: trans: Remove unused 'shift_param'

2016-11-08 Thread Kirtika Ruchandani
shift_param is defined and set in iwl_pcie_load_cpu_sections
but not used. Fix this to avoid -Wunused-but-set-variable
warning.
The code using it turned into dead code with commit dcab8ecd5617
which added a separate function iwl_pcie_load_given_ucode_8000
(then 8000b) for IWL_DEVICE_FAMILY_8000. Commit 76f8c0e17edc
removed the dead code but left shift_param as is.

iwlwifi/pcie/trans.c: In function ‘iwl_pcie_load_cpu_sections’:
iwlwifi/pcie/trans.c:871:6: warning: variable ‘shift_param’ set but not used 
[-Wunused-but-set-variable]

Fixes: dcab8ecd5617 (iwlwifi: mvm: support ucode load for family_8000 B0 only)
Fixes: 76f8c0e17edc (iwlwifi: pcie: remove dead code)

Signed-off-by: Kirtika Ruchandani <kirt...@google.com>
Cc: Sara Sharon <sara.sha...@intel.com>
Cc: Luca Coelho <luciano.coe...@intel.com>
Cc: Eran Harary <eran.har...@intel.com>
Cc: Liad Kaufman <liad.kauf...@intel.com>
Cc: Emmanuel Grumbach <emmanuel.grumb...@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c 
b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
index ae95533..1b27a39 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
@@ -868,15 +868,12 @@ static int iwl_pcie_load_cpu_sections(struct iwl_trans 
*trans,
  int cpu,
  int *first_ucode_section)
 {
-   int shift_param;
int i, ret = 0;
u32 last_read_idx = 0;
 
if (cpu == 1) {
-   shift_param = 0;
*first_ucode_section = 0;
} else {
-   shift_param = 16;
(*first_ucode_section)++;
}
 
-- 
2.8.0.rc3.226.g39d4020



[PATCH v2 1/3] iwlwifi: mvm: rs: Remove unused 'mvmvif'/'mvmsta' variables

2016-11-08 Thread Kirtika Ruchandani
mvmvif is defined and set in rs_mimo_allow but not used. Compiling
iwlwifi with W=1 gives the following warning, remove it. mvmsta is used only to
obtain mvmvif so remove it as well.

iwlwifi/mvm/rs.c: In function 'rs_mimo_allow':
iwlwifi/mvm/rs.c:165:22: warning: variable 'mvmvif' set but not 
used.[-Wunused-but-set-variable]

This fix removes calls to iwl_mvm_sta_from_mac & iwl_mvm_vif_from_mac. They are
both accessors, and do not have any side-effects.
Commit e621c2282 removed a workaround that disabled MIMO on P2P, 'mvmvif' was
used for that workaround, but not removed with it.

Fixes: e621c2282e31 ("iwlwifi: rs: Remove workaround that disables MIMO on P2P")

Signed-off-by: Kirtika Ruchandani <kirt...@google.com>
Cc: Alexander Bondar <alexander.bon...@intel.com>
Cc: Emmanuel Grumbach <emmmanuel.grumb...@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/rs.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
index 227c5ed..0b79f4a 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
@@ -161,9 +161,6 @@ static bool rs_mimo_allow(struct iwl_mvm *mvm, struct 
ieee80211_sta *sta,
  struct rs_rate *rate,
  const struct rs_tx_column *next_col)
 {
-   struct iwl_mvm_sta *mvmsta;
-   struct iwl_mvm_vif *mvmvif;
-
if (!sta->ht_cap.ht_supported)
return false;
 
@@ -176,9 +173,6 @@ static bool rs_mimo_allow(struct iwl_mvm *mvm, struct 
ieee80211_sta *sta,
if (!iwl_mvm_bt_coex_is_mimo_allowed(mvm, sta))
return false;
 
-   mvmsta = iwl_mvm_sta_from_mac80211(sta);
-   mvmvif = iwl_mvm_vif_from_mac80211(mvmsta->vif);
-
if (mvm->nvm_data->sku_cap_mimo_disabled)
return false;
 
-- 
2.8.0.rc3.226.g39d4020



[PATCH v2 2/3] iwlwifi: mvm: rs: Remove unused 'mcs' variable

2016-11-08 Thread Kirtika Ruchandani
Commit 5fc0f76c4 introduced Rx stats from debugfs, the function
iwl_mvm_reset_frame_stats from that commit defines and sets mcs but does not use
it. Compiling iwlwifi with W=1 gives this warning -

iwlwifi/mvm/rs.c: In function ‘iwl_mvm_update_frame_stats’:
iwlwifi/mvm/rs.c:3074:14: warning: variable ‘mcs’ set but not used 
[-Wunused-but-set-variable]

Fixes: 5fc0f76c43bd (iwlwifi: mvm: add Rx frames statistics via debugfs)

Signed-off-by: Kirtika Ruchandani <kirt...@google.com>
Cc: Eyal Shapira <e...@wizery.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/rs.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
index 0b79f4a..80f99c3 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
@@ -3065,7 +3065,7 @@ static void iwl_mvm_reset_frame_stats(struct iwl_mvm *mvm)
 
 void iwl_mvm_update_frame_stats(struct iwl_mvm *mvm, u32 rate, bool agg)
 {
-   u8 nss = 0, mcs = 0;
+   u8 nss = 0;
 
spin_lock(>drv_stats_lock);
 
@@ -3093,11 +3093,9 @@ void iwl_mvm_update_frame_stats(struct iwl_mvm *mvm, u32 
rate, bool agg)
 
if (rate & RATE_MCS_HT_MSK) {
mvm->drv_rx_stats.ht_frames++;
-   mcs = rate & RATE_HT_MCS_RATE_CODE_MSK;
nss = ((rate & RATE_HT_MCS_NSS_MSK) >> RATE_HT_MCS_NSS_POS) + 1;
} else if (rate & RATE_MCS_VHT_MSK) {
mvm->drv_rx_stats.vht_frames++;
-   mcs = rate & RATE_VHT_MCS_RATE_CODE_MSK;
nss = ((rate & RATE_VHT_MCS_NSS_MSK) >>
   RATE_VHT_MCS_NSS_POS) + 1;
} else {
-- 
2.8.0.rc3.226.g39d4020



[PATCH v2 0/3] Fix -Wunused-but-set-variable in iwlwifi/pcie/trans and iwlwifi/mvm/rs

2016-11-08 Thread Kirtika Ruchandani
This patchset is part of the effort led by Arnd Bergmann to clean up
warnings in the kernel. This and following patchsets will focus on 
"-Wunused-but-set-variable" as it among the noisier ones. These were
found compiling with W=1.

-- 
Changes in v2:
- Made the following changes suggested by Arnd in all 3 patches
  1. Each patch has a unique subject line.
  2. Add the commit that introduced/led to the warning with the "Fixes:" line.
  3. cc linux-wireles, cc commit authors.

Kirtika Ruchandani (3):
  iwlwifi: mvm: rs: Remove unused 'mvmvif'/'mvmsta' variables
  iwlwifi: mvm: rs: Remove unused 'mcs' variable
  iwlwifi: pcie: trans: Remove unused 'shift_param'

 drivers/net/wireless/intel/iwlwifi/mvm/rs.c | 10 +-
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c |  3 ---
 2 files changed, 1 insertion(+), 12 deletions(-)

-- 
2.8.0.rc3.226.g39d4020



[PATCH] net/wireless: Fix 'multiple blank lines' check

2016-05-31 Thread Kirtika Ruchandani
This patch fixes the checkpatch.pl check "Please don't use multiple
blank lines" for all files in net/wireless, except nl80211.c which
is covered in a separated patch.

Signed-off-by: Kirtika Ruchandani <kirtika.ruchand...@gmail.com>
---
 net/wireless/ap.c  | 1 -
 net/wireless/chan.c| 3 ---
 net/wireless/core.h| 2 --
 net/wireless/ibss.c| 1 -
 net/wireless/mlme.c| 2 --
 net/wireless/radiotap.c| 2 --
 net/wireless/rdev-ops.h| 2 --
 net/wireless/reg.c | 3 ---
 net/wireless/scan.c| 1 -
 net/wireless/sme.c | 1 -
 net/wireless/util.c| 2 --
 net/wireless/wext-compat.c | 3 ---
 net/wireless/wext-compat.h | 2 --
 net/wireless/wext-core.c   | 6 --
 net/wireless/wext-proc.c   | 1 -
 net/wireless/wext-sme.c| 1 -
 16 files changed, 33 deletions(-)

diff --git a/net/wireless/ap.c b/net/wireless/ap.c
index bdad1f9..23acf58 100644
--- a/net/wireless/ap.c
+++ b/net/wireless/ap.c
@@ -5,7 +5,6 @@
 #include "core.h"
 #include "rdev-ops.h"

-
 int __cfg80211_stop_ap(struct cfg80211_registered_device *rdev,
   struct net_device *dev, bool notify)
 {
diff --git a/net/wireless/chan.c b/net/wireless/chan.c
index da49c0b..34cec73d 100644
--- a/net/wireless/chan.c
+++ b/net/wireless/chan.c
@@ -325,7 +325,6 @@ static int cfg80211_get_chans_dfs_required(struct wiphy 
*wiphy,
return 0;
 }

-
 int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
  const struct cfg80211_chan_def *chandef,
  enum nl80211_iftype iftype)
@@ -455,7 +454,6 @@ bool cfg80211_chandef_dfs_usable(struct wiphy *wiphy,
return (r1 + r2 > 0);
 }

-
 static bool cfg80211_get_chans_dfs_available(struct wiphy *wiphy,
 u32 center_freq,
 u32 bandwidth)
@@ -685,7 +683,6 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy,
if (width < 20)
prohibited_flags |= IEEE80211_CHAN_NO_OFDM;

-
if (!cfg80211_secondary_chans_ok(wiphy, chandef->center_freq1,
 width, prohibited_flags))
return false;
diff --git a/net/wireless/core.h b/net/wireless/core.h
index 025b7a5..5c54a1e 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -16,7 +16,6 @@
 #include 
 #include "reg.h"

-
 #define WIPHY_IDX_INVALID  -1

 struct cfg80211_registered_device {
@@ -161,7 +160,6 @@ static inline void cfg80211_unhold_bss(struct 
cfg80211_internal_bss *bss)
WARN_ON(r < 0);
 }

-
 struct cfg80211_registered_device *cfg80211_rdev_by_wiphy_idx(int wiphy_idx);
 int get_wiphy_idx(struct wiphy *wiphy);

diff --git a/net/wireless/ibss.c b/net/wireless/ibss.c
index 4a4dda5..67b4f9b 100644
--- a/net/wireless/ibss.c
+++ b/net/wireless/ibss.c
@@ -13,7 +13,6 @@
 #include "nl80211.h"
 #include "rdev-ops.h"

-
 void __cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
struct ieee80211_channel *channel)
 {
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index c284d88..332a143 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -18,7 +18,6 @@
 #include "nl80211.h"
 #include "rdev-ops.h"

-
 void cfg80211_rx_assoc_resp(struct net_device *dev, struct cfg80211_bss *bss,
const u8 *buf, size_t len, int uapsd_queues)
 {
@@ -768,7 +767,6 @@ void cfg80211_dfs_channels_update_work(struct work_struct 
*work)
   next_time);
 }

-
 void cfg80211_radar_event(struct wiphy *wiphy,
  struct cfg80211_chan_def *chandef,
  gfp_t gfp)
diff --git a/net/wireless/radiotap.c b/net/wireless/radiotap.c
index 6582d15..f193b88 100644
--- a/net/wireless/radiotap.c
+++ b/net/wireless/radiotap.c
@@ -184,8 +184,6 @@ static void find_ns(struct ieee80211_radiotap_iterator 
*iterator,
}
 }

-
-
 /**
  * ieee80211_radiotap_iterator_next - return next radiotap parser iterator arg
  * @iterator: radiotap_iterator to move to next arg (if any)
diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h
index 85ff30b..9ad56db 100644
--- a/net/wireless/rdev-ops.h
+++ b/net/wireless/rdev-ops.h
@@ -338,7 +338,6 @@ static inline int rdev_join_mesh(struct 
cfg80211_registered_device *rdev,
return ret;
 }

-
 static inline int rdev_leave_mesh(struct cfg80211_registered_device *rdev,
  struct net_device *dev)
 {
@@ -569,7 +568,6 @@ static inline void rdev_rfkill_poll(struct 
cfg80211_registered_device *rdev)
trace_rdev_return_void(>wiphy);
 }

-
 #ifdef CONFIG_NL80211_TESTMODE
 static inline int rdev_testmode_cmd(struct cfg80211_registered_device *rdev,
struct wireless_dev *wdev,
diff --git a/net/wireless/reg.c b/net/wireless

Re: [PATCH v2 03/10] nl80211: Prefer ether_addr_copy

2016-05-30 Thread Kirtika Ruchandani
> This looks right to me, but doesn't ether_addr_copy() have alignment
> requirements? Could someone more familiar with that review these
> changes to ensure they're met?

Thanks for catching this.
The requirement is to be __aligned(2). I've added 4 instances of
ether_addr_copy with 8 addresses as arguments.  Of these, the 4
src arguments are really the same type (i.e. nla_data acting on a
const nlattr*), so I'll try to reason about the 5 total cases below -
1. cfg->dst_mac should be 16-bit aligned due to the layout of
struct cfg80211_wowlan_tcp. Its offset is 10 or 12 bytes in the
structure depending on the system.
2 and 3. For mac_addr and mac_addr_mask, nl80211_parse_random_mac
takes these in as u8* (and hence does not guarantee alignment?)
Both the callers of this function today pass in arguments that are
explicitly __aligned(2). But this cannot be said of future potential callers
- so perhaps my patch introduces a bug?
4. Based on struct cfg80211_acl_data, acl->mac_addrs[i] should be not
guaranteed to be __aligned(2).
5. For all the nla_data src arguments, the nla_data function returns
((char*) foo + 5) for pointer foo. So likely not __aligned(2).

Based on 3, 4 and 5, this patch should be revoked, but it would be nice
to have a confirmation from someone else.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 06/10] nl80211: Various checkpatch.pl spacing fixes

2016-05-30 Thread Kirtika Ruchandani
> Adding the brackets around the & expression doesn't look spacing
> related to me. What's the exact warning this is fixing?

>From the commit message - "This patch also contains two hunks to fix
'line over 80 characters',
that are spacing related". This is the second hunk, the first being
the comments in the nl80211_fam
definition. Should I resend with these two hunks omitted, or fix my wording?
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 09/10] nl80211: Fix checkpatch.pl warning

2016-05-29 Thread Kirtika Ruchandani
This patch fixes the checkpatch.pl warning "foo * bar should be
foo *bar"

Signed-off-by: Kirtika Ruchandani <kirtika.ruchand...@gmail.com>
---
 net/wireless/nl80211.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index c6d870e..46757af 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -12214,7 +12214,7 @@ void nl80211_send_ibss_bssid(struct 
cfg80211_registered_device *rdev,
 }

 void cfg80211_notify_new_peer_candidate(struct net_device *dev, const u8 *addr,
-   const u8* ie, u8 ie_len, gfp_t gfp)
+   const u8 *ie, u8 ie_len, gfp_t gfp)
 {
struct wireless_dev *wdev = dev->ieee80211_ptr;
struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
@@ -13362,7 +13362,7 @@ void cfg80211_tdls_oper_request(struct net_device *dev, 
const u8 *peer,
 }
 EXPORT_SYMBOL(cfg80211_tdls_oper_request);

-static int nl80211_netlink_notify(struct notifier_block * nb,
+static int nl80211_netlink_notify(struct notifier_block *nb,
  unsigned long state,
  void *_notify)
 {
--
2.8.0.rc3.226.g39d4020

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 08/10] nl80211: Fix spelling

2016-05-29 Thread Kirtika Ruchandani
Fix 'implementation' spelling, reported by checkpatch.pl

Signed-off-by: Kirtika Ruchandani <kirtika.ruchand...@gmail.com>
---
 net/wireless/nl80211.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 6f8e2a7..c6d870e 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -6492,7 +6492,7 @@ nl80211_parse_sched_scan(struct wiphy *wiphy, struct 
wireless_dev *wdev,
   nla_data(ssid), nla_len(ssid));
request->match_sets[i].ssid.ssid_len =
nla_len(ssid);
-   /* special attribute - old implemenation w/a */
+   /* special attribute - old implementation w/a */
request->match_sets[i].rssi_thold =
default_match_rssi;
rssi = tb[NL80211_SCHED_SCAN_MATCH_ATTR_RSSI];
--
2.8.0.rc3.226.g39d4020

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 06/10] nl80211: Various checkpatch.pl spacing fixes

2016-05-29 Thread Kirtika Ruchandani
This patch fixes the following spacing issues reported
by checkpatch.pl -
- space preferred around that 
- no space needed after cast.
- Alignment should match open parenthesis
- suspect code indent for conditional statements
- Statements should start on a tabstop

This patch also contains two hunks to fix 'line over 80 characters',
that are spacing related.
All other instances of that warning have been ignored.

Signed-off-by: Kirtika Ruchandani <kirtika.ruchand...@gmail.com>
---
 net/wireless/nl80211.c | 103 ++---
 1 file changed, 54 insertions(+), 49 deletions(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 11cbf0b..ad7cdce 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -39,10 +39,10 @@ static void nl80211_post_doit(const struct genl_ops *ops, 
struct sk_buff *skb,

 /* the netlink family */
 static struct genl_family nl80211_fam = {
-   .id = GENL_ID_GENERATE, /* don't bother with a hardcoded ID */
-   .name = NL80211_GENL_NAME,  /* have users key off the name instead 
*/
-   .hdrsize = 0,   /* no private header */
-   .version = 1,   /* no particular meaning now */
+   .id = GENL_ID_GENERATE, /* don't bother with a hardcoded ID */
+   .name = NL80211_GENL_NAME,  /* have users key off the name instead */
+   .hdrsize = 0,   /* no private header */
+   .version = 1,   /* no particular meaning now */
.maxattr = NL80211_ATTR_MAX,
.netnsok = true,
.pre_doit = nl80211_pre_doit,
@@ -213,7 +213,7 @@ cfg80211_get_dev_from_info(struct net *netns, struct 
genl_info *info)
 static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
[NL80211_ATTR_WIPHY] = { .type = NLA_U32 },
[NL80211_ATTR_WIPHY_NAME] = { .type = NLA_NUL_STRING,
- .len = 20-1 },
+ .len = 20 - 1 },
[NL80211_ATTR_WIPHY_TXQ_PARAMS] = { .type = NLA_NESTED },

[NL80211_ATTR_WIPHY_FREQ] = { .type = NLA_U32 },
@@ -231,7 +231,7 @@ static const struct nla_policy 
nl80211_policy[NUM_NL80211_ATTR] = {

[NL80211_ATTR_IFTYPE] = { .type = NLA_U32 },
[NL80211_ATTR_IFINDEX] = { .type = NLA_U32 },
-   [NL80211_ATTR_IFNAME] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ-1 },
+   [NL80211_ATTR_IFNAME] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ - 1 },

[NL80211_ATTR_MAC] = { .len = ETH_ALEN },
[NL80211_ATTR_PREV_BSSID] = { .len = ETH_ALEN },
@@ -967,7 +967,7 @@ static int nl80211_put_iface_combinations(struct wiphy 
*wiphy,
int i, j;

nl_combis = nla_nest_start(msg,
-   NL80211_ATTR_INTERFACE_COMBINATIONS);
+  NL80211_ATTR_INTERFACE_COMBINATIONS);
if (!nl_combis)
goto nla_put_failure;

@@ -1012,9 +1012,9 @@ static int nl80211_put_iface_combinations(struct wiphy 
*wiphy,
goto nla_put_failure;
if (large &&
(nla_put_u32(msg, NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS,
-   c->radar_detect_widths) ||
+c->radar_detect_widths) ||
 nla_put_u32(msg, NL80211_IFACE_COMB_RADAR_DETECT_REGIONS,
-   c->radar_detect_regions)))
+c->radar_detect_regions)))
goto nla_put_failure;

nla_nest_end(msg, nl_combi);
@@ -1493,7 +1493,7 @@ static int nl80211_send_wiphy(struct 
cfg80211_registered_device *rdev,

i = 0;
 #define CMD(op, n) \
-do {   \
+   do {\
if (rdev->ops->op) {\
i++;\
if (nla_put_u32(msg, i, NL80211_CMD_ ## n)) \
@@ -1735,8 +1735,9 @@ static int nl80211_send_wiphy(struct 
cfg80211_registered_device *rdev,
   rdev->wiphy.max_num_csa_counters))
goto nla_put_failure;

-   if (rdev->wiphy.regulatory_flags & 
REGULATORY_WIPHY_SELF_MANAGED &&
-   nla_put_flag(msg, NL80211_ATTR_WIPHY_SELF_MANAGED_REG))
+   if ((rdev->wiphy.regulatory_flags &
+REGULATORY_WIPHY_SELF_MANAGED) &&
+nla_put_flag(msg, NL80211_ATTR_WIPHY_SELF_MANAGED_REG))
goto nla_put_failure;

if (nla_put(msg, NL80211_ATTR_EXT_FEATURES,
@@ -2299,7 +2300,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct 
genl_info *info)
   

[PATCH v2 07/10] nl80211: Avoid multiple assignments on same line

2016-05-29 Thread Kirtika Ruchandani
This patch fixes the checkpatch.pl warning "multiple assignments
should be avoided."

Signed-off-by: Kirtika Ruchandani <kirtika.ruchand...@gmail.com>
---
 net/wireless/nl80211.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index ad7cdce..6f8e2a7 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -2603,7 +2603,8 @@ static int nl80211_set_interface(struct sk_buff *skb, 
struct genl_info *info)

memset(, 0, sizeof(params));

-   otype = ntype = dev->ieee80211_ptr->iftype;
+   otype = dev->ieee80211_ptr->iftype;
+   ntype = dev->ieee80211_ptr->iftype;

if (info->attrs[NL80211_ATTR_IFTYPE]) {
ntype = nla_get_u32(info->attrs[NL80211_ATTR_IFTYPE]);
--
2.8.0.rc3.226.g39d4020

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 05/10] nl80211: Fix checkpatch.pl NULL comparison warning

2016-05-29 Thread Kirtika Ruchandani
This patch fixes the warning - "comparison to NULL (foo == NULL)
could be written as (!foo)"

Signed-off-by: Kirtika Ruchandani <kirtika.ruchand...@gmail.com>
---
 net/wireless/nl80211.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 945405d..11cbf0b 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -928,7 +928,7 @@ static struct ieee80211_channel 
*nl80211_get_valid_chan(struct wiphy *wiphy,
 {
struct ieee80211_channel *chan;

-   if (tb == NULL)
+   if (!tb)
return NULL;
chan = ieee80211_get_channel(wiphy, nla_get_u32(tb));
if (!chan || chan->flags & IEEE80211_CHAN_DISABLED)
@@ -8575,7 +8575,7 @@ static int nl80211_set_tx_bitrate_mask(struct sk_buff 
*skb,
if (band < 0 || band >= NUM_NL80211_BANDS)
return -EINVAL;
sband = rdev->wiphy.bands[band];
-   if (sband == NULL)
+   if (!sband)
return -EINVAL;
err = nla_parse(tb, NL80211_TXRATE_MAX, nla_data(tx_rates),
nla_len(tx_rates), nl80211_txattr_policy);
--
2.8.0.rc3.226.g39d4020

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 03/10] nl80211: Prefer ether_addr_copy

2016-05-29 Thread Kirtika Ruchandani
This patch fixes the checkpatch,pl to prefer ether_addr_copy
over memcpy.

Signed-off-by: Kirtika Ruchandani <kirtika.ruchand...@gmail.com>
---
 net/wireless/nl80211.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index cd422bd..34b8fbe 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -3194,7 +3194,7 @@ static struct cfg80211_acl_data *parse_acl_data(struct 
wiphy *wiphy,
return ERR_PTR(-ENOMEM);

nla_for_each_nested(attr, info->attrs[NL80211_ATTR_MAC_ADDRS], tmp) {
-   memcpy(acl->mac_addrs[i].addr, nla_data(attr), ETH_ALEN);
+   ether_addr_copy(acl->mac_addrs[i].addr, nla_data(attr));
i++;
}

@@ -5892,8 +5892,8 @@ static int nl80211_parse_random_mac(struct nlattr **attrs,
if (!attrs[NL80211_ATTR_MAC] || !attrs[NL80211_ATTR_MAC_MASK])
return -EINVAL;

-   memcpy(mac_addr, nla_data(attrs[NL80211_ATTR_MAC]), ETH_ALEN);
-   memcpy(mac_addr_mask, nla_data(attrs[NL80211_ATTR_MAC_MASK]), ETH_ALEN);
+   ether_addr_copy(mac_addr, nla_data(attrs[NL80211_ATTR_MAC]));
+   ether_addr_copy(mac_addr_mask, nla_data(attrs[NL80211_ATTR_MAC_MASK]));

/* don't allow or configure an mcast address */
if (!is_multicast_ether_addr(mac_addr_mask) ||
@@ -9405,8 +9405,7 @@ static int nl80211_parse_wowlan_tcp(struct 
cfg80211_registered_device *rdev,
return -ENOMEM;
cfg->src = nla_get_in_addr(tb[NL80211_WOWLAN_TCP_SRC_IPV4]);
cfg->dst = nla_get_in_addr(tb[NL80211_WOWLAN_TCP_DST_IPV4]);
-   memcpy(cfg->dst_mac, nla_data(tb[NL80211_WOWLAN_TCP_DST_MAC]),
-  ETH_ALEN);
+   ether_addr_copy(cfg->dst_mac, nla_data(tb[NL80211_WOWLAN_TCP_DST_MAC]));
if (tb[NL80211_WOWLAN_TCP_SRC_PORT])
port = nla_get_u16(tb[NL80211_WOWLAN_TCP_SRC_PORT]);
else
--
2.8.0.rc3.226.g39d4020

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 04/10] nl80211: Fix checkpatch.pl warning about braces

2016-05-29 Thread Kirtika Ruchandani
This patch fixes the following checkpatch,pl warning -
- braces {} should be used on all arms of this statement.

Signed-off-by: Kirtika Ruchandani <kirtika.ruchand...@gmail.com>
---
 net/wireless/nl80211.c | 23 +++
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 34b8fbe..945405d 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -870,8 +870,9 @@ nl80211_parse_connkeys(struct cfg80211_registered_device 
*rdev,
result->def = parse.idx;
if (!parse.def_uni || !parse.def_multi)
goto error;
-   } else if (parse.defmgmt)
+   } else if (parse.defmgmt) {
goto error;
+   }
err = cfg80211_validate_key_settings(rdev, ,
 parse.idx, false, NULL);
if (err)
@@ -1401,8 +1402,9 @@ static int nl80211_send_wiphy(struct 
cfg80211_registered_device *rdev,
break;
case 2:
if (nl80211_put_iftypes(msg, NL80211_ATTR_SUPPORTED_IFTYPES,
-   rdev->wiphy.interface_modes))
-   goto nla_put_failure;
+   rdev->wiphy.interface_modes)) {
+   goto nla_put_failure;
+   }
state->split_start++;
if (state->split)
break;
@@ -2155,8 +2157,9 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct 
genl_info *info)
wdev = NULL;
netdev = NULL;
result = 0;
-   } else
+   } else {
wdev = netdev->ieee80211_ptr;
+   }

/* end workaround code, by now the rdev is available
 * and locked, and wdev may or may not be NULL.
@@ -3403,8 +3406,9 @@ static int nl80211_start_ap(struct sk_buff *skb, struct 
genl_info *info)
if (!nl80211_valid_auth_type(rdev, params.auth_type,
 NL80211_CMD_START_AP))
return -EINVAL;
-   } else
+   } else {
params.auth_type = NL80211_AUTHTYPE_AUTOMATIC;
+   }

err = nl80211_crypto_settings(rdev, info, ,
  NL80211_MAX_NR_CIPHER_SUITES);
@@ -3450,8 +3454,9 @@ static int nl80211_start_ap(struct sk_buff *skb, struct 
genl_info *info)
return err;
} else if (wdev->preset_chandef.chan) {
params.chandef = wdev->preset_chandef;
-   } else if (!nl80211_get_ap_channel(rdev, ))
+   } else if (!nl80211_get_ap_channel(rdev, )) {
return -EINVAL;
+   }

if (!cfg80211_reg_can_beacon_relax(>wiphy, ,
   wdev->iftype))
@@ -7262,8 +7267,9 @@ static int nl80211_crypto_settings(struct 
cfg80211_registered_device *rdev,
return -EINVAL;
if (info->attrs[NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT])
settings->control_port_no_encrypt = true;
-   } else
+   } else {
settings->control_port_ethertype = cpu_to_be16(ETH_P_PAE);
+   }

if (info->attrs[NL80211_ATTR_CIPHER_SUITES_PAIRWISE]) {
void *data;
@@ -7997,8 +8003,9 @@ static int nl80211_connect(struct sk_buff *skb, struct 
genl_info *info)
if (!nl80211_valid_auth_type(rdev, connect.auth_type,
 NL80211_CMD_CONNECT))
return -EINVAL;
-   } else
+   } else {
connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC;
+   }

connect.privacy = info->attrs[NL80211_ATTR_PRIVACY];

--
2.8.0.rc3.226.g39d4020

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 01/10] nl80211: Fix checkpatch warnings

2016-05-29 Thread Kirtika Ruchandani
This patch fixes the following checkpatch.pl warnings about
comments in nl80211.c :
- networking block comments don't use an empty '/*' line
- block comments use a trailing '*/' on a separate line

Reviewed-by: Julian Calaby <julian.cal...@gmail.com>
Signed-off-by: Kirtika Ruchandani <kirtika.ruchand...@gmail.com>
---
 net/wireless/nl80211.c | 129 +
 1 file changed, 45 insertions(+), 84 deletions(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index d759901..50a0de0 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -196,8 +196,7 @@ __cfg80211_rdev_from_attrs(struct net *netns, struct nlattr 
**attrs)
return rdev;
 }

-/*
- * This function returns a pointer to the driver
+/* This function returns a pointer to the driver
  * that the genl_info item that is passed refers to.
  *
  * The result of this can be a PTR_ERR and hence must
@@ -1624,8 +1623,7 @@ static int nl80211_send_wiphy(struct 
cfg80211_registered_device *rdev,
goto nla_put_failure;

features = rdev->wiphy.features;
-   /*
-* We can only add the per-channel limit information if the
+   /* We can only add the per-channel limit information if the
 * dump is split, otherwise it makes it too big. Therefore
 * only advertise it in that case.
 */
@@ -1646,8 +1644,7 @@ static int nl80211_send_wiphy(struct 
cfg80211_registered_device *rdev,
rdev->wiphy.max_acl_mac_addrs))
goto nla_put_failure;

-   /*
-* Any information below this point is only available to
+   /* Any information below this point is only available to
 * applications that can deal with it being split. This
 * helps ensure that newly added capabilities don't break
 * older tools by overrunning their buffers.
@@ -1847,8 +1844,7 @@ static int nl80211_dump_wiphy(struct sk_buff *skb, struct 
netlink_callback *cb)
 cb->nlh->nlmsg_seq,
 NLM_F_MULTI, state);
if (ret < 0) {
-   /*
-* If sending the wiphy data didn't fit (ENOBUFS
+   /* If sending the wiphy data didn't fit (ENOBUFS
 * or EMSGSIZE returned), this SKB is still
 * empty (so it's not too big because another
 * wiphy dataset is already in the skb) and
@@ -1937,8 +1933,7 @@ static int parse_txq_params(struct nlattr *tb[],

 static bool nl80211_can_set_dev_channel(struct wireless_dev *wdev)
 {
-   /*
-* You can only set the channel explicitly for WDS interfaces,
+   /* You can only set the channel explicitly for WDS interfaces,
 * all others have their channel managed via their respective
 * "establish a connection" command (connect, join, ...)
 *
@@ -2131,8 +2126,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct 
genl_info *info)

ASSERT_RTNL();

-   /*
-* Try to find the wiphy and netdev. Normally this
+   /* Try to find the wiphy and netdev. Normally this
 * function shouldn't need the netdev, but this is
 * done for backward compatibility -- previously
 * setting the channel was done per wiphy, but now
@@ -2162,8 +2156,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct 
genl_info *info)
} else
wdev = netdev->ieee80211_ptr;

-   /*
-* end workaround code, by now the rdev is available
+   /* end workaround code, by now the rdev is available
 * and locked, and wdev may or may not be NULL.
 */

@@ -2260,7 +2253,8 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct 
genl_info *info)
rx_ant = 
nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_ANTENNA_RX]);

/* reject antenna configurations which don't match the
-* available antenna masks, except for the "all" mask */
+* available antenna masks, except for the "all" mask
+*/
if ((~tx_ant && (tx_ant & ~rdev->wiphy.available_antennas_tx)) 
||
(~rx_ant && (rx_ant & ~rdev->wiphy.available_antennas_rx)))
return -EINVAL;
@@ -2300,8 +2294,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct 
genl_info *info)
return -EINVAL;

if (frag_threshold != (u32) -1) {
-   /*
-* Fragments (apart from the last one) are required to
+   /* Fragment

[PATCH v2 00/10] nl80211: Fix checkpatch.pl issues

2016-05-29 Thread Kirtika Ruchandani
This patch-set attempts to fix checkpatch.pl issues found in nl80211.c.
Each patch describes the specific warnings/checks/errors it addresses.
This patch-set ignores 'line over 80 chars' warnings, except for 2 cases.
Please check for issues with the 'fixes' for 'alignment should match
open parenthesis'. Some of them do not display correctly with git diff.
This patch-set removes 3 errors, 66 warnings and 46 checks.

Kirtika Ruchandani (10):
  nl80211: Fix checkpatch warnings
  nl80211: Fix checkpatch warnings about blank lines
  nl80211: Prefer ether_addr_copy
  nl80211: Fix checkpatch.pl warning about braces
  nl80211: Fix checkpatch.pl NULL comparison warning
  nl80211: Various checkpatch.pl spacing fixes
  nl80211: Avoid multiple assignments on same line
  nl80211: Fix spelling
  nl80211: Fix checkpatch.pl warning
  nl80211: Prefer kcalloc over kzalloc

Changes in v2:
- Break down patch into smaller independent patches as suggested by Julian 
  Calaby.This breaks down patch 3/3 in set v1 into patches 3-10 of v2.

 net/wireless/nl80211.c | 301 ++---
 1 file changed, 136 insertions(+), 165 deletions(-)

-- 
2.8.0.rc3.226.g39d4020

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/3] nl80211: Various checkpatch.pl fixes

2016-05-29 Thread Kirtika Ruchandani
>> There's too much stuff here to quickly review, it'd be nice if you
>> could split this up into patches that do the following:

Is it preferable to resend the whole patch-set or just patch 3/3 in
this one as a separate set?
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/3] nl80211: Various checkpatch.pl fixes

2016-05-29 Thread Kirtika Ruchandani
> There's too much stuff here to quickly review, it'd be nice if you
> could split this up into patches that do the following:

Thanks, I will send out a v2 with the split you suggested.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/3] nl80211: Various checkpatch.pl fixes

2016-05-28 Thread Kirtika Ruchandani
This patch fixes the following checkpatch.pl issues -
- space preferred around that 
- no space needed after cast.
- braces {} should be used on all arms of this statement
- Alignment should match open parenthesis
- suspect code indent for conditional statements
- Statements should start on a tabstop
- multiple assignments should be avoided
- prefer ether_addr_copy over memcpy
- correct spelling - 'implementation'
- comparison to NULL could be written as !foo
- prefer kcalloc over kzalloc with multiply

Signed-off-by: Kirtika Ruchandani <kirtika.ruchand...@gmail.com>
---
 net/wireless/nl80211.c | 152 ++---
 1 file changed, 82 insertions(+), 70 deletions(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index cd422bd..9f7eb16 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -39,10 +39,10 @@ static void nl80211_post_doit(const struct genl_ops *ops, 
struct sk_buff *skb,
 
 /* the netlink family */
 static struct genl_family nl80211_fam = {
-   .id = GENL_ID_GENERATE, /* don't bother with a hardcoded ID */
-   .name = NL80211_GENL_NAME,  /* have users key off the name instead 
*/
-   .hdrsize = 0,   /* no private header */
-   .version = 1,   /* no particular meaning now */
+   .id = GENL_ID_GENERATE, /* don't bother with a hardcoded ID */
+   .name = NL80211_GENL_NAME,  /* have users key off the name instead */
+   .hdrsize = 0,   /* no private header */
+   .version = 1,   /* no particular meaning now */
.maxattr = NL80211_ATTR_MAX,
.netnsok = true,
.pre_doit = nl80211_pre_doit,
@@ -213,7 +213,7 @@ cfg80211_get_dev_from_info(struct net *netns, struct 
genl_info *info)
 static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
[NL80211_ATTR_WIPHY] = { .type = NLA_U32 },
[NL80211_ATTR_WIPHY_NAME] = { .type = NLA_NUL_STRING,
- .len = 20-1 },
+ .len = 20 - 1 },
[NL80211_ATTR_WIPHY_TXQ_PARAMS] = { .type = NLA_NESTED },
 
[NL80211_ATTR_WIPHY_FREQ] = { .type = NLA_U32 },
@@ -231,7 +231,7 @@ static const struct nla_policy 
nl80211_policy[NUM_NL80211_ATTR] = {
 
[NL80211_ATTR_IFTYPE] = { .type = NLA_U32 },
[NL80211_ATTR_IFINDEX] = { .type = NLA_U32 },
-   [NL80211_ATTR_IFNAME] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ-1 },
+   [NL80211_ATTR_IFNAME] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ - 1 },
 
[NL80211_ATTR_MAC] = { .len = ETH_ALEN },
[NL80211_ATTR_PREV_BSSID] = { .len = ETH_ALEN },
@@ -870,8 +870,9 @@ nl80211_parse_connkeys(struct cfg80211_registered_device 
*rdev,
result->def = parse.idx;
if (!parse.def_uni || !parse.def_multi)
goto error;
-   } else if (parse.defmgmt)
+   } else if (parse.defmgmt) {
goto error;
+   }
err = cfg80211_validate_key_settings(rdev, ,
 parse.idx, false, NULL);
if (err)
@@ -927,7 +928,7 @@ static struct ieee80211_channel 
*nl80211_get_valid_chan(struct wiphy *wiphy,
 {
struct ieee80211_channel *chan;
 
-   if (tb == NULL)
+   if (!tb)
return NULL;
chan = ieee80211_get_channel(wiphy, nla_get_u32(tb));
if (!chan || chan->flags & IEEE80211_CHAN_DISABLED)
@@ -966,7 +967,7 @@ static int nl80211_put_iface_combinations(struct wiphy 
*wiphy,
int i, j;
 
nl_combis = nla_nest_start(msg,
-   NL80211_ATTR_INTERFACE_COMBINATIONS);
+  NL80211_ATTR_INTERFACE_COMBINATIONS);
if (!nl_combis)
goto nla_put_failure;
 
@@ -1011,9 +1012,9 @@ static int nl80211_put_iface_combinations(struct wiphy 
*wiphy,
goto nla_put_failure;
if (large &&
(nla_put_u32(msg, NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS,
-   c->radar_detect_widths) ||
+c->radar_detect_widths) ||
 nla_put_u32(msg, NL80211_IFACE_COMB_RADAR_DETECT_REGIONS,
-   c->radar_detect_regions)))
+c->radar_detect_regions)))
goto nla_put_failure;
 
nla_nest_end(msg, nl_combi);
@@ -1401,8 +1402,9 @@ static int nl80211_send_wiphy(struct 
cfg80211_registered_device *rdev,
break;
case 2:
if (nl80211_put_iftypes(msg, NL80211_ATTR_SUPPORTED_IFTYPES,
-   rdev->wiphy.interface_modes))
-   goto nla_put_failure;
+   

[PATCH 2/3] nl80211: Fix checkpatch warnings about blank lines

2016-05-28 Thread Kirtika Ruchandani
This patch fixes the following checkpatch.pl issues -
- Please don't use multiple blank lines
- Blank lines aren't necessary before a close brace
- Missing a blank line after declarations

Signed-off-by: Kirtika Ruchandani <kirtika.ruchand...@gmail.com>
---
 net/wireless/nl80211.c | 22 ++
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 50a0de0..cd422bd 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -167,6 +167,7 @@ __cfg80211_rdev_from_attrs(struct net *netns, struct nlattr 
**attrs)
 
if (attrs[NL80211_ATTR_IFINDEX]) {
int ifindex = nla_get_u32(attrs[NL80211_ATTR_IFINDEX]);
+
netdev = __dev_get_by_index(netns, ifindex);
if (netdev) {
if (netdev->ieee80211_ptr)
@@ -730,6 +731,7 @@ static int nl80211_parse_key_new(struct nlattr *key, struct 
key_parse *k)
 
if (tb[NL80211_KEY_DEFAULT_TYPES]) {
struct nlattr *kdt[NUM_NL80211_KEY_DEFAULT_TYPES];
+
err = nla_parse_nested(kdt, NUM_NL80211_KEY_DEFAULT_TYPES - 1,
   tb[NL80211_KEY_DEFAULT_TYPES],
   nl80211_key_default_policy);
@@ -1381,6 +1383,7 @@ static int nl80211_send_wiphy(struct 
cfg80211_registered_device *rdev,
rdev->ops->get_antenna) {
u32 tx_ant = 0, rx_ant = 0;
int res;
+
res = rdev_get_antenna(rdev, _ant, _ant);
if (!res) {
if (nla_put_u32(msg,
@@ -2111,7 +2114,6 @@ static int nl80211_set_wds_peer(struct sk_buff *skb, 
struct genl_info *info)
return rdev_set_wds_peer(rdev, dev, bssid);
 }
 
-
 static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
 {
struct cfg80211_registered_device *rdev;
@@ -2244,6 +2246,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct 
genl_info *info)
if (info->attrs[NL80211_ATTR_WIPHY_ANTENNA_TX] &&
info->attrs[NL80211_ATTR_WIPHY_ANTENNA_RX]) {
u32 tx_ant, rx_ant;
+
if ((!rdev->wiphy.available_antennas_tx &&
 !rdev->wiphy.available_antennas_rx) ||
!rdev->ops->set_antenna)
@@ -2910,6 +2913,7 @@ static int nl80211_get_key(struct sk_buff *skb, struct 
genl_info *info)
pairwise = !!mac_addr;
if (info->attrs[NL80211_ATTR_KEY_TYPE]) {
u32 kt = nla_get_u32(info->attrs[NL80211_ATTR_KEY_TYPE]);
+
if (kt >= NUM_NL80211_KEYTYPES)
return -EINVAL;
if (kt != NL80211_KEYTYPE_GROUP &&
@@ -3949,7 +3953,6 @@ static int nl80211_dump_station(struct sk_buff *skb,
sta_idx++;
}
 
-
  out:
cb->args[2] = sta_idx;
err = skb->len;
@@ -4742,7 +4745,6 @@ static int nl80211_dump_mpath(struct sk_buff *skb,
path_idx++;
}
 
-
  out:
cb->args[2] = path_idx;
err = skb->len;
@@ -5032,7 +5034,6 @@ static int nl80211_req_set_reg(struct sk_buff *skb, 
struct genl_info *info)
enum nl80211_user_reg_hint_type user_reg_hint_type;
u32 owner_nlportid;
 
-
/* You should only get this when cfg80211 hasn't yet initialized
 * completely when built-in to the kernel right between the time
 * window between nl80211_init() and regulatory_init(), if that is
@@ -5240,7 +5241,6 @@ do {  
\
}   \
 } while (0)
 
-
if (!info->attrs[NL80211_ATTR_MESH_CONFIG])
return -EINVAL;
if (nla_parse_nested(tb, NL80211_MESHCONF_ATTR_MAX,
@@ -5388,7 +5388,6 @@ static int nl80211_parse_mesh_setup(struct genl_info 
*info,
 IEEE80211_PATH_METRIC_VENDOR :
 IEEE80211_PATH_METRIC_AIRTIME;
 
-
if (tb[NL80211_MESH_SETUP_IE]) {
struct nlattr *ieattr =
tb[NL80211_MESH_SETUP_IE];
@@ -6009,6 +6008,7 @@ static int nl80211_trigger_scan(struct sk_buff *skb, 
struct genl_info *info)
/* all channels */
for (band = 0; band < NUM_NL80211_BANDS; band++) {
int j;
+
if (!wiphy->bands[band])
continue;
for (j = 0; j < wiphy->bands[band]->n_channels; j++) {
@@ -6412,6 +6412,7 @@ nl80211_parse_sched_scan(struct wiphy *wiphy, struct 
wireless_dev *wdev,
/* all channels */
for (band = 0; band < NUM_NL80211_BANDS; band++) {
int j;
+
if (!wiphy->bands[band])
 

[PATCH 1/3] nl80211: Fix checkpatch warnings

2016-05-28 Thread Kirtika Ruchandani
This patch fixes the following checkpatch.pl warnings about
comments in nl80211.c :
- networking block comments don't use an empty '/*' line
- block comments use a trailing '*/' on a separate line

Signed-off-by: Kirtika Ruchandani <kirtika.ruchand...@gmail.com>
---
 net/wireless/nl80211.c | 129 +
 1 file changed, 45 insertions(+), 84 deletions(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index d759901..50a0de0 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -196,8 +196,7 @@ __cfg80211_rdev_from_attrs(struct net *netns, struct nlattr 
**attrs)
return rdev;
 }
 
-/*
- * This function returns a pointer to the driver
+/* This function returns a pointer to the driver
  * that the genl_info item that is passed refers to.
  *
  * The result of this can be a PTR_ERR and hence must
@@ -1624,8 +1623,7 @@ static int nl80211_send_wiphy(struct 
cfg80211_registered_device *rdev,
goto nla_put_failure;
 
features = rdev->wiphy.features;
-   /*
-* We can only add the per-channel limit information if the
+   /* We can only add the per-channel limit information if the
 * dump is split, otherwise it makes it too big. Therefore
 * only advertise it in that case.
 */
@@ -1646,8 +1644,7 @@ static int nl80211_send_wiphy(struct 
cfg80211_registered_device *rdev,
rdev->wiphy.max_acl_mac_addrs))
goto nla_put_failure;
 
-   /*
-* Any information below this point is only available to
+   /* Any information below this point is only available to
 * applications that can deal with it being split. This
 * helps ensure that newly added capabilities don't break
 * older tools by overrunning their buffers.
@@ -1847,8 +1844,7 @@ static int nl80211_dump_wiphy(struct sk_buff *skb, struct 
netlink_callback *cb)
 cb->nlh->nlmsg_seq,
 NLM_F_MULTI, state);
if (ret < 0) {
-   /*
-* If sending the wiphy data didn't fit (ENOBUFS
+   /* If sending the wiphy data didn't fit (ENOBUFS
 * or EMSGSIZE returned), this SKB is still
 * empty (so it's not too big because another
 * wiphy dataset is already in the skb) and
@@ -1937,8 +1933,7 @@ static int parse_txq_params(struct nlattr *tb[],
 
 static bool nl80211_can_set_dev_channel(struct wireless_dev *wdev)
 {
-   /*
-* You can only set the channel explicitly for WDS interfaces,
+   /* You can only set the channel explicitly for WDS interfaces,
 * all others have their channel managed via their respective
 * "establish a connection" command (connect, join, ...)
 *
@@ -2131,8 +2126,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct 
genl_info *info)
 
ASSERT_RTNL();
 
-   /*
-* Try to find the wiphy and netdev. Normally this
+   /* Try to find the wiphy and netdev. Normally this
 * function shouldn't need the netdev, but this is
 * done for backward compatibility -- previously
 * setting the channel was done per wiphy, but now
@@ -2162,8 +2156,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct 
genl_info *info)
} else
wdev = netdev->ieee80211_ptr;
 
-   /*
-* end workaround code, by now the rdev is available
+   /* end workaround code, by now the rdev is available
 * and locked, and wdev may or may not be NULL.
 */
 
@@ -2260,7 +2253,8 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct 
genl_info *info)
rx_ant = 
nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_ANTENNA_RX]);
 
/* reject antenna configurations which don't match the
-* available antenna masks, except for the "all" mask */
+* available antenna masks, except for the "all" mask
+*/
if ((~tx_ant && (tx_ant & ~rdev->wiphy.available_antennas_tx)) 
||
(~rx_ant && (rx_ant & ~rdev->wiphy.available_antennas_rx)))
return -EINVAL;
@@ -2300,8 +2294,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct 
genl_info *info)
return -EINVAL;
 
if (frag_threshold != (u32) -1) {
-   /*
-* Fragments (apart from the last one) are required to
+   /* Fragments (apart from the last one) a

[PATCH 0/3] nl80211: Fix checkpatch.pl issues

2016-05-28 Thread Kirtika Ruchandani
This patch-set attempts to fix checkpatch.pl issues found in nl80211.c. 
Each patch describes the specific warnings/checks/errors it addresses. 
This patch-set ignores 'line over 80 chars' warnings.
Please check for issues with the 'fixes' for 'alignment should match 
open parenthesis'. Some of them do not display correctly with git diff.
This patch-set removes 3 errors, 66 warnings and 46 checks. 

Kirtika Ruchandani (3):
  nl80211: Fix checkpatch warnings
  nl80211: Fix checkpatch warnings about blank lines
  nl80211:  Various checkpatch.pl fixes

 net/wireless/nl80211.c | 303 ++---
 1 file changed, 137 insertions(+), 166 deletions(-)

-- 
2.8.0.rc3.226.g39d4020

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] cfg80211: Fix checkpatch issues

2016-05-28 Thread Kirtika Ruchandani
Fix the following issues reported by checkpatch.pl -
- document spinlock_t where needed/possible
- do not use multiple blank lines
- add blank line after a declaration
- use a trailing '*/' on a separate line in block comments
- don't use empty '/*' lines
- use ether_addr_copy instead of memcpy
- fix line over 80 chars
- match alignment of function arguments to open parentheses

Signed-off-by: Kirtika Ruchandani <kirtika.ruchand...@gmail.com>
---
 net/wireless/core.c | 73 +++--
 net/wireless/core.h | 33 +---
 2 files changed, 49 insertions(+), 57 deletions(-)

diff --git a/net/wireless/core.c b/net/wireless/core.c
index d25c82b..f7b14af 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -102,8 +102,7 @@ static int cfg80211_dev_check_name(struct 
cfg80211_registered_device *rdev,
digits = 1;
while (wiphy_idx /= 10)
digits++;
-   /*
-* deny the name if it is phy where  is printed
+   /* deny the name if it is phy where  is printed
 * without leading zeroes. taken == strlen(newname) here
 */
if (taken == strlen(PHY_NAME) + digits)
@@ -179,7 +178,7 @@ int cfg80211_switch_netns(struct cfg80211_registered_device 
*rdev,
continue;
wdev->netdev->features &= ~NETIF_F_NETNS_LOCAL;
err = dev_change_net_namespace(wdev->netdev, net,
-   "wlan%d");
+  "wlan%d");
WARN_ON(err);
wdev->netdev->features |= NETIF_F_NETNS_LOCAL;
}
@@ -267,7 +266,8 @@ static void cfg80211_rfkill_sync_work(struct work_struct 
*work)
 {
struct cfg80211_registered_device *rdev;

-   rdev = container_of(work, struct cfg80211_registered_device, 
rfkill_sync);
+   rdev = container_of(work, struct cfg80211_registered_device,
+   rfkill_sync);
cfg80211_rfkill_set_block(rdev, rfkill_blocked(rdev->rfkill));
 }

@@ -328,7 +328,7 @@ static void cfg80211_sched_scan_stop_wk(struct work_struct 
*work)
struct cfg80211_registered_device *rdev;

rdev = container_of(work, struct cfg80211_registered_device,
-  sched_scan_stop_wk);
+   sched_scan_stop_wk);

rtnl_lock();

@@ -461,15 +461,14 @@ use_default_name:

init_waitqueue_head(>dev_wait);

-   /*
-* Initialize wiphy parameters to IEEE 802.11 MIB default values.
+   /* Initialize wiphy parameters to IEEE 802.11 MIB default values.
 * Fragmentation and RTS threshold are disabled by default with the
 * special -1 value.
 */
rdev->wiphy.retry_short = 7;
rdev->wiphy.retry_long = 4;
-   rdev->wiphy.frag_threshold = (u32) -1;
-   rdev->wiphy.rts_threshold = (u32) -1;
+   rdev->wiphy.frag_threshold = (u32)-1;
+   rdev->wiphy.rts_threshold = (u32)-1;
rdev->wiphy.coverage_class = 0;

rdev->wiphy.max_num_csa_counters = 1;
@@ -492,8 +491,7 @@ static int wiphy_verify_combinations(struct wiphy *wiphy)

c = >iface_combinations[i];

-   /*
-* Combinations with just one interface aren't real,
+   /* Combinations with just one interface aren't real,
 * however we make an exception for DFS.
 */
if (WARN_ON((c->max_interfaces < 2) && !c->radar_detect_widths))
@@ -503,8 +501,7 @@ static int wiphy_verify_combinations(struct wiphy *wiphy)
if (WARN_ON(!c->num_different_channels))
return -EINVAL;

-   /*
-* Put a sane limit on maximum number of different
+   /* Put a sane limit on maximum number of different
 * channels to simplify channel accounting code.
 */
if (WARN_ON(c->num_different_channels >
@@ -540,8 +537,7 @@ static int wiphy_verify_combinations(struct wiphy *wiphy)
return -EINVAL;

cnt += c->limits[j].max;
-   /*
-* Don't advertise an unsupported type
+   /* Don't advertise an unsupported type
 * in a combination.
 */
if (WARN_ON((wiphy->interface_modes & types) != types))
@@ -581,8 +577,7 @@ int wiphy_register(struct wiphy *wiphy)
 !rdev->ops->tdls_cancel_channel_switch)))
return -EINVAL;

-   /*
-* if a wiphy has unsupported modes for regulatory channel enforc

[PATCH] cfg80211: Fix checkpatch issues

2016-05-28 Thread Kirtika Ruchandani
Fix the following issues reported by checkpatch.pl -
- document spinlock_t where needed/possible
- do not use multiple blank lines
- add blank line after a declaration
- use a trailing '*/' on a separate line in block comments
- don't use empty '/*' lines
- use ether_addr_copy instead of memcpy
- fix line over 80 chars
- match alignment of function arguments to open parentheses

Signed-off-by: Kirtika Ruchandani <kirtika.ruchand...@gmail.com>
---
 net/wireless/core.c | 73 +++--
 net/wireless/core.h | 33 +---
 2 files changed, 49 insertions(+), 57 deletions(-)

diff --git a/net/wireless/core.c b/net/wireless/core.c
index d25c82b..f7b14af 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -102,8 +102,7 @@ static int cfg80211_dev_check_name(struct 
cfg80211_registered_device *rdev,
digits = 1;
while (wiphy_idx /= 10)
digits++;
-   /*
-* deny the name if it is phy where  is printed
+   /* deny the name if it is phy where  is printed
 * without leading zeroes. taken == strlen(newname) here
 */
if (taken == strlen(PHY_NAME) + digits)
@@ -179,7 +178,7 @@ int cfg80211_switch_netns(struct cfg80211_registered_device 
*rdev,
continue;
wdev->netdev->features &= ~NETIF_F_NETNS_LOCAL;
err = dev_change_net_namespace(wdev->netdev, net,
-   "wlan%d");
+  "wlan%d");
WARN_ON(err);
wdev->netdev->features |= NETIF_F_NETNS_LOCAL;
}
@@ -267,7 +266,8 @@ static void cfg80211_rfkill_sync_work(struct work_struct 
*work)
 {
struct cfg80211_registered_device *rdev;

-   rdev = container_of(work, struct cfg80211_registered_device, 
rfkill_sync);
+   rdev = container_of(work, struct cfg80211_registered_device,
+   rfkill_sync);
cfg80211_rfkill_set_block(rdev, rfkill_blocked(rdev->rfkill));
 }

@@ -328,7 +328,7 @@ static void cfg80211_sched_scan_stop_wk(struct work_struct 
*work)
struct cfg80211_registered_device *rdev;

rdev = container_of(work, struct cfg80211_registered_device,
-  sched_scan_stop_wk);
+   sched_scan_stop_wk);

rtnl_lock();

@@ -461,15 +461,14 @@ use_default_name:

init_waitqueue_head(>dev_wait);

-   /*
-* Initialize wiphy parameters to IEEE 802.11 MIB default values.
+   /* Initialize wiphy parameters to IEEE 802.11 MIB default values.
 * Fragmentation and RTS threshold are disabled by default with the
 * special -1 value.
 */
rdev->wiphy.retry_short = 7;
rdev->wiphy.retry_long = 4;
-   rdev->wiphy.frag_threshold = (u32) -1;
-   rdev->wiphy.rts_threshold = (u32) -1;
+   rdev->wiphy.frag_threshold = (u32)-1;
+   rdev->wiphy.rts_threshold = (u32)-1;
rdev->wiphy.coverage_class = 0;

rdev->wiphy.max_num_csa_counters = 1;
@@ -492,8 +491,7 @@ static int wiphy_verify_combinations(struct wiphy *wiphy)

c = >iface_combinations[i];

-   /*
-* Combinations with just one interface aren't real,
+   /* Combinations with just one interface aren't real,
 * however we make an exception for DFS.
 */
if (WARN_ON((c->max_interfaces < 2) && !c->radar_detect_widths))
@@ -503,8 +501,7 @@ static int wiphy_verify_combinations(struct wiphy *wiphy)
if (WARN_ON(!c->num_different_channels))
return -EINVAL;

-   /*
-* Put a sane limit on maximum number of different
+   /* Put a sane limit on maximum number of different
 * channels to simplify channel accounting code.
 */
if (WARN_ON(c->num_different_channels >
@@ -540,8 +537,7 @@ static int wiphy_verify_combinations(struct wiphy *wiphy)
return -EINVAL;

cnt += c->limits[j].max;
-   /*
-* Don't advertise an unsupported type
+   /* Don't advertise an unsupported type
 * in a combination.
 */
if (WARN_ON((wiphy->interface_modes & types) != types))
@@ -581,8 +577,7 @@ int wiphy_register(struct wiphy *wiphy)
 !rdev->ops->tdls_cancel_channel_switch)))
return -EINVAL;

-   /*
-* if a wiphy has unsupported modes for regulatory channel enforc