Support for Killer/Wireless-AC 9260 wireless cards

2018-07-29 Thread R . Alejandro Oquendo Muñoz
Hi,
Are there any plans to officially support "Killer/Wireless-AC 9260
wireless cards" in Linux 4.19?
For now this card works using this patch [1] in Manjaro, and also
works for Archlinux distro [2].

Thanks,
Alejandro

[1] "Subject: [PATCH] iwlwifi: add killer cards for 9000 series"
https://gitlab.manjaro.org/packages/core/linux418/blob/master/0001-iwlwifi-killer-ac-1550.patch
[2] https://bugs.archlinux.org/task/59202
-- 
 _
 _ __ __|  |   ___
|  '__/  _` |  /  _  \
|  |  |  (_|  | |  (_)  |
|_|   \__,_|___ \___/
|_|
l.u. #425157


ath9k_htc: ANI debug with RX errors output

2018-07-29 Thread Tom Psyborg
Hi

Doing some throughput tests I've noticed there are many CCK errors which
mainly occur while receiving data. OFDM errors counted are far less in
numbers than CCK ones, also appearing more often while receiving data. When
transmitting data, the amount of these errors is almost insignificant.

debug output:

ANI: ENABLED
ANI RESET: 82
OFDM LEVEL: 0
CCK LEVEL: 0
SPUR UP: 0
SPUR DOWN: 0
OFDM WS-DET ON: 0
OFDM WS-DET OFF: 0
MRC-CCK ON: 0
MRC-CCK OFF: 0
FIR-STEP UP: 485
FIR-STEP DOWN: 487
INV LISTENTIME: 0
OFDM ERRORS: 83944
CCK ERRORS: 1119852

While receiving data at 16Mbps CCK LEVEL was 0, receiving data at
24Mbps CCK LEVEL was 8! Transmitting data at 24Mbps CCK LEVEL was 0, but
receiving at 16Mbps and transmitting at 8Mbps CCK LEVEL was again 8! Does
that mean the remote AP is creating a lot of CCK noise for some reason? It
does run in g-only mode and OFDM levels stayed at 0 during whole time of
data transfers.

How efficient it would be to patch htc driver so it runs in OFDM mode only?


Re: [PATCH v3] PCI: Add PCI_DEVICE_DATA() macro to fully describe device ID entry

2018-07-29 Thread Andy Shevchenko
On Sun, 2018-07-29 at 15:49 +0300, Andy Shevchenko wrote:
> On Fri, 2018-07-27 at 16:10 -0500, Bjorn Helgaas wrote:

> Do you think variant with ##vend##dev is better? I will update it for
> v4
> if needed.

Okay, I have sent v4 with your comment addressed.

-- 
Andy Shevchenko 
Intel Finland Oy


Re: ath9k and 16 VAP interfaces?

2018-07-29 Thread Tom Psyborg
some people claim it is hardware limit

On 27 July 2018 at 15:35, Ben Greear  wrote:

> Hello,
>
> Has anyone tried making ath9k able to support 16 vAP interfaces on a single
> radio?  I seem to recall that there were limitations regarding beacon
> timers and such, and that is why the current limit is 8?
>
> Thanks,
> Ben
>
> --
> Ben Greear 
> Candela Technologies Inc  http://www.candelatech.com
>


[PATCH v4] PCI: Add PCI_DEVICE_DATA() macro to fully describe device ID entry

2018-07-29 Thread Andy Shevchenko
There are a lot of examples in the kernel where PCI_VDEVICE() is used and still
looks not so convenient due to additional driver_data field attached.

Introduce PCI_DEVICE_DATA() macro to fully describe device ID entry in shortest
possible form. For example,

  before:

{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MRFLD),
  (kernel_ulong_t) _pci_mrfld_properties, },

  after:

{ PCI_DEVICE_DATA(INTEL, MRFLD, _pci_mrfld_properties) },

Drivers can be converted later on in independent way.

While here, remove the unused macro with the same name
from Ralink wireless driver.

Signed-off-by: Andy Shevchenko 
---

- Add vend to the device (Bjorn)

Bjorn, this also looks good.

 drivers/net/wireless/ralink/rt2x00/rt2x00pci.h |  6 --
 include/linux/pci.h| 15 +++
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00pci.h 
b/drivers/net/wireless/ralink/rt2x00/rt2x00pci.h
index bc0ca5f58f38..283e2e607bba 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00pci.h
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00pci.h
@@ -27,12 +27,6 @@
 #include 
 #include 
 
-/*
- * This variable should be used with the
- * pci_driver structure initialization.
- */
-#define PCI_DEVICE_DATA(__ops) .driver_data = (kernel_ulong_t)(__ops)
-
 /*
  * PCI driver handlers.
  */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index d0961aefdbae..fe060114a647 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -825,6 +825,21 @@ struct pci_driver {
.vendor = PCI_VENDOR_ID_##vend, .device = (dev), \
.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, 0, 0
 
+/**
+ * PCI_DEVICE_DATA - macro used to describe a specific PCI device in very 
short form
+ * @vend: the vendor name (without PCI_VENDOR_ID_ prefix)
+ * @dev: the device name (without PCI_DEVICE_ID__ prefix)
+ * @data: the driver data to be filled
+ *
+ * This macro is used to create a struct pci_device_id that matches a
+ * specific PCI device.  The subvendor, and subdevice fields will be set
+ * to PCI_ANY_ID.
+ */
+#define PCI_DEVICE_DATA(vend, dev, data) \
+   .vendor = PCI_VENDOR_ID_##vend, .device = PCI_DEVICE_ID_##vend##_##dev, 
\
+   .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, 0, 0, \
+   .driver_data = (kernel_ulong_t)(data)
+
 enum {
PCI_REASSIGN_ALL_RSRC   = 0x0001,   /* Ignore firmware setup */
PCI_REASSIGN_ALL_BUS= 0x0002,   /* Reassign all bus numbers */
-- 
2.18.0



Re: [PATCH v3] PCI: Add PCI_DEVICE_DATA() macro to fully describe device ID entry

2018-07-29 Thread Andy Shevchenko
On Fri, 2018-07-27 at 16:10 -0500, Bjorn Helgaas wrote:
> On Fri, Jul 27, 2018 at 11:49:44PM +0300, Andy Shevchenko wrote:
> > There are a lot of examples in the kernel where PCI_VDEVICE() is
> > used and still
> > looks not so convenient due to additional driver_data field
> > attached.
> > 
> > Introduce PCI_DEVICE_DATA() macro to fully describe device ID entry
> > in shortest
> > possible form. For example,
> > 
> >   before:
> > 
> > { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MRFLD),
> >   (kernel_ulong_t) _pci_mrfld_properties, },
> > 
> >   after:
> > 
> > { PCI_DEVICE_DATA(INTEL, INTEL_MRFLD,
> > _pci_mrfld_properties) },
> 
> Most device IDs include the vendor ID; did you consider pasting the
> vendor ID string into the device ID, so you would end up with this?
> 
> { PCI_DEVICE_DATA(INTEL, MRFLD, _pci_mrfld_properties) },

While it makes it slightly shorter, it breaks consistency among such
macros. I don't see any of them is using something like
PCI_DEVICE_ID_##vend##dev.

Though I see few users outside of PCI subsystem that reinvent above
line.

Do you think variant with ##vend##dev is better? I will update it for v4
if needed.

> I don't absolutely love either PCI_VDEVICE or PCI_DEVICE_DATA because
> grep doesn't work as well to find uses of the symbol, but the existing
> 2300 uses of PCI_VDEVICE are telling me pretty loudly to just get over
> it :)


-- 
Andy Shevchenko 
Intel Finland Oy


[PATCH] cfg80211/mac80211: make ieee80211_send_layer2_update a public function

2018-07-29 Thread Dedy Lansky
Make ieee80211_send_layer2_update() a common function so other drivers
can re-use it.
Add support in wil6210 to send L2UF on behalf of newly associated
station by calling the common function.

Change-Id: Ic2daa1b8392122931103eb5a963e14f8270818bb
Signed-off-by: Dedy Lansky 
---
 drivers/net/wireless/ath/wil6210/wmi.c |  2 ++
 include/net/cfg80211.h | 11 
 net/mac80211/cfg.c | 48 ++
 net/wireless/util.c| 45 +++
 4 files changed, 60 insertions(+), 46 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/wmi.c 
b/drivers/net/wireless/ath/wil6210/wmi.c
index 5d99124..e63d136 100644
--- a/drivers/net/wireless/ath/wil6210/wmi.c
+++ b/drivers/net/wireless/ath/wil6210/wmi.c
@@ -962,6 +962,8 @@ static void wmi_evt_connect(struct wil6210_vif *vif, int 
id, void *d, int len)
}
 
cfg80211_new_sta(ndev, evt->bssid, sinfo, GFP_KERNEL);
+   if (wdev->iftype == NL80211_IFTYPE_AP)
+   cfg80211_send_layer2_update(ndev, 
wil->sta[evt->cid].addr);
 
kfree(sinfo);
} else {
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 9a85097..4f57f77 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -4733,6 +4733,17 @@ const u8 *cfg80211_find_vendor_ie(unsigned int oui, int 
oui_type,
  const u8 *ies, int len);
 
 /**
+ * cfg80211_send_layer2_update - send layer 2 update frame
+ *
+ * @dev: network device
+ * @addr: STA MAC address
+ *
+ * Wireless drivers can use this function to update forwarding tables in bridge
+ * devices upon STA association.
+ */
+void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr);
+
+/**
  * DOC: Regulatory enforcement infrastructure
  *
  * TODO
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index d25da0e..da1b85d 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1092,50 +1092,6 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct 
net_device *dev)
return 0;
 }
 
-/* Layer 2 Update frame (802.2 Type 1 LLC XID Update response) */
-struct iapp_layer2_update {
-   u8 da[ETH_ALEN];/* broadcast */
-   u8 sa[ETH_ALEN];/* STA addr */
-   __be16 len; /* 6 */
-   u8 dsap;/* 0 */
-   u8 ssap;/* 0 */
-   u8 control;
-   u8 xid_info[3];
-} __packed;
-
-static void ieee80211_send_layer2_update(struct sta_info *sta)
-{
-   struct iapp_layer2_update *msg;
-   struct sk_buff *skb;
-
-   /* Send Level 2 Update Frame to update forwarding tables in layer 2
-* bridge devices */
-
-   skb = dev_alloc_skb(sizeof(*msg));
-   if (!skb)
-   return;
-   msg = skb_put(skb, sizeof(*msg));
-
-   /* 802.2 Type 1 Logical Link Control (LLC) Exchange Identifier (XID)
-* Update response frame; IEEE Std 802.2-1998, 5.4.1.2.1 */
-
-   eth_broadcast_addr(msg->da);
-   memcpy(msg->sa, sta->sta.addr, ETH_ALEN);
-   msg->len = htons(6);
-   msg->dsap = 0;
-   msg->ssap = 0x01;   /* NULL LSAP, CR Bit: Response */
-   msg->control = 0xaf;/* XID response lsb.F101.
-* F=0 (no poll command; unsolicited frame) */
-   msg->xid_info[0] = 0x81;/* XID format identifier */
-   msg->xid_info[1] = 1;   /* LLC types/classes: Type 1 LLC */
-   msg->xid_info[2] = 0;   /* XID sender's receive window size (RW) */
-
-   skb->dev = sta->sdata->dev;
-   skb->protocol = eth_type_trans(skb, sta->sdata->dev);
-   memset(skb->cb, 0, sizeof(skb->cb));
-   netif_rx_ni(skb);
-}
-
 static int sta_apply_auth_flags(struct ieee80211_local *local,
struct sta_info *sta,
u32 mask, u32 set)
@@ -1499,7 +1455,7 @@ static int ieee80211_add_station(struct wiphy *wiphy, 
struct net_device *dev,
}
 
if (layer2_update)
-   ieee80211_send_layer2_update(sta);
+   cfg80211_send_layer2_update(sta->sdata->dev, sta->sta.addr);
 
rcu_read_unlock();
 
@@ -1601,7 +1557,7 @@ static int ieee80211_change_station(struct wiphy *wiphy,
if (test_sta_flag(sta, WLAN_STA_AUTHORIZED))
ieee80211_vif_inc_num_mcast(sta->sdata);
 
-   ieee80211_send_layer2_update(sta);
+   cfg80211_send_layer2_update(sta->sdata->dev, sta->sta.addr);
}
 
err = sta_apply_parameters(local, sta, params);
diff --git a/net/wireless/util.c b/net/wireless/util.c
index e0825a0..7bdcfe1 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -1893,3 +1893,48 @@ int cfg80211_sinfo_alloc_tid_stats(struct station_info 
*sinfo, gfp_t gfp)
 const unsigned char bridge_tunnel_header[] __aligned(2) =
{ 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 };
 

[PATCH 8/8] staging: wilc1000: added parentheses in macro to avoid checkpatch issue

2018-07-29 Thread Ajay Singh
Cleanup patch to fix below checkpatch reported issue:

Macro argument 'id' may be better as '(id)' to avoid precedence issues

Also updated the TODO file to remove the below item
 'rework comments and function headers(also coding style)'

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/TODO| 1 -
 drivers/staging/wilc1000/wilc_wlan.h | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/TODO b/drivers/staging/wilc1000/TODO
index 6fd3a4c..862e9ea 100644
--- a/drivers/staging/wilc1000/TODO
+++ b/drivers/staging/wilc1000/TODO
@@ -1,4 +1,3 @@
 TODO:
-- rework comments and function headers(also coding style)
 - support soft-ap and p2p mode
 - support resume/suspend function
diff --git a/drivers/staging/wilc1000/wilc_wlan.h 
b/drivers/staging/wilc1000/wilc_wlan.h
index 696cf1f..cd1ff85 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -4,7 +4,7 @@
 
 #include 
 
-#define ISWILC1000(id) ((id & 0xf000) == 0x10 ? 1 : 0)
+#define ISWILC1000(id) (((id) & 0xf000) == 0x10 ? 1 : 0)
 
 /
  *
-- 
2.7.4



[PATCH 7/8] staging: wilc1000: replace udelay with usleep_range

2018-07-29 Thread Ajay Singh
Cleanup patch to avoid the below checkpatch reported issue.

"usleep_range is preferred over udelay; see
Documentation/timers/timers-howto.txt".

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wlan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 6bac3f7..655952a 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -425,7 +425,7 @@ void chip_wakeup(struct wilc *wilc)
} while (wilc_get_chipid(wilc, true) == 0);
} else if ((wilc->io_type & 0x1) == HIF_SDIO) {
wilc->hif_func->hif_write_reg(wilc, 0xfa, 1);
-   udelay(200);
+   usleep_range(200, 201);
wilc->hif_func->hif_read_reg(wilc, 0xf0, );
do {
wilc->hif_func->hif_write_reg(wilc, 0xf0,
-- 
2.7.4



[PATCH 5/8] staging: wilc1000: added comments for 'hif_cs' mutex lock

2018-07-29 Thread Ajay Singh
Added comments for 'hif_cs' mutex to avoid checkpatch.pl reported
issues.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 371a87f..a0e2e11 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -130,6 +130,7 @@ struct wilc {
spinlock_t txq_spinlock;
/*protect rxq_entry_t receiver queue*/
struct mutex rxq_cs;
+   /* lock to protect hif access */
struct mutex hif_cs;
 
struct completion cfg_event;
-- 
2.7.4



[PATCH 2/8] staging: wilc1000: remove unnecessary comments and comments description

2018-07-29 Thread Ajay Singh
Cleanup patch to remove the unnecessary comments and commented code.
Also updated description for few of comments.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c |  4 ++--
 drivers/staging/wilc1000/linux_mon.c  | 15 ---
 drivers/staging/wilc1000/wilc_debugfs.c   | 11 ---
 drivers/staging/wilc1000/wilc_sdio.c  | 10 +-
 drivers/staging/wilc1000/wilc_spi.c   |  1 -
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  5 -
 drivers/staging/wilc1000/wilc_wlan.h  |  6 --
 drivers/staging/wilc1000/wilc_wlan_cfg.c  |  5 -
 8 files changed, 11 insertions(+), 46 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index c78b51a..d960147 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -230,7 +230,7 @@ static int wilc_enqueue_work(struct host_if_msg *msg)
return 0;
 }
 
-/* The u8IfIdx starts from 0 to NUM_CONCURRENT_IFC -1, but 0 index used as
+/* The idx starts from 0 to (NUM_CONCURRENT_IFC - 1), but 0 index used as
  * special purpose in wilc device, so we add 1 to the index to starts from 1.
  * As a result, the returned index will be 1 to NUM_CONCURRENT_IFC.
  */
@@ -242,7 +242,7 @@ int wilc_get_vif_idx(struct wilc_vif *vif)
 /* We need to minus 1 from idx which is from wilc device to get real index
  * of wilc->vif[], because we add 1 when pass to wilc device in the function
  * wilc_get_vif_idx.
- * As a result, the index should be between 0 and NUM_CONCURRENT_IFC -1.
+ * As a result, the index should be between 0 and (NUM_CONCURRENT_IFC - 1).
  */
 static struct wilc_vif *wilc_get_vif_from_idx(struct wilc *wilc, int idx)
 {
diff --git a/drivers/staging/wilc1000/linux_mon.c 
b/drivers/staging/wilc1000/linux_mon.c
index 14405bf..fa49588 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -63,7 +63,7 @@ void wilc_wfi_monitor_rx(u8 *buff, u32 size)
 
cb_hdr->hdr.it_present = cpu_to_le32(TX_RADIOTAP_PRESENT);
 
-   cb_hdr->rate = 5; /* txrate->bitrate / 5; */
+   cb_hdr->rate = 5;
 
if (pkt_offset & IS_MGMT_STATUS_SUCCES) {
/* success */
@@ -84,8 +84,8 @@ void wilc_wfi_monitor_rx(u8 *buff, u32 size)
hdr->hdr.it_version = 0; /* PKTHDR_RADIOTAP_VERSION; */
hdr->hdr.it_len = cpu_to_le16(sizeof(*hdr));
hdr->hdr.it_present = cpu_to_le32
-   (1 << IEEE80211_RADIOTAP_RATE); /* | */
-   hdr->rate = 5; /* txrate->bitrate / 5; */
+   (1 << IEEE80211_RADIOTAP_RATE);
+   hdr->rate = 5;
}
 
skb->dev = wilc_wfi_mon;
@@ -178,7 +178,7 @@ static netdev_tx_t wilc_wfi_mon_xmit(struct sk_buff *skb,
 
cb_hdr->hdr.it_present = cpu_to_le32(TX_RADIOTAP_PRESENT);
 
-   cb_hdr->rate = 5; /* txrate->bitrate / 5; */
+   cb_hdr->rate = 5;
cb_hdr->tx_flags = 0x0004;
 
skb2->dev = wilc_wfi_mon;
@@ -194,11 +194,12 @@ static netdev_tx_t wilc_wfi_mon_xmit(struct sk_buff *skb,
}
skb->dev = mon_priv->real_ndev;
 
-   /* Identify if Ethernet or MAC header (data or mgmt) */
memcpy(srcadd, >data[10], 6);
memcpy(bssid, >data[16], 6);
-   /* if source address and bssid fields are equal>>Mac header */
-   /*send it to mgmt frames handler */
+   /*
+* Identify if data or mgmt packet, if source address and bssid
+* fields are equal send it to mgmt frames handler
+*/
if (!(memcmp(srcadd, bssid, 6))) {
ret = mon_mgmt_tx(mon_priv->real_ndev, skb->data, skb->len);
if (ret)
diff --git a/drivers/staging/wilc1000/wilc_debugfs.c 
b/drivers/staging/wilc1000/wilc_debugfs.c
index ecbf3db..ac26e94 100644
--- a/drivers/staging/wilc1000/wilc_debugfs.c
+++ b/drivers/staging/wilc1000/wilc_debugfs.c
@@ -18,9 +18,6 @@
 
 static struct dentry *wilc_dir;
 
-/*
- * 
- */
 #define DEBUG   BIT(0)
 #define INFOBIT(1)
 #define WRN BIT(2)
@@ -29,10 +26,6 @@ static struct dentry *wilc_dir;
 #define DBG_LEVEL_ALL  (DEBUG | INFO | WRN | ERR)
 static atomic_t WILC_DEBUG_LEVEL = ATOMIC_INIT(ERR);
 
-/*
- * 
- */
-
 static ssize_t wilc_debug_level_read(struct file *file, char __user *userbuf,
 size_t count, loff_t *ppos)
 {
@@ -76,10 +69,6 @@ static ssize_t wilc_debug_level_write(struct file *filp,
return count;
 }
 
-/*
- * 
- */
-
 #define FOPS(_open, _read, _write, _poll) { \
.owner  = THIS_MODULE, 

[PATCH 3/8] staging: wilc1000: remove unnecessary copyright information in file

2018-07-29 Thread Ajay Singh
Cleanup patch to remove the unnecessary copyright information in
the file, as it already has SPDX License Identifier.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_debugfs.c  | 10 --
 drivers/staging/wilc1000/wilc_sdio.c |  5 -
 drivers/staging/wilc1000/wilc_spi.c  |  5 -
 drivers/staging/wilc1000/wilc_wlan_cfg.c |  8 
 drivers/staging/wilc1000/wilc_wlan_cfg.h |  8 
 5 files changed, 36 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_debugfs.c 
b/drivers/staging/wilc1000/wilc_debugfs.c
index ac26e94..d86f457 100644
--- a/drivers/staging/wilc1000/wilc_debugfs.c
+++ b/drivers/staging/wilc1000/wilc_debugfs.c
@@ -1,14 +1,4 @@
 // SPDX-License-Identifier: GPL-2.0
-/*
- * NewportMedia WiFi chipset driver test tools - wilc-debug
- * Copyright (c) 2012 NewportMedia Inc.
- * Author: SSW 
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- */
 
 #if defined(WILC_DEBUGFS)
 #include 
diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
b/drivers/staging/wilc1000/wilc_sdio.c
index 0628237..9e9279c 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -1,9 +1,4 @@
 // SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (c) Atmel Corporation.  All rights reserved.
- *
- * Module Name:  wilc_sdio.c
- */
 
 #include 
 #include 
diff --git a/drivers/staging/wilc1000/wilc_spi.c 
b/drivers/staging/wilc1000/wilc_spi.c
index 5aa1f7b..ef2460c 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -1,9 +1,4 @@
 // SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (c) Atmel Corporation.  All rights reserved.
- *
- * Module Name:  wilc_spi.c
- */
 
 #include 
 
diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c 
b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index 331be7b..ec50eaf 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -1,12 +1,4 @@
 // SPDX-License-Identifier: GPL-2.0
-/* // 
*/
-/*  */
-/* Copyright (c) Atmel Corporation.  All rights reserved. */
-/*  */
-/* Module Name:  wilc_wlan_cfg.c */
-/*  */
-/*  */
-/* / */
 
 #include "wilc_wlan_if.h"
 #include "wilc_wlan.h"
diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.h 
b/drivers/staging/wilc1000/wilc_wlan_cfg.h
index 08092a5..d6c833b 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.h
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.h
@@ -1,12 +1,4 @@
 /* SPDX-License-Identifier: GPL-2.0 */
-/* // 
*/
-/*  */
-/* Copyright (c) Atmel Corporation.  All rights reserved. */
-/*  */
-/* Module Name:  wilc_wlan_cfg.h */
-/*  */
-/*  */
-/* / */
 
 #ifndef WILC_WLAN_CFG_H
 #define WILC_WLAN_CFG_H
-- 
2.7.4



[PATCH 6/8] staging: wilc1000: rename 'rcvd_ch_cnt' element in 'user_scan_req' struct

2018-07-29 Thread Ajay Singh
Cleanup patch to use shorter name for 'rcvd_ch_cnt' to 'ch_cnt' to avoid
line over 80 character issue reported by checkpatch.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c | 12 ++--
 drivers/staging/wilc1000/host_interface.h |  2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 0df4d9c..86d8aaf 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -792,7 +792,7 @@ static void handle_scan(struct work_struct *work)
goto error;
}
 
-   hif_drv->usr_scan_req.rcvd_ch_cnt = 0;
+   hif_drv->usr_scan_req.ch_cnt = 0;
 
wid_list[index].id = WID_SSID_PROBE_REQ;
wid_list[index].type = WID_STR;
@@ -1406,7 +1406,7 @@ static void handle_rcvd_ntwrk_info(struct work_struct 
*work)
goto done;
}
 
-   for (i = 0; i < scan_req->rcvd_ch_cnt; i++) {
+   for (i = 0; i < scan_req->ch_cnt; i++) {
if (memcmp(scan_req->net_info[i].bssid, info->bssid, 6) == 0) {
if (info->rssi <= scan_req->net_info[i].rssi) {
goto done;
@@ -1419,13 +1419,13 @@ static void handle_rcvd_ntwrk_info(struct work_struct 
*work)
}
 
if (found) {
-   if (scan_req->rcvd_ch_cnt < MAX_NUM_SCANNED_NETWORKS) {
-   scan_req->net_info[scan_req->rcvd_ch_cnt].rssi = 
info->rssi;
+   if (scan_req->ch_cnt < MAX_NUM_SCANNED_NETWORKS) {
+   scan_req->net_info[scan_req->ch_cnt].rssi = info->rssi;
 
-   memcpy(scan_req->net_info[scan_req->rcvd_ch_cnt].bssid,
+   memcpy(scan_req->net_info[scan_req->ch_cnt].bssid,
   info->bssid, 6);
 
-   scan_req->rcvd_ch_cnt++;
+   scan_req->ch_cnt++;
 
info->new_network = true;
params = host_int_parse_join_bss_param(info);
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 9a016c5..3ddeec2 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -199,7 +199,7 @@ struct hidden_network {
 struct user_scan_req {
wilc_scan_result scan_result;
void *arg;
-   u32 rcvd_ch_cnt;
+   u32 ch_cnt;
struct found_net_info net_info[MAX_NUM_SCANNED_NETWORKS];
 };
 
-- 
2.7.4



[PATCH 4/8] staging: wilc1000: modified debug log messages description

2018-07-29 Thread Ajay Singh
Cleanup patch to update the debug logs message to provide correct
information. Also added the function name tag for same description log
to help identify the place from where log was captured.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c | 134 +++---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  13 ++-
 drivers/staging/wilc1000/wilc_wlan.c  |   9 +-
 3 files changed, 80 insertions(+), 76 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index d960147..0df4d9c 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -342,7 +342,8 @@ static void handle_set_operation_mode(struct work_struct 
*work)
complete(_driver_comp);
 
if (ret)
-   netdev_err(vif->ndev, "Failed to set driver handler\n");
+   netdev_err(vif->ndev, "Failed to set operation mode\n");
+
kfree(msg);
 }
 
@@ -747,7 +748,7 @@ static int handle_scan_done(struct wilc_vif *vif, enum 
scan_event evt)
}
 
if (!hif_drv) {
-   netdev_err(vif->ndev, "Driver handler is NULL\n");
+   netdev_err(vif->ndev, "%s: hif driver is NULL\n", __func__);
return result;
}
 
@@ -1155,7 +1156,7 @@ static void handle_connect_timeout(struct work_struct 
*work)
struct host_if_drv *hif_drv = vif->hif_drv;
 
if (!hif_drv) {
-   netdev_err(vif->ndev, "Driver handler is NULL\n");
+   netdev_err(vif->ndev, "%s: hif driver is NULL\n", __func__);
goto out;
}
 
@@ -1187,7 +1188,7 @@ static void handle_connect_timeout(struct work_struct 
*work)
kfree(info.req_ies);
info.req_ies = NULL;
} else {
-   netdev_err(vif->ndev, "Connect callback is NULL\n");
+   netdev_err(vif->ndev, "%s: conn_result is NULL\n", __func__);
}
 
wid.id = WID_DISCONNECT;
@@ -1400,7 +1401,8 @@ static void handle_rcvd_ntwrk_info(struct work_struct 
*work)
 
wilc_parse_network_info(rcvd_info->buffer, );
if (!info || !scan_req->scan_result) {
-   netdev_err(vif->ndev, "driver is null\n");
+   netdev_err(vif->ndev, "%s: info or scan result NULL\n",
+  __func__);
goto done;
}
 
@@ -1519,7 +1521,7 @@ static inline void host_int_parse_assoc_resp_info(struct 
wilc_vif *vif,
if (mac_status == MAC_STATUS_CONNECTED &&
conn_info.status != WLAN_STATUS_SUCCESS) {
netdev_err(vif->ndev,
-  "Received MAC status is MAC_STATUS_CONNECTED while 
the received status code in Asoc Resp is not SUCCESSFUL_STATUSCODE\n");
+  "Received MAC status is MAC_STATUS_CONNECTED, Assoc 
Resp is not SUCCESS\n");
eth_zero_addr(wilc_connected_ssid);
} else if (mac_status == MAC_STATUS_DISCONNECTED){
netdev_err(vif->ndev, "Received MAC status is 
MAC_STATUS_DISCONNECTED\n");
@@ -1594,7 +1596,7 @@ static inline void host_int_handle_disconnect(struct 
wilc_vif *vif)
conn_result(CONN_DISCONN_EVENT_DISCONN_NOTIF, NULL, 0,
_info, hif_drv->usr_conn_req.arg);
} else {
-   netdev_err(vif->ndev, "Connect result NULL\n");
+   netdev_err(vif->ndev, "%s: conn_result is NULL\n", __func__);
}
 
eth_zero_addr(hif_drv->assoc_bssid);
@@ -1613,12 +1615,12 @@ static void handle_rcvd_gnrl_async_info(struct 
work_struct *work)
struct host_if_drv *hif_drv = vif->hif_drv;
 
if (!rcvd_info->buffer) {
-   netdev_err(vif->ndev, "Received buffer is NULL\n");
+   netdev_err(vif->ndev, "%s: buffer is NULL\n", __func__);
goto free_msg;
}
 
if (!hif_drv) {
-   netdev_err(vif->ndev, "Driver handler is NULL\n");
+   netdev_err(vif->ndev, "%s: hif driver is NULL\n", __func__);
goto free_rcvd_info;
}
 
@@ -1626,7 +1628,8 @@ static void handle_rcvd_gnrl_async_info(struct 
work_struct *work)
hif_drv->hif_state == HOST_IF_CONNECTED ||
hif_drv->usr_scan_req.scan_result) {
if (!hif_drv->usr_conn_req.conn_result) {
-   netdev_err(vif->ndev, "driver is null\n");
+   netdev_err(vif->ndev, "%s: conn_result is NULL\n",
+  __func__);
goto free_rcvd_info;
}
 
@@ -1969,7 +1972,7 @@ static void handle_disconnect(struct work_struct *work)
conn_req->conn_result(CONN_DISCONN_EVENT_DISCONN_NOTIF, NULL,
  0, _info, conn_req->arg);
} else {
-   netdev_err(vif->ndev, "conn_result = NULL\n");
+   

[PATCH 0/8] staging: wilc1000: changes to address TODO items

2018-07-29 Thread Ajay Singh
This patch series contains changes to address below TODO items.
- rework comments and function headers(also coding style)
   All checkpatch reported issues related to coding style are addressed
   except DT compatible string un-documented. Checkpatch warning related to
   DT compatible string warning will be removed once "microchip,wilc1000-sdio"
   & microchip,wilc1000-spi" reference is move to
   ./Documentation/devicetree/bindings/ .

- make spi and sdio components coexist in one build
  Instead of compiling wilc1000.ko module separately compile it along with
  wilc1000-sdio.ko & wilc1000-spi.ko module.


Ajay Singh (8):
  staging: wilc1000: fix TODO to compile spi and sdio components in
single module
  staging: wilc1000: remove unnecessary comments and comments
description
  staging: wilc1000: remove unnecessary copyright information in file
  staging: wilc1000: modified debug log messages description
  staging: wilc1000: added comments for 'hif_cs' mutex lock
  staging: wilc1000: rename 'rcvd_ch_cnt' element in 'user_scan_req'
struct
  staging: wilc1000: replace udelay with usleep_range
  staging: wilc1000: added parentheses in macro to avoid checkpatch
issue

 drivers/staging/wilc1000/Makefile |   3 +-
 drivers/staging/wilc1000/TODO |   2 -
 drivers/staging/wilc1000/host_interface.c | 150 +++---
 drivers/staging/wilc1000/host_interface.h |   2 +-
 drivers/staging/wilc1000/linux_mon.c  |  15 ++-
 drivers/staging/wilc1000/linux_wlan.c |   6 +-
 drivers/staging/wilc1000/wilc_debugfs.c   |  28 +---
 drivers/staging/wilc1000/wilc_sdio.c  |  15 +--
 drivers/staging/wilc1000/wilc_spi.c   |   6 -
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  13 +-
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |   6 +-
 drivers/staging/wilc1000/wilc_wlan.c  |  17 +--
 drivers/staging/wilc1000/wilc_wlan.h  |   8 +-
 drivers/staging/wilc1000/wilc_wlan_cfg.c  |  13 --
 drivers/staging/wilc1000/wilc_wlan_cfg.h  |   8 --
 drivers/staging/wilc1000/wilc_wlan_if.h   |   2 +
 16 files changed, 109 insertions(+), 185 deletions(-)

-- 
2.7.4



[PATCH 1/8] staging: wilc1000: fix TODO to compile spi and sdio components in single module

2018-07-29 Thread Ajay Singh
Changes to compile module component along with SPI and SDIO module.
Previously 'wilc1000.ko' used to generate along with wilc-spi.ko or
wilc1000-sdio.ko module. After these changes only wilc1000-spi.ko or
wilc1000-sdio.ko modules are required for SPI and SDIO respectively.
These changes are done to address below TODO item.

- make SPI and SDIO components coexist in one build

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/Makefile   | 3 ++-
 drivers/staging/wilc1000/TODO   | 1 -
 drivers/staging/wilc1000/linux_wlan.c   | 6 ++
 drivers/staging/wilc1000/wilc_debugfs.c | 7 ++-
 drivers/staging/wilc1000/wilc_wlan.c| 6 --
 drivers/staging/wilc1000/wilc_wlan_if.h | 2 ++
 6 files changed, 8 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/wilc1000/Makefile 
b/drivers/staging/wilc1000/Makefile
index ee7e26b..f7b07c0 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -1,5 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0
-obj-$(CONFIG_WILC1000) += wilc1000.o
 
 ccflags-y += -DFIRMWARE_1002=\"atmel/wilc1002_firmware.bin\" \
-DFIRMWARE_1003=\"atmel/wilc1003_firmware.bin\"
@@ -12,7 +11,9 @@ wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o 
linux_mon.o \
wilc_wlan.o
 
 obj-$(CONFIG_WILC1000_SDIO) += wilc1000-sdio.o
+wilc1000-sdio-objs += $(wilc1000-objs)
 wilc1000-sdio-objs += wilc_sdio.o
 
 obj-$(CONFIG_WILC1000_SPI) += wilc1000-spi.o
+wilc1000-spi-objs += $(wilc1000-objs)
 wilc1000-spi-objs += wilc_spi.o
diff --git a/drivers/staging/wilc1000/TODO b/drivers/staging/wilc1000/TODO
index 3d82bb0..6fd3a4c 100644
--- a/drivers/staging/wilc1000/TODO
+++ b/drivers/staging/wilc1000/TODO
@@ -1,5 +1,4 @@
 TODO:
 - rework comments and function headers(also coding style)
-- make spi and sdio components coexist in one build
 - support soft-ap and p2p mode
 - support resume/suspend function
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 64c5d69..c9e771a 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1033,8 +1033,8 @@ void wilc_netdev_cleanup(struct wilc *wilc)
}
 
kfree(wilc);
+   wilc_debugfs_remove();
 }
-EXPORT_SYMBOL_GPL(wilc_netdev_cleanup);
 
 static const struct net_device_ops wilc_netdev_ops = {
.ndo_init = mac_init_fn,
@@ -1057,6 +1057,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
if (!wl)
return -ENOMEM;
 
+   wilc_debugfs_init();
*wilc = wl;
wl->io_type = io_type;
wl->hif_func = ops;
@@ -1118,6 +1119,3 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
 
return 0;
 }
-EXPORT_SYMBOL_GPL(wilc_netdev_init);
-
-MODULE_LICENSE("GPL");
diff --git a/drivers/staging/wilc1000/wilc_debugfs.c 
b/drivers/staging/wilc1000/wilc_debugfs.c
index 287c11b..ecbf3db 100644
--- a/drivers/staging/wilc1000/wilc_debugfs.c
+++ b/drivers/staging/wilc1000/wilc_debugfs.c
@@ -28,7 +28,6 @@ static struct dentry *wilc_dir;
 
 #define DBG_LEVEL_ALL  (DEBUG | INFO | WRN | ERR)
 static atomic_t WILC_DEBUG_LEVEL = ATOMIC_INIT(ERR);
-EXPORT_SYMBOL_GPL(WILC_DEBUG_LEVEL);
 
 /*
  * 
@@ -105,7 +104,7 @@ static struct wilc_debugfs_info_t debugfs_info[] = {
},
 };
 
-static int __init wilc_debugfs_init(void)
+int wilc_debugfs_init(void)
 {
int i;
struct wilc_debugfs_info_t *info;
@@ -121,12 +120,10 @@ static int __init wilc_debugfs_init(void)
}
return 0;
 }
-module_init(wilc_debugfs_init);
 
-static void __exit wilc_debugfs_remove(void)
+void wilc_debugfs_remove(void)
 {
debugfs_remove_recursive(wilc_dir);
 }
-module_exit(wilc_debugfs_remove);
 
 #endif
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index ea2e77f..61dca05 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -407,7 +407,6 @@ void chip_allow_sleep(struct wilc *wilc)
wilc->hif_func->hif_write_reg(wilc, 0xf0, reg & ~BIT(0));
wilc->hif_func->hif_write_reg(wilc, 0xfa, 0);
 }
-EXPORT_SYMBOL_GPL(chip_allow_sleep);
 
 void chip_wakeup(struct wilc *wilc)
 {
@@ -462,7 +461,6 @@ void chip_wakeup(struct wilc *wilc)
}
chip_ps_state = CHIP_WAKEDUP;
 }
-EXPORT_SYMBOL_GPL(chip_wakeup);
 
 void wilc_chip_sleep_manually(struct wilc *wilc)
 {
@@ -476,7 +474,6 @@ void wilc_chip_sleep_manually(struct wilc *wilc)
chip_ps_state = CHIP_SLEEPING_MANUAL;
release_bus(wilc, RELEASE_ONLY);
 }
-EXPORT_SYMBOL_GPL(wilc_chip_sleep_manually);
 
 void host_wakeup_notify(struct wilc *wilc)
 {
@@ -484,7 +481,6 @@ void host_wakeup_notify(struct wilc *wilc)
wilc->hif_func->hif_write_reg(wilc, 0x10b0, 1);
release_bus(wilc, RELEASE_ONLY);
 }
-EXPORT_SYMBOL_GPL(host_wakeup_notify);
 
 void