pull-request mwifiex-firmware 2018-07-20

2018-07-19 Thread Ganapathi Bhat
The following changes since commit e1abab618308110789a4c27db543d132fd62e89f:

  linux-firmware: update Marvell USB8997 firmware image to add WPA2 
vulnerability fix (2018-05-07 17:54:42 +0530)

are available in the git repository at:

  git://git.marvell.com/mwifiex-firmware.git

for you to fetch changes up to 0ced724f6ed564a5e1602808163db7cfa4697f39:

  linux-firmware: update Marvell USB8801 B0 firmware image (2018-07-20 11:00:29 
+0530)


Ganapathi Bhat (1):
  linux-firmware: update Marvell USB8801 B0 firmware image

 WHENCE  |   2 +-
 mrvl/usb8801_uapsta.bin | Bin 255948 -> 250940 bytes
 2 files changed, 1 insertion(+), 1 deletion(-)



Re: [PATCH 05/23] staging: wilc1000: rename goto to avoid leading '_' in label name

2018-07-19 Thread Ajay Singh
Hi Dan,

On Thu, 19 Jul 2018 12:27:44 +0300
Dan Carpenter  wrote:

> On Thu, Jul 19, 2018 at 04:15:01AM +0530, Ajay Singh wrote:
> > diff --git a/drivers/staging/wilc1000/wilc_wlan.c
> > b/drivers/staging/wilc1000/wilc_wlan.c index 85af365..8e71c28 100644
> > --- a/drivers/staging/wilc1000/wilc_wlan.c
> > +++ b/drivers/staging/wilc1000/wilc_wlan.c
> > @@ -850,13 +850,13 @@ static void wilc_wlan_handle_isr_ext(struct
> > wilc *wilc, u32 int_status) if (wilc->rx_buffer)
> > buffer = >rx_buffer[offset];
> > else
> > -   goto _end_;
> > +   goto end;  
> 
> This isn't related to your patch but this goto doesn't appear to make
> any sort of sense.  I have no idea what was intended.
> 

Thanks for pointing it out. I will include these changes in separate
patchset.

Yes, the position of goto label can be moved just before
wilc_wlan_handle_rxq(wilc), as 'ret' will always be '0' when goto
statement is executed.

Actually earlier there were few more goto statement in this function
and single label 'end' was used to handle for different cases. But in
previous cleanup patches those cases were removed.
Now this function can be further refactor by either moving
goto label before wilc_wlan_handle_rxq(wilc) or avoid goto use by
adding the rx_buffer validation along with size check.

i.e 

end:
wilc_wlan_handle_rxq(wilc)


OR

if (size > 0 && wilc->rx_buffer) {


}
wilc_wlan_handle_rxq(wilc)



> >  
> > wilc->hif_func->hif_clear_int_ext(wilc,
> >   DATA_INT_CLR |
> > ENABLE_RX_VMM); ret = wilc->hif_func->hif_block_rx_ext(wilc, 0,
> > buffer, size); 
> > -_end_:
> > +end:
> > if (ret) {
> > offset += size;
> > wilc->rx_buffer_offset = offset;  
> 
> regards,
> dan carpenter
> 
> ___
> devel mailing list
> de...@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[PATCH v5] iw: ack signal support for tx ack packets

2018-07-19 Thread Balaji Pothunoori
This patch is to display the average ack signal,
last ack signal of tx ack packets.

Signed-off-by: Balaji Pothunoori 
---
v5:
 * Rebased, No changes
v4:
 * Changed the subject
 * Added last ack signal support and renamed avg ack signal macro
v3:
 * Added version no
v2:
 * Removed nl80211.h changes and modified the commit log

 station.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/station.c b/station.c
index 38c5f91..fd38043 100644
--- a/station.c
+++ b/station.c
@@ -308,6 +308,8 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
[NL80211_STA_INFO_TID_STATS] = { .type = NLA_NESTED },
[NL80211_STA_INFO_BSS_PARAM] = { .type = NLA_NESTED },
[NL80211_STA_INFO_RX_DURATION] = { .type = NLA_U64 },
+   [NL80211_STA_INFO_ACK_SIGNAL] = {.type = NLA_U8 },
+   [NL80211_STA_INFO_ACK_SIGNAL_AVG] = { .type = NLA_U8 },
};
char *chain;
 
@@ -409,6 +411,14 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
printf("\n\trx duration:\t%lld us",
   (unsigned long 
long)nla_get_u64(sinfo[NL80211_STA_INFO_RX_DURATION]));
 
+   if (sinfo[NL80211_STA_INFO_ACK_SIGNAL])
+   printf("\n\tlast ack signal:%d dBm",
+   (int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_ACK_SIGNAL]));
+
+   if (sinfo[NL80211_STA_INFO_ACK_SIGNAL_AVG])
+   printf("\n\tavg ack signal:\t%d dBm",
+   
(int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_ACK_SIGNAL_AVG]));
+
if (sinfo[NL80211_STA_INFO_EXPECTED_THROUGHPUT]) {
uint32_t thr;
 
-- 
2.7.4



Re: [RFC v2 1/4] mac80211: Add TXQ scheduling API

2018-07-19 Thread Toke Høiland-Jørgensen
Rajkumar Manoharan  writes:

> On 2018-07-13 06:39, Toke Høiland-Jørgensen wrote:
>> Rajkumar Manoharan  writes:
>> 
> [...]
>
>>> Hmm... I thought driver will call ieee80211_schedule_txq when it runs
>>> out of hardware descriptor and break the loop. The serving txq will be
>>> added back to head of activeq list. no?
>> 
>> Yes, and then the next one will be serviced... It's basically:
>> 
>> while (!hwq_is_full()) {
>>  txq = next_txq():
>>  build_one_aggr(txq); // may or may not succeed
>>  if (!empty(txq))
>>schedule_txq(txq);
>> }
>> 
>> It is not generally predictable how many times this will loop before
>> exiting...
>> 
> Agree.. It would be better If the driver does not worry about txq
> sequence numbering. Perhaps one more API (ieee80211_first_txq) could
> solve this. Will leave it to you.

That is basically what the second parameter to next_txq() does in the
current patchset. It just needs to be renamed...

> 
> ieee80211_txq_get_depth
>   - return deficit status along with frm_cnt
> 
> ieee80211_reorder_txq
>   - if txq deficit > 0
> - return;
>   - if txq is last
>  - return
>   - delete txq from list
>   - move it to tail
>   - update deficit by quantum
> 
> ath10k_htt_rx_tx_fetch_ind
>   - get txq deficit status
>   - if txq deficit > 0
> - dequeue skb
>   - else if deficit < 0
> - return NULL
> 
> Please share your thoughts.
 
 Hmm, not sure exactly how this would work; seems a little 
 complicated?
 Also, I'd rather if drivers were completely oblivious to the deficit;
 that is a bit of an implementation detail...
 
>>> Agree.. Initially I thought of adding deficit check in
>>> ieee80211_tx_dequeue.
>>> But It will be overhead of taking activeq_lock for every skbs. Perhaps
>>> it can be renamed as allowed_to_dequeue instead of deficit.
>>> 
 We could have an ieee80211_txq_may_pull(); or maybe just have
 ieee80211_tx_dequeue() return NULL if the deficit is negative?
 
>>> As I said earlier, checking deficit for every skb will be an overhead.
>>> It should be done once before accessing txq.
>> 
>> Well, it could conceivably be done in a way that doesn't require taking
>> the activeq_lock. Adding another STOP flag to the TXQ, for instance.
>> From an API point of view I think that is more consistent with what we
>> have already...
>> 
>
> Make sense. ieee80211_txq_may_pull would be better place to decide
> whether given txq is allowed for transmission. It also makes drivers
> do not have to worry about deficit. Still I may need
> ieee80211_reorder_txq API after processing txq. isn't it?

The way I was assuming this would work (and what ath9k does), is that a
driver only operates on one TXQ at a time; so it can get that txq,
process it, and re-schedule it. In which case no other API is needed;
the rotating can be done in next_txq(), and schedule_txq() can insert
the txq back into the rotation as needed.

However, it sounds like this is not how ath10k does things? See below.

 the reasonable thing for the driver to do, then, would be to ask
 ieee80211_next_txq() for another TXQ to pull from if the current one
 doesn't work for whatever reason.
 
 Would that work for push-pull mode?
 
>>> Not really. Driver shouldn't send other txq data instead of asked one.
>> 
>> I didn't necessarily mean immediately. As long as it does it 
>> eventually.
>> If a TXQ's deficit runs negative, that TXQ will not be allowed to send
>> again until its deficit has been restored to positive through enough
>> cycles of the loop in next_txq().
>> 
>
> Thats true. Are you suggesting to run the loop until the txq deficit
> becomes positive?

Yeah, or rather until the first station with a positive deficit is
found.

>>> In MU-MIMO, firmware will query N packets from given set of {STA,TID}.
>>> So the driver not supposed to send other txq's data.
>> 
>> Hmm, it'll actually be interesting to see how the airtime fairness
>> scheduler interacts with MU-MIMO. I'm not quite sure that it'll be in a
>> good way; the DRR scheduler generally only restores one TXQ to positive
>> deficit at a time, so it may be that MU-MIMO will break completely and
>> we'll have to come up with another scheduling algorithm.
>> 
>
> In push-pull method, driver reports to firmware that number of frames
> queued for each tid per station by wake_tx_queue. Later firmware will
> query N frames from each TID and after dequeue driver will update
> remaining frames for that tid. In ATF case, when driver is not able to
> dequeue frames, driver will simply update remaining frames. The
> consecutive fetch_ind get opportunity to dequeue the frames. By This
> way, transmission for serving client will be paused for a while and
> opportunity will be given to others.

This sounds like the driver doesn't do anything other than notify the

Re: [PATCH 05/23] staging: wilc1000: rename goto to avoid leading '_' in label name

2018-07-19 Thread Dan Carpenter
On Thu, Jul 19, 2018 at 04:15:01AM +0530, Ajay Singh wrote:
> diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
> b/drivers/staging/wilc1000/wilc_wlan.c
> index 85af365..8e71c28 100644
> --- a/drivers/staging/wilc1000/wilc_wlan.c
> +++ b/drivers/staging/wilc1000/wilc_wlan.c
> @@ -850,13 +850,13 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, 
> u32 int_status)
>   if (wilc->rx_buffer)
>   buffer = >rx_buffer[offset];
>   else
> - goto _end_;
> + goto end;

This isn't related to your patch but this goto doesn't appear to make
any sort of sense.  I have no idea what was intended.

>  
>   wilc->hif_func->hif_clear_int_ext(wilc,
> DATA_INT_CLR | ENABLE_RX_VMM);
>   ret = wilc->hif_func->hif_block_rx_ext(wilc, 0, buffer, size);
>  
> -_end_:
> +end:
>   if (ret) {
>   offset += size;
>   wilc->rx_buffer_offset = offset;

regards,
dan carpenter



Re: [PATCH 00/23] staging: wilc1000: cleanup patch to follow linux coding style

2018-07-19 Thread Claudiu Beznea
Reviewed-by: Claudiu Beznea 


On 19.07.2018 01:44, Ajay Singh wrote:
> This patch series contains modification to follow Linux coding style &
> cleanup change to remove unused variables and enums.
> Few patches also contain changes to remove unnecessary typecast.
> 
> Ajay Singh (23):
>   staging: wilc1000: remove unused enum declaration
>   staging: wilc1000: remove enum connect_status instead use
> ieee80211_statuscode
>   staging: wilc1000: remove extra enum defined for data rates
>   staging: wilc1000: remove extra enums defined for ieee80211_eid
>   staging: wilc1000: rename goto to avoid leading '_' in label name
>   staging: wilc1000: rename enum CURRENT_TXRATE to use lowercase
>   staging: wilc1000: rename enum SITESURVEY to use lowercase
>   staging: wilc1000: rename enum AUTHTYPE to use lowercase
>   staging: wilc1000: remove unused elements in 'wilc' struct
>   staging: wilc1000: remove unnecessary elements from 'wilc_priv' struct
>   staging: wilc1000: removed unused element from wilc_cfg_frame struct
>   staging: wilc1000: remove the mutliple #define used for same macro
>   staging: wilc1000: use lowercase for 'IFC_UP' struct element name
>   staging: wilc1000: remove unnecessary blank line between variable
> declaration
>   staging: wilc1000: use single space before opening brances '{'
>   staging: wilc1000: remove unnecessary type used for wid id
>   staging: wilc1000: avoid forward declaration for handle_scan_done()
>   staging: wilc1000: avoid host_int_get_assoc_res_info() forward
> declaration
>   staging: wilc1000: avoid forward declaration of
> host_int_parse_join_bss_param()
>   staging: wilc1000: avoid setting default value for variable at
> declaration
>   staging: wilc1000: use 'int' inplace of 's32' date type
>   staging: wilc1000: remove unnecessary 'NULL' check from cfg80211_ops
> callbacks
>   staging: wilc1000: move variable assignment along with its declaration
> 
>  drivers/staging/wilc1000/coreconfigurator.c   |  84 +--
>  drivers/staging/wilc1000/coreconfigurator.h   |  20 -
>  drivers/staging/wilc1000/host_interface.c | 696 
> +++---
>  drivers/staging/wilc1000/host_interface.h |  20 +-
>  drivers/staging/wilc1000/linux_mon.c  |   2 -
>  drivers/staging/wilc1000/linux_wlan.c | 122 ++--
>  drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 307 +++---
>  drivers/staging/wilc1000/wilc_wfi_netdevice.h |  16 +-
>  drivers/staging/wilc1000/wilc_wlan.c  |  65 +-
>  drivers/staging/wilc1000/wilc_wlan.h  |   3 -
>  drivers/staging/wilc1000/wilc_wlan_if.h   |  56 +-
>  11 files changed, 517 insertions(+), 874 deletions(-)
> 


[PATCH 23/23] staging: wilc1000: move variable assignment along with its declaration

2018-07-19 Thread Ajay Singh
Cleanup patch to club the variable assignment along with the variable
declaration especially for private data.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c |   7 +-
 drivers/staging/wilc1000/linux_wlan.c | 113 +++
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 229 +++---
 drivers/staging/wilc1000/wilc_wlan.c  |  53 ++---
 4 files changed, 118 insertions(+), 284 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index fb063e5..c78b51a 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -3429,13 +3429,10 @@ static void get_periodic_rssi(struct timer_list *unused)
 int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
 {
struct host_if_drv *hif_drv;
-   struct wilc_vif *vif;
-   struct wilc *wilc;
+   struct wilc_vif *vif = netdev_priv(dev);
+   struct wilc *wilc = vif->wilc;
int i;
 
-   vif = netdev_priv(dev);
-   wilc = vif->wilc;
-
hif_drv  = kzalloc(sizeof(*hif_drv), GFP_KERNEL);
if (!hif_drv)
return -ENOMEM;
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 5667a54..2f4bf8e 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -94,12 +94,9 @@ static int dev_state_ev_handler(struct notifier_block *this,
 
 static irqreturn_t isr_uh_routine(int irq, void *user_data)
 {
-   struct wilc_vif *vif;
-   struct wilc *wilc;
struct net_device *dev = user_data;
-
-   vif = netdev_priv(dev);
-   wilc = vif->wilc;
+   struct wilc_vif *vif = netdev_priv(dev);
+   struct wilc *wilc = vif->wilc;
 
if (wilc->close) {
netdev_err(dev, "Can't handle UH interrupt\n");
@@ -110,12 +107,9 @@ static irqreturn_t isr_uh_routine(int irq, void *user_data)
 
 static irqreturn_t isr_bh_routine(int irq, void *userdata)
 {
-   struct wilc_vif *vif;
-   struct wilc *wilc;
struct net_device *dev = userdata;
-
-   vif = netdev_priv(userdata);
-   wilc = vif->wilc;
+   struct wilc_vif *vif = netdev_priv(userdata);
+   struct wilc *wilc = vif->wilc;
 
if (wilc->close) {
netdev_err(dev, "Can't handle BH interrupt\n");
@@ -130,11 +124,8 @@ static irqreturn_t isr_bh_routine(int irq, void *userdata)
 static int init_irq(struct net_device *dev)
 {
int ret = 0;
-   struct wilc_vif *vif;
-   struct wilc *wl;
-
-   vif = netdev_priv(dev);
-   wl = vif->wilc;
+   struct wilc_vif *vif = netdev_priv(dev);
+   struct wilc *wl = vif->wilc;
 
if ((gpio_request(wl->gpio, "WILC_INTR") == 0) &&
(gpio_direction_input(wl->gpio) == 0)) {
@@ -163,11 +154,8 @@ static int init_irq(struct net_device *dev)
 
 static void deinit_irq(struct net_device *dev)
 {
-   struct wilc_vif *vif;
-   struct wilc *wilc;
-
-   vif = netdev_priv(dev);
-   wilc = vif->wilc;
+   struct wilc_vif *vif = netdev_priv(dev);
+   struct wilc *wilc = vif->wilc;
 
/* Deinitialize IRQ */
if (wilc->dev_irq_num) {
@@ -238,12 +226,9 @@ static int linux_wlan_txq_task(void *vp)
 {
int ret;
u32 txq_count;
-   struct wilc_vif *vif;
-   struct wilc *wl;
struct net_device *dev = vp;
-
-   vif = netdev_priv(dev);
-   wl = vif->wilc;
+   struct wilc_vif *vif = netdev_priv(dev);
+   struct wilc *wl = vif->wilc;
 
complete(>txq_thread_started);
while (1) {
@@ -271,15 +256,12 @@ static int linux_wlan_txq_task(void *vp)
 
 static int wilc_wlan_get_firmware(struct net_device *dev)
 {
-   struct wilc_vif *vif;
-   struct wilc *wilc;
+   struct wilc_vif *vif = netdev_priv(dev);
+   struct wilc *wilc = vif->wilc;
int chip_id, ret = 0;
const struct firmware *wilc_firmware;
char *firmware;
 
-   vif = netdev_priv(dev);
-   wilc = vif->wilc;
-
chip_id = wilc_get_chipid(wilc, false);
 
if (chip_id < 0x1003a0)
@@ -306,13 +288,10 @@ static int wilc_wlan_get_firmware(struct net_device *dev)
 
 static int linux_wlan_start_firmware(struct net_device *dev)
 {
-   struct wilc_vif *vif;
-   struct wilc *wilc;
+   struct wilc_vif *vif = netdev_priv(dev);
+   struct wilc *wilc = vif->wilc;
int ret = 0;
 
-   vif = netdev_priv(dev);
-   wilc = vif->wilc;
-
ret = wilc_wlan_start(wilc);
if (ret < 0)
return ret;
@@ -326,13 +305,10 @@ static int linux_wlan_start_firmware(struct net_device 
*dev)
 
 static int wilc1000_firmware_download(struct net_device *dev)
 {
-   struct wilc_vif *vif;
-   struct wilc *wilc;
+   struct wilc_vif *vif = netdev_priv(dev);
+   struct wilc *wilc = vif->wilc;
int ret = 0;
 
-   vif = 

[PATCH 21/23] staging: wilc1000: use 'int' inplace of 's32' date type

2018-07-19 Thread Ajay Singh
Cleanup patch to use 'int' instead of 's32' to have the same data type
based on its usage.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c | 48 +++
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 28 ++---
 2 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index d251a64..fb063e5 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -722,9 +722,9 @@ static void handle_cfg_param(struct work_struct *work)
kfree(msg);
 }
 
-static s32 handle_scan_done(struct wilc_vif *vif, enum scan_event evt)
+static int handle_scan_done(struct wilc_vif *vif, enum scan_event evt)
 {
-   s32 result = 0;
+   int result = 0;
u8 abort_running_scan;
struct wid wid;
struct host_if_drv *hif_drv = vif->hif_drv;
@@ -765,7 +765,7 @@ static void handle_scan(struct work_struct *work)
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
struct scan_attr *scan_info = >body.scan_info;
-   s32 result = 0;
+   int result = 0;
struct wid wid_list[5];
u32 index = 0;
u32 i;
@@ -883,7 +883,7 @@ static void handle_connect(struct work_struct *work)
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
struct connect_attr *conn_attr = >body.con_info;
-   s32 result = 0;
+   int result = 0;
struct wid wid_list[8];
u32 wid_cnt = 0, dummyval = 0;
u8 *cur_byte = NULL;
@@ -1148,7 +1148,7 @@ static void handle_connect_timeout(struct work_struct 
*work)
 {
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
-   s32 result;
+   int result;
struct connect_info info;
struct wid wid;
u16 dummy_reason_code = 0;
@@ -1454,7 +1454,7 @@ static s32 host_int_get_assoc_res_info(struct wilc_vif 
*vif,
   u32 max_assoc_resp_info_len,
   u32 *rcvd_assoc_resp_info_len)
 {
-   s32 result;
+   int result;
struct wid wid;
 
wid.id = WID_ASSOC_RES_INFO;
@@ -1926,7 +1926,7 @@ static void handle_disconnect(struct work_struct *work)
struct disconnect_info disconn_info;
struct user_scan_req *scan_req;
struct user_conn_req *conn_req;
-   s32 result;
+   int result;
u16 dummy_reason_code = 0;
 
wid.id = WID_DISCONNECT;
@@ -2004,7 +2004,7 @@ static void handle_get_rssi(struct work_struct *work)
 {
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
-   s32 result;
+   int result;
struct wid wid;
 
wid.id = WID_RSSI;
@@ -2084,7 +2084,7 @@ static void handle_get_inactive_time(struct work_struct 
*work)
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
struct sta_inactive_t *hif_sta_inactive = >body.mac_info;
-   s32 result;
+   int result;
struct wid wid;
 
wid.id = WID_SET_STA_MAC_INACTIVE_TIME;
@@ -2126,7 +2126,7 @@ static void handle_add_beacon(struct work_struct *work)
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
struct beacon_attr *param = >body.beacon_info;
-   s32 result;
+   int result;
struct wid wid;
u8 *cur_byte;
 
@@ -2181,7 +2181,7 @@ static void handle_del_beacon(struct work_struct *work)
 {
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
-   s32 result;
+   int result;
struct wid wid;
u8 del_beacon = 0;
 
@@ -2232,7 +2232,7 @@ static void handle_add_station(struct work_struct *work)
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
struct add_sta_param *param = >body.add_sta_info;
-   s32 result;
+   int result;
struct wid wid;
u8 *cur_byte;
 
@@ -2263,7 +2263,7 @@ static void handle_del_all_sta(struct work_struct *work)
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
struct del_all_sta *param = >body.del_all_sta_info;
-   s32 result;
+   int result;
struct wid wid;
u8 *curr_byte;
u8 i;
@@ -2307,7 +2307,7 @@ static void handle_del_station(struct work_struct *work)
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
struct del_sta *param = >body.del_sta_info;
-   s32 result;
+   

[PATCH 22/23] staging: wilc1000: remove unnecessary 'NULL' check from cfg80211_ops callbacks

2018-07-19 Thread Ajay Singh
Cleanup patch to remove the unnecessary 'NULL' check used in 'cfg80211_ops'
callback functions.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 15 ---
 1 file changed, 15 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index ba6f9ed..2d44333 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1781,9 +1781,6 @@ static int set_power_mgmt(struct wiphy *wiphy, struct 
net_device *dev,
struct wilc_priv *priv;
struct wilc_vif *vif;
 
-   if (!wiphy)
-   return -ENOENT;
-
priv = wiphy_priv(wiphy);
vif = netdev_priv(priv->dev);
if (!priv->hif_drv)
@@ -1921,9 +1918,6 @@ static int stop_ap(struct wiphy *wiphy, struct net_device 
*dev)
struct wilc_vif *vif;
u8 null_bssid[ETH_ALEN] = {0};
 
-   if (!wiphy)
-   return -EFAULT;
-
priv = wiphy_priv(wiphy);
vif = netdev_priv(priv->dev);
 
@@ -1945,9 +1939,6 @@ static int add_station(struct wiphy *wiphy, struct 
net_device *dev,
struct add_sta_param sta_params = { {0} };
struct wilc_vif *vif;
 
-   if (!wiphy)
-   return -EFAULT;
-
priv = wiphy_priv(wiphy);
vif = netdev_priv(dev);
 
@@ -1986,9 +1977,6 @@ static int del_station(struct wiphy *wiphy, struct 
net_device *dev,
struct wilc_vif *vif;
struct sta_info *info;
 
-   if (!wiphy)
-   return -EFAULT;
-
priv = wiphy_priv(wiphy);
vif = netdev_priv(dev);
 
@@ -2013,9 +2001,6 @@ static int change_station(struct wiphy *wiphy, struct 
net_device *dev,
struct add_sta_param sta_params = { {0} };
struct wilc_vif *vif;
 
-   if (!wiphy)
-   return -EFAULT;
-
vif = netdev_priv(dev);
 
if (vif->iftype == AP_MODE || vif->iftype == GO_MODE) {
-- 
2.7.4



[PATCH 08/23] staging: wilc1000: rename enum AUTHTYPE to use lowercase

2018-07-19 Thread Ajay Singh
Cleanup patch to rename enum AUTHTYPE to lowercase.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c | 8 
 drivers/staging/wilc1000/host_interface.h | 6 +++---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +-
 drivers/staging/wilc1000/wilc_wlan_if.h   | 2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index a5c0ac5..0ffe205 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -26,7 +26,7 @@ struct host_if_wep_attr {
u8 key_len;
u8 index;
u8 mode;
-   enum AUTHTYPE auth_type;
+   enum authtype auth_type;
 };
 
 union host_if_key_attr {
@@ -62,7 +62,7 @@ struct connect_attr {
u8 security;
wilc_connect_result result;
void *arg;
-   enum AUTHTYPE auth_type;
+   enum authtype auth_type;
u8 ch;
void *params;
 };
@@ -2632,7 +2632,7 @@ int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const 
u8 *key, u8 len,
 }
 
 int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, const u8 *key, u8 len,
-   u8 index, u8 mode, enum AUTHTYPE auth_type)
+   u8 index, u8 mode, enum authtype auth_type)
 {
int result;
struct host_if_msg *msg;
@@ -2876,7 +2876,7 @@ int wilc_get_mac_address(struct wilc_vif *vif, u8 
*mac_addr)
 int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ssid,
  size_t ssid_len, const u8 *ies, size_t ies_len,
  wilc_connect_result connect_result, void *user_arg,
- u8 security, enum AUTHTYPE auth_type,
+ u8 security, enum authtype auth_type,
  u8 channel, void *join_params)
 {
int result = 0;
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 7f3e48c..79166a5 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -207,7 +207,7 @@ struct user_conn_req {
u8 *bssid;
u8 *ssid;
u8 security;
-   enum AUTHTYPE auth_type;
+   enum authtype auth_type;
size_t ssid_len;
u8 *ies;
size_t ies_len;
@@ -298,7 +298,7 @@ int wilc_set_wep_default_keyid(struct wilc_vif *vif, u8 
index);
 int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const u8 *key, u8 len,
 u8 index);
 int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, const u8 *key, u8 len,
-   u8 index, u8 mode, enum AUTHTYPE auth_type);
+   u8 index, u8 mode, enum authtype auth_type);
 int wilc_add_ptk(struct wilc_vif *vif, const u8 *ptk, u8 ptk_key_len,
 const u8 *mac_addr, const u8 *rx_mic, const u8 *tx_mic,
 u8 mode, u8 cipher_mode, u8 index);
@@ -314,7 +314,7 @@ int wilc_get_mac_address(struct wilc_vif *vif, u8 
*mac_addr);
 int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ssid,
  size_t ssid_len, const u8 *ies, size_t ies_len,
  wilc_connect_result connect_result, void *user_arg,
- u8 security, enum AUTHTYPE auth_type,
+ u8 security, enum authtype auth_type,
  u8 channel, void *join_params);
 int wilc_disconnect(struct wilc_vif *vif, u16 reason_code);
 int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 channel);
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 73606c3..8f1c595 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -678,7 +678,7 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
u32 i;
u32 sel_bssi_idx = UINT_MAX;
u8 security = NO_ENCRYPT;
-   enum AUTHTYPE auth_type = ANY;
+   enum authtype auth_type = ANY;
u32 cipher_group;
struct wilc_priv *priv;
struct host_if_drv *wfi_drv;
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h 
b/drivers/staging/wilc1000/wilc_wlan_if.h
index b82e149..73b57fb 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -131,7 +131,7 @@ enum {
WPA2_AES_TKIP   = 0x71, /* Aes or Tkip */
 };
 
-enum AUTHTYPE {
+enum authtype {
OPEN_SYSTEM = 1,
SHARED_KEY  = 2,
ANY = 3,
-- 
2.7.4



[PATCH 10/23] staging: wilc1000: remove unnecessary elements from 'wilc_priv' struct

2018-07-19 Thread Ajay Singh
Remove unused elements from 'wilc_priv' structure.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 4 
 drivers/staging/wilc1000/wilc_wfi_netdevice.h | 7 ---
 2 files changed, 11 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 8f1c595..1a27e81 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2276,8 +2276,6 @@ int wilc_init_host_int(struct net_device *net)
}
op_ifcs++;
 
-   priv->auto_rate_adjusted = false;
-
priv->p2p_listen_state = false;
 
mutex_init(>scan_req_lock);
@@ -2297,8 +2295,6 @@ int wilc_deinit_host_int(struct net_device *net)
priv = wdev_priv(net->ieee80211_ptr);
vif = netdev_priv(priv->dev);
 
-   priv->auto_rate_adjusted = false;
-
priv->p2p_listen_state = false;
 
op_ifcs--;
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 22f3486..87f8cdc 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -74,14 +74,10 @@ struct wilc_priv {
 
u8 associated_bss[ETH_ALEN];
struct sta_info assoc_stainfo;
-   struct net_device_stats stats;
-   u8 monitor_flag;
-   int status;
struct sk_buff *skb;
struct net_device *dev;
struct host_if_drv *hif_drv;
struct host_if_pmkid_attr pmkid_list;
-   struct wilc_wfi_stats netstats;
u8 wep_key[4][WLAN_KEY_LEN_WEP104];
u8 wep_key_len[4];
/* The real interface that the monitor is on */
@@ -91,9 +87,6 @@ struct wilc_priv {
u8 wilc_groupkey;
/* mutexes */
struct mutex scan_req_lock;
-   /*  */
-   bool auto_rate_adjusted;
-
bool p2p_listen_state;
 
 };
-- 
2.7.4



[PATCH 12/23] staging: wilc1000: remove the mutliple #define used for same macro

2018-07-19 Thread Ajay Singh
Moved the same #define in common header file instead of having their
declartion in different files.

Below macros are moved to header file:
TCP_ACK_FILTER_LINK_SPEED_THRESH
DEFAULT_LINK_SPEED
GET_PKT_OFFSET

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c | 3 ---
 drivers/staging/wilc1000/linux_mon.c  | 1 -
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 5 -
 drivers/staging/wilc1000/wilc_wfi_netdevice.h | 5 +
 4 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 0ffe205..8649225 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -6,9 +6,6 @@
 
 #define FALSE_FRMWR_CHANNEL100
 
-#define TCP_ACK_FILTER_LINK_SPEED_THRESH   54
-#define DEFAULT_LINK_SPEED 72
-
 #define REAL_JOIN_REQ  0
 
 struct host_if_wpa_attr {
diff --git a/drivers/staging/wilc1000/linux_mon.c 
b/drivers/staging/wilc1000/linux_mon.c
index 1c7e6e1..bd09611 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -20,7 +20,6 @@ static u8 bssid[6];
 
 #define IEEE80211_RADIOTAP_F_TX_RTS0x0004  /* used rts/cts handshake */
 #define IEEE80211_RADIOTAP_F_TX_FAIL   0x0001  /* failed due to excessive*/
-#define GET_PKT_OFFSET(a) (((a) >> 22) & 0x1ff)
 
 #define TX_RADIOTAP_PRESENT ((1 << IEEE80211_RADIOTAP_RATE) |  \
 (1 << IEEE80211_RADIOTAP_TX_FLAGS))
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 1a27e81..e561dce 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -77,11 +77,6 @@ static const struct wiphy_wowlan_support wowlan_support = {
.flags = WIPHY_WOWLAN_ANY
 };
 
-#define TCP_ACK_FILTER_LINK_SPEED_THRESH   54
-#define DEFAULT_LINK_SPEED 72
-
-#define GET_PKT_OFFSET(a) (((a) >> 22) & 0x1ff)
-
 static struct network_info 
last_scanned_shadow[MAX_NUM_SCANNED_NETWORKS_SHADOW];
 static u32 last_scanned_cnt;
 struct timer_list wilc_during_ip_timer;
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 87f8cdc..765681a 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -21,6 +21,11 @@
 
 #define NUM_REG_FRAME  2
 
+#define TCP_ACK_FILTER_LINK_SPEED_THRESH   54
+#define DEFAULT_LINK_SPEED 72
+
+#define GET_PKT_OFFSET(a) (((a) >> 22) & 0x1ff)
+
 struct wilc_wfi_stats {
unsigned long rx_packets;
unsigned long tx_packets;
-- 
2.7.4



[PATCH 07/23] staging: wilc1000: rename enum SITESURVEY to use lowercase

2018-07-19 Thread Ajay Singh
Cleanup patch to have enum in lowercase as per linux coding style.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index cc64b14..a5c0ac5 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -635,7 +635,7 @@ static void handle_cfg_param(struct work_struct *work)
i++;
}
if (param->flag & SITE_SURVEY) {
-   enum SITESURVEY enabled = param->site_survey_enabled;
+   enum site_survey enabled = param->site_survey_enabled;
 
if (enabled < 3) {
wid_list[i].id = WID_SITE_SURVEY;
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 64fc269..7f3e48c 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -113,7 +113,7 @@ struct cfg_param_attr {
u8 txop_prot_disabled;
u16 beacon_interval;
u16 dtim_period;
-   enum SITESURVEY site_survey_enabled;
+   enum site_survey site_survey_enabled;
u16 site_survey_scan_time;
u8 scan_source;
u16 active_scan_time;
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h 
b/drivers/staging/wilc1000/wilc_wlan_if.h
index af414d7..b82e149 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -138,7 +138,7 @@ enum AUTHTYPE {
IEEE8021= 5
 };
 
-enum SITESURVEY {
+enum site_survey {
SITE_SURVEY_1CH = 0,
SITE_SURVEY_ALL_CH  = 1,
SITE_SURVEY_OFF = 2
-- 
2.7.4



[PATCH 20/23] staging: wilc1000: avoid setting default value for variable at declaration

2018-07-19 Thread Ajay Singh
Cleanup patch to avoid setting default value for local variables and
also clubbed similar variables together.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/coreconfigurator.c   |  25 ++---
 drivers/staging/wilc1000/host_interface.c | 122 +++---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  20 ++--
 3 files changed, 79 insertions(+), 88 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 5933e4d..e09f10d 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -123,9 +123,7 @@ static inline void get_BSSID(u8 *data, u8 *bssid)
 
 static inline void get_ssid(u8 *data, u8 *ssid, u8 *p_ssid_len)
 {
-   u8 len = 0;
-   u8 i   = 0;
-   u8 j   = 0;
+   u8 i, j, len;
 
len = data[TAG_PARAM_OFFSET + 1];
j   = TAG_PARAM_OFFSET + 2;
@@ -198,18 +196,11 @@ static u8 get_current_channel_802_11n(u8 *msa, u16 rx_len)
 s32 wilc_parse_network_info(u8 *msg_buffer,
struct network_info **ret_network_info)
 {
-   struct network_info *network_info = NULL;
-   u8 msg_type = 0;
-   u16 wid_len  = 0;
-   u8 *wid_val = NULL;
-   u8 *msa = NULL;
-   u16 rx_len = 0;
-   u8 *tim_elm = NULL;
-   u8 *ies = NULL;
-   u16 ies_len = 0;
-   u8 index = 0;
-   u32 tsf_lo;
-   u32 tsf_hi;
+   struct network_info *network_info;
+   u8 *wid_val, *msa, *tim_elm, *ies;
+   u32 tsf_lo, tsf_hi;
+   u16 wid_len, rx_len, ies_len;
+   u8 msg_type, index;
 
msg_type = msg_buffer[0];
 
@@ -271,8 +262,8 @@ s32 wilc_parse_network_info(u8 *msg_buffer,
 s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
   struct connect_info *ret_conn_info)
 {
-   u8 *ies = NULL;
-   u16 ies_len = 0;
+   u8 *ies;
+   u16 ies_len;
 
ret_conn_info->status = get_asoc_status(buffer);
if (ret_conn_info->status == WLAN_STATUS_SUCCESS) {
diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 895a126..d251a64 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -259,7 +259,7 @@ static void handle_set_channel(struct work_struct *work)
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
struct channel_attr *hif_set_ch = >body.channel_info;
-   int ret = 0;
+   int ret;
struct wid wid;
 
wid.id = WID_CURRENT_CHANNEL;
@@ -280,10 +280,10 @@ static void handle_set_wfi_drv_handler(struct work_struct 
*work)
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
struct drv_handler *hif_drv_handler = >body.drv;
-   int ret = 0;
+   int ret;
struct wid wid;
u8 *currbyte, *buffer;
-   struct host_if_drv *hif_drv = NULL;
+   struct host_if_drv *hif_drv;
 
if (!vif->hif_drv || !hif_drv_handler)
goto free_msg;
@@ -327,7 +327,7 @@ static void handle_set_operation_mode(struct work_struct 
*work)
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
struct op_mode *hif_op_mode = >body.mode;
-   int ret = 0;
+   int ret;
struct wid wid;
 
wid.id = WID_SET_OPERATION_MODE;
@@ -352,7 +352,7 @@ static void handle_set_ip_address(struct work_struct *work)
struct wilc_vif *vif = msg->vif;
u8 *ip_addr = msg->body.ip_info.ip_addr;
u8 idx = msg->body.ip_info.idx;
-   int ret = 0;
+   int ret;
struct wid wid;
char firmware_ip_addr[4] = {0};
 
@@ -381,7 +381,7 @@ static void handle_get_ip_address(struct work_struct *work)
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
u8 idx = msg->body.ip_info.idx;
-   int ret = 0;
+   int ret;
struct wid wid;
 
wid.id = WID_IP_ADDRESS;
@@ -409,7 +409,7 @@ static void handle_get_mac_address(struct work_struct *work)
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
struct get_mac_addr *get_mac_addr = >body.get_mac_info;
-   int ret = 0;
+   int ret;
struct wid wid;
 
wid.id = WID_MAC_ADDR;
@@ -431,7 +431,7 @@ static void handle_cfg_param(struct work_struct *work)
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
struct cfg_param_attr *param = >body.cfg_info;
-   int ret = 0;
+   int ret;
struct wid wid_list[32];
struct host_if_drv *hif_drv = vif->hif_drv;
int i = 0;
@@ -1148,7 +1148,7 @@ static void 

[PATCH 16/23] staging: wilc1000: remove unnecessary type used for wid id

2018-07-19 Thread Ajay Singh
Cleanup patch to remove unnecessary typecast used while assigning the
WID ID.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c | 84 +++
 1 file changed, 42 insertions(+), 42 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 2f25175..85ecba8 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -264,7 +264,7 @@ static void handle_set_channel(struct work_struct *work)
int ret = 0;
struct wid wid;
 
-   wid.id = (u16)WID_CURRENT_CHANNEL;
+   wid.id = WID_CURRENT_CHANNEL;
wid.type = WID_CHAR;
wid.val = (char *)_set_ch->set_ch;
wid.size = sizeof(char);
@@ -307,7 +307,7 @@ static void handle_set_wfi_drv_handler(struct work_struct 
*work)
currbyte++;
*currbyte = (hif_drv_handler->name | (hif_drv_handler->mode << 1));
 
-   wid.id = (u16)WID_SET_DRV_HANDLER;
+   wid.id = WID_SET_DRV_HANDLER;
wid.type = WID_STR;
wid.val = (s8 *)buffer;
wid.size = DRV_HANDLER_SIZE;
@@ -332,7 +332,7 @@ static void handle_set_operation_mode(struct work_struct 
*work)
int ret = 0;
struct wid wid;
 
-   wid.id = (u16)WID_SET_OPERATION_MODE;
+   wid.id = WID_SET_OPERATION_MODE;
wid.type = WID_INT;
wid.val = (s8 *)_op_mode->mode;
wid.size = sizeof(u32);
@@ -363,7 +363,7 @@ static void handle_set_ip_address(struct work_struct *work)
 
memcpy(set_ip[idx], ip_addr, IP_ALEN);
 
-   wid.id = (u16)WID_IP_ADDRESS;
+   wid.id = WID_IP_ADDRESS;
wid.type = WID_STR;
wid.val = ip_addr;
wid.size = IP_ALEN;
@@ -386,7 +386,7 @@ static void handle_get_ip_address(struct work_struct *work)
int ret = 0;
struct wid wid;
 
-   wid.id = (u16)WID_IP_ADDRESS;
+   wid.id = WID_IP_ADDRESS;
wid.type = WID_STR;
wid.val = kmalloc(IP_ALEN, GFP_KERNEL);
wid.size = IP_ALEN;
@@ -414,7 +414,7 @@ static void handle_get_mac_address(struct work_struct *work)
int ret = 0;
struct wid wid;
 
-   wid.id = (u16)WID_MAC_ADDR;
+   wid.id = WID_MAC_ADDR;
wid.type = WID_STR;
wid.val = get_mac_addr->mac_addr;
wid.size = ETH_ALEN;
@@ -757,7 +757,7 @@ static void handle_scan(struct work_struct *work)
 
hif_drv->usr_scan_req.rcvd_ch_cnt = 0;
 
-   wid_list[index].id = (u16)WID_SSID_PROBE_REQ;
+   wid_list[index].id = WID_SSID_PROBE_REQ;
wid_list[index].type = WID_STR;
 
for (i = 0; i < hidden_net->n_ssids; i++)
@@ -851,7 +851,7 @@ static s32 handle_scan_done(struct wilc_vif *vif, enum 
scan_event evt)
 
if (evt == SCAN_EVENT_ABORTED) {
abort_running_scan = 1;
-   wid.id = (u16)WID_ABORT_RUNNING_SCAN;
+   wid.id = WID_ABORT_RUNNING_SCAN;
wid.type = WID_CHAR;
wid.val = (s8 *)_running_scan;
wid.size = sizeof(char);
@@ -976,19 +976,19 @@ static void handle_connect(struct work_struct *work)
wid_list[wid_cnt].size = hif_drv->usr_conn_req.ies_len;
wid_cnt++;
 
-   wid_list[wid_cnt].id = (u16)WID_11I_MODE;
+   wid_list[wid_cnt].id = WID_11I_MODE;
wid_list[wid_cnt].type = WID_CHAR;
wid_list[wid_cnt].size = sizeof(char);
wid_list[wid_cnt].val = (s8 *)_drv->usr_conn_req.security;
wid_cnt++;
 
-   wid_list[wid_cnt].id = (u16)WID_AUTH_TYPE;
+   wid_list[wid_cnt].id = WID_AUTH_TYPE;
wid_list[wid_cnt].type = WID_CHAR;
wid_list[wid_cnt].size = sizeof(char);
wid_list[wid_cnt].val = (s8 *)_drv->usr_conn_req.auth_type;
wid_cnt++;
 
-   wid_list[wid_cnt].id = (u16)WID_JOIN_REQ_EXTENDED;
+   wid_list[wid_cnt].id = WID_JOIN_REQ_EXTENDED;
wid_list[wid_cnt].type = WID_STR;
wid_list[wid_cnt].size = 112;
wid_list[wid_cnt].val = kmalloc(wid_list[wid_cnt].size, GFP_KERNEL);
@@ -1192,7 +1192,7 @@ static void handle_connect_timeout(struct work_struct 
*work)
netdev_err(vif->ndev, "Connect callback is NULL\n");
}
 
-   wid.id = (u16)WID_DISCONNECT;
+   wid.id = WID_DISCONNECT;
wid.type = WID_CHAR;
wid.val = (s8 *)_reason_code;
wid.size = sizeof(char);
@@ -1496,7 +1496,7 @@ static int wilc_pmksa_key_copy(struct wilc_vif *vif, 
struct key_attr *hif_key)
   hif_key->attr.pmkid.pmkidlist[i].pmkid, PMKID_LEN);
}
 
-   wid.id = (u16)WID_PMKID_INFO;
+   wid.id = WID_PMKID_INFO;
wid.type = WID_STR;
wid.val = (s8 *)key_buf;
wid.size = (hif_key->attr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1;
@@ -1524,7 +1524,7 @@ static void handle_key(struct work_struct *work)
case WEP:
 
if (hif_key->action & ADDKEY_AP) {
-   wid_list[0].id = (u16)WID_11I_MODE;
+   

[PATCH 14/23] staging: wilc1000: remove unnecessary blank line between variable declaration

2018-07-19 Thread Ajay Singh
Cleanup patch to remove the unnecessary blank line between variables
declaration inside the function.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/linux_mon.c  | 1 -
 drivers/staging/wilc1000/linux_wlan.c | 1 -
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 4 
 3 files changed, 6 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_mon.c 
b/drivers/staging/wilc1000/linux_mon.c
index bd09611..14405bf 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -147,7 +147,6 @@ static netdev_tx_t wilc_wfi_mon_xmit(struct sk_buff *skb,
 {
u32 rtap_len, ret = 0;
struct wilc_wfi_mon_priv  *mon_priv;
-
struct sk_buff *skb2;
struct wilc_wfi_radiotap_cb_hdr *cb_hdr;
 
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 84d3145..8f77435 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -780,7 +780,6 @@ static int mac_init_fn(struct net_device *ndev)
 static int wilc_mac_open(struct net_device *ndev)
 {
struct wilc_vif *vif;
-
unsigned char mac_add[ETH_ALEN] = {0};
int ret = 0;
int i = 0;
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index ebe7adc2..43003d8 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1250,7 +1250,6 @@ static int del_pmksa(struct wiphy *wiphy, struct 
net_device *netdev,
 {
u32 i;
s32 ret = 0;
-
struct wilc_priv *priv = wiphy_priv(wiphy);
 
for (i = 0; i < priv->pmkid_list.numpmkid; i++) {
@@ -1315,7 +1314,6 @@ static inline void wilc_wfi_cfg_parse_ch_attr(u8 *buf, u8 
ch_list_attr_idx,
 static void wilc_wfi_cfg_parse_rx_action(u8 *buf, u32 len)
 {
u32 index = 0;
-
u8 op_channel_attr_index = 0;
u8 channel_list_attr_index = 0;
 
@@ -1338,7 +1336,6 @@ static void wilc_wfi_cfg_parse_tx_action(u8 *buf, u32 
len, bool oper_ch,
 u8 iftype)
 {
u32 index = 0;
-
u8 op_channel_attr_index = 0;
u8 channel_list_attr_index = 0;
 
@@ -2261,7 +2258,6 @@ struct wireless_dev *wilc_create_wiphy(struct net_device 
*net,
 int wilc_init_host_int(struct net_device *net)
 {
int ret = 0;
-
struct wilc_priv *priv;
 
priv = wdev_priv(net->ieee80211_ptr);
-- 
2.7.4



[PATCH 17/23] staging: wilc1000: avoid forward declaration for handle_scan_done()

2018-07-19 Thread Ajay Singh
Reorder the function position in host interface to avoid forward
declaration of handle_scan_done().

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c | 77 +++
 1 file changed, 38 insertions(+), 39 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 85ecba8..eabe5c7 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -199,7 +199,6 @@ static u32 clients_count;
 
 static void *host_int_parse_join_bss_param(struct network_info *info);
 static int host_int_get_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx);
-static s32 handle_scan_done(struct wilc_vif *vif, enum scan_event evt);
 
 /* 'msg' should be free by the caller for syc */
 static struct host_if_msg*
@@ -724,6 +723,44 @@ static void handle_cfg_param(struct work_struct *work)
kfree(msg);
 }
 
+static s32 handle_scan_done(struct wilc_vif *vif, enum scan_event evt)
+{
+   s32 result = 0;
+   u8 abort_running_scan;
+   struct wid wid;
+   struct host_if_drv *hif_drv = vif->hif_drv;
+   struct user_scan_req *scan_req;
+
+   if (evt == SCAN_EVENT_ABORTED) {
+   abort_running_scan = 1;
+   wid.id = WID_ABORT_RUNNING_SCAN;
+   wid.type = WID_CHAR;
+   wid.val = (s8 *)_running_scan;
+   wid.size = sizeof(char);
+
+   result = wilc_send_config_pkt(vif, SET_CFG, , 1,
+ wilc_get_vif_idx(vif));
+
+   if (result) {
+   netdev_err(vif->ndev, "Failed to set abort running\n");
+   result = -EFAULT;
+   }
+   }
+
+   if (!hif_drv) {
+   netdev_err(vif->ndev, "Driver handler is NULL\n");
+   return result;
+   }
+
+   scan_req = _drv->usr_scan_req;
+   if (scan_req->scan_result) {
+   scan_req->scan_result(evt, NULL, scan_req->arg, NULL);
+   scan_req->scan_result = NULL;
+   }
+
+   return result;
+}
+
 static void handle_scan(struct work_struct *work)
 {
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
@@ -841,44 +878,6 @@ static void handle_scan(struct work_struct *work)
kfree(msg);
 }
 
-static s32 handle_scan_done(struct wilc_vif *vif, enum scan_event evt)
-{
-   s32 result = 0;
-   u8 abort_running_scan;
-   struct wid wid;
-   struct host_if_drv *hif_drv = vif->hif_drv;
-   struct user_scan_req *scan_req;
-
-   if (evt == SCAN_EVENT_ABORTED) {
-   abort_running_scan = 1;
-   wid.id = WID_ABORT_RUNNING_SCAN;
-   wid.type = WID_CHAR;
-   wid.val = (s8 *)_running_scan;
-   wid.size = sizeof(char);
-
-   result = wilc_send_config_pkt(vif, SET_CFG, , 1,
- wilc_get_vif_idx(vif));
-
-   if (result) {
-   netdev_err(vif->ndev, "Failed to set abort running\n");
-   result = -EFAULT;
-   }
-   }
-
-   if (!hif_drv) {
-   netdev_err(vif->ndev, "Driver handler is NULL\n");
-   return result;
-   }
-
-   scan_req = _drv->usr_scan_req;
-   if (scan_req->scan_result) {
-   scan_req->scan_result(evt, NULL, scan_req->arg, NULL);
-   scan_req->scan_result = NULL;
-   }
-
-   return result;
-}
-
 u8 wilc_connected_ssid[6] = {0};
 static void handle_connect(struct work_struct *work)
 {
-- 
2.7.4



[PATCH 13/23] staging: wilc1000: use lowercase for 'IFC_UP' struct element name

2018-07-19 Thread Ajay Singh
Cleanup patch to use lowercase for structure element name to follow
linux coding style.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.h | 2 +-
 drivers/staging/wilc1000/linux_wlan.c | 4 ++--
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 79166a5..9a016c5 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -277,7 +277,7 @@ struct host_if_drv {
struct timer_list remain_on_ch_timer;
struct wilc_vif *remain_on_ch_timer_vif;
 
-   bool IFC_UP;
+   bool ifc_up;
int driver_handler_id;
 };
 
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 032afc2..84d3145 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -45,7 +45,7 @@ static int dev_state_ev_handler(struct notifier_block *this,
switch (event) {
case NETDEV_UP:
if (vif->iftype == STATION_MODE || vif->iftype == CLIENT_MODE) {
-   hif_drv->IFC_UP = 1;
+   hif_drv->ifc_up = 1;
wilc_optaining_ip = false;
del_timer(_during_ip_timer);
}
@@ -65,7 +65,7 @@ static int dev_state_ev_handler(struct notifier_block *this,
 
case NETDEV_DOWN:
if (vif->iftype == STATION_MODE || vif->iftype == CLIENT_MODE) {
-   hif_drv->IFC_UP = 0;
+   hif_drv->ifc_up = 0;
wilc_optaining_ip = false;
}
 
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index e561dce..ebe7adc2 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -535,9 +535,9 @@ static void cfg_connect_result(enum conn_event 
conn_disconn_evt,
 
if (!wfi_drv->p2p_connect)
wlan_channel = INVALID_CHANNEL;
-   if (wfi_drv->IFC_UP && dev == wl->vif[1]->ndev)
+   if (wfi_drv->ifc_up && dev == wl->vif[1]->ndev)
disconn_info->reason = 3;
-   else if (!wfi_drv->IFC_UP && dev == wl->vif[1]->ndev)
+   else if (!wfi_drv->ifc_up && dev == wl->vif[1]->ndev)
disconn_info->reason = 1;
 
cfg80211_disconnected(dev, disconn_info->reason,
-- 
2.7.4



[PATCH 09/23] staging: wilc1000: remove unused elements in 'wilc' struct

2018-07-19 Thread Ajay Singh
Cleanup patch to remove unused elements from 'wilc' struct.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wfi_netdevice.h | 4 
 drivers/staging/wilc1000/wilc_wlan.c  | 6 --
 2 files changed, 10 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index fe18ae9..22f3486 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -157,12 +157,8 @@ struct wilc {
 
struct txq_entry_t txq_head;
int txq_entries;
-   int txq_exit;
 
struct rxq_entry_t rxq_head;
-   int rxq_exit;
-
-   unsigned char eth_src_address[NUM_CONCURRENT_IFC][6];
 
const struct firmware *firmware;
 
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 8e71c28..c77e5c8 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -527,7 +527,6 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 
*txq_count)
wilc = vif->wilc;
 
txb = wilc->tx_buffer;
-   wilc->txq_exit = 0;
 
if (wilc->quit)
goto out;
@@ -713,7 +712,6 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 
*txq_count)
 out:
mutex_unlock(>txq_add_to_head_cs);
 
-   wilc->txq_exit = 1;
*txq_count = wilc->txq_entries;
return ret;
 }
@@ -780,8 +778,6 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc)
u8 *buffer;
struct rxq_entry_t *rqe;
 
-   wilc->rxq_exit = 0;
-
do {
if (wilc->quit) {
complete(>cfg_event);
@@ -797,8 +793,6 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc)
 
kfree(rqe);
} while (1);
-
-   wilc->rxq_exit = 1;
 }
 
 static void wilc_unknown_isr_ext(struct wilc *wilc)
-- 
2.7.4



[PATCH 15/23] staging: wilc1000: use single space before opening brances '{'

2018-07-19 Thread Ajay Singh
Cleanup patch to use single space instead of multiple space before the
'{'.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c | 6 +++---
 drivers/staging/wilc1000/linux_wlan.c | 2 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +-
 drivers/staging/wilc1000/wilc_wlan.c  | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 8649225..2f25175 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -799,7 +799,7 @@ static void handle_scan(struct work_struct *work)
scan_info->ch_list_len > 0) {
int i;
 
-   for (i = 0; i < scan_info->ch_list_len; i++){
+   for (i = 0; i < scan_info->ch_list_len; i++) {
if (scan_info->ch_freq_list[i] > 0)
scan_info->ch_freq_list[i] -= 1;
}
@@ -3337,7 +3337,7 @@ int wilc_deinit(struct wilc_vif *vif)
int result = 0;
struct host_if_drv *hif_drv = vif->hif_drv;
 
-   if (!hif_drv)   {
+   if (!hif_drv) {
netdev_err(vif->ndev, "hif_drv = NULL\n");
return -EFAULT;
}
@@ -3404,7 +3404,7 @@ void wilc_network_info_received(struct wilc *wilc, u8 
*buffer, u32 length)
return;
hif_drv = vif->hif_drv;
 
-   if (!hif_drv || hif_drv == terminated_handle)   {
+   if (!hif_drv || hif_drv == terminated_handle) {
netdev_err(vif->ndev, "driver not init[%p]\n", hif_drv);
return;
}
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 8f77435..5667a54 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -604,7 +604,7 @@ static void wilc_wlan_deinitialize(struct net_device *dev)
return;
}
 
-   if (wl->initialized){
+   if (wl->initialized) {
netdev_info(dev, "Deinitializing wilc1000...\n");
 
if (!wl->dev_irq_num &&
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 43003d8..96aaf14 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -524,7 +524,7 @@ static void cfg_connect_result(enum conn_event 
conn_disconn_evt,
conn_info->resp_ies,
conn_info->resp_ies_len, connect_status,
GFP_KERNEL);
-   } else if (conn_disconn_evt == CONN_DISCONN_EVENT_DISCONN_NOTIF){
+   } else if (conn_disconn_evt == CONN_DISCONN_EVENT_DISCONN_NOTIF) {
wilc_optaining_ip = false;
p2p_local_random = 0x01;
p2p_recv_random = 0x00;
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index c77e5c8..cb8bfd2 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -436,7 +436,7 @@ void chip_wakeup(struct wilc *wilc)
wilc_get_chipid(wilc, true);
} while (wilc_get_chipid(wilc, true) == 0);
} while (wilc_get_chipid(wilc, true) == 0);
-   } else if ((wilc->io_type & 0x1) == HIF_SDIO){
+   } else if ((wilc->io_type & 0x1) == HIF_SDIO) {
wilc->hif_func->hif_write_reg(wilc, 0xfa, 1);
udelay(200);
wilc->hif_func->hif_read_reg(wilc, 0xf0, );
-- 
2.7.4



[PATCH 18/23] staging: wilc1000: avoid host_int_get_assoc_res_info() forward declaration

2018-07-19 Thread Ajay Singh
Reorder the function position in host interface to avoid forward
declaration of host_int_get_assoc_res_info().

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c | 47 ++-
 1 file changed, 21 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index eabe5c7..f49e849 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1287,7 +1287,27 @@ static void handle_rcvd_ntwrk_info(struct work_struct 
*work)
 static s32 host_int_get_assoc_res_info(struct wilc_vif *vif,
   u8 *assoc_resp_info,
   u32 max_assoc_resp_info_len,
-  u32 *rcvd_assoc_resp_info_len);
+  u32 *rcvd_assoc_resp_info_len)
+{
+   s32 result;
+   struct wid wid;
+
+   wid.id = WID_ASSOC_RES_INFO;
+   wid.type = WID_STR;
+   wid.val = assoc_resp_info;
+   wid.size = max_assoc_resp_info_len;
+
+   result = wilc_send_config_pkt(vif, GET_CFG, , 1,
+ wilc_get_vif_idx(vif));
+   if (result) {
+   *rcvd_assoc_resp_info_len = 0;
+   netdev_err(vif->ndev, "Failed to send association response\n");
+   return -EINVAL;
+   }
+
+   *rcvd_assoc_resp_info_len = wid.size;
+   return result;
+}
 
 static inline void host_int_free_user_conn_req(struct host_if_drv *hif_drv)
 {
@@ -2979,31 +2999,6 @@ int wilc_disconnect(struct wilc_vif *vif, u16 
reason_code)
return result;
 }
 
-static s32 host_int_get_assoc_res_info(struct wilc_vif *vif,
-  u8 *assoc_resp_info,
-  u32 max_assoc_resp_info_len,
-  u32 *rcvd_assoc_resp_info_len)
-{
-   s32 result = 0;
-   struct wid wid;
-
-   wid.id = WID_ASSOC_RES_INFO;
-   wid.type = WID_STR;
-   wid.val = assoc_resp_info;
-   wid.size = max_assoc_resp_info_len;
-
-   result = wilc_send_config_pkt(vif, GET_CFG, , 1,
- wilc_get_vif_idx(vif));
-   if (result) {
-   *rcvd_assoc_resp_info_len = 0;
-   netdev_err(vif->ndev, "Failed to send association response\n");
-   return -EINVAL;
-   }
-
-   *rcvd_assoc_resp_info_len = wid.size;
-   return result;
-}
-
 int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 channel)
 {
int result;
-- 
2.7.4



[PATCH 19/23] staging: wilc1000: avoid forward declaration of host_int_parse_join_bss_param()

2018-07-19 Thread Ajay Singh
Reorder the functions position in host interface to avoid forward
declaration of host_int_parse_join_bss_param().

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c | 333 +++---
 1 file changed, 166 insertions(+), 167 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index f49e849..895a126 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -197,7 +197,6 @@ static u8 set_ip[2][4];
 static u8 get_ip[2][4];
 static u32 clients_count;
 
-static void *host_int_parse_join_bss_param(struct network_info *info);
 static int host_int_get_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx);
 
 /* 'msg' should be free by the caller for syc */
@@ -1216,6 +1215,172 @@ static void handle_connect_timeout(struct work_struct 
*work)
kfree(msg);
 }
 
+static void host_int_fill_join_bss_param(struct join_bss_param *param, u8 *ies,
+u16 *out_index, u8 *pcipher_tc,
+u8 *auth_total_cnt, u32 tsf_lo,
+u8 *rates_no)
+{
+   u8 ext_rates_no;
+   u16 offset;
+   u8 pcipher_cnt;
+   u8 auth_cnt;
+   u8 i, j;
+   u16 index = *out_index;
+
+   if (ies[index] == WLAN_EID_SUPP_RATES) {
+   *rates_no = ies[index + 1];
+   param->supp_rates[0] = *rates_no;
+   index += 2;
+
+   for (i = 0; i < *rates_no; i++)
+   param->supp_rates[i + 1] = ies[index + i];
+
+   index += *rates_no;
+   } else if (ies[index] == WLAN_EID_EXT_SUPP_RATES) {
+   ext_rates_no = ies[index + 1];
+   if (ext_rates_no > (MAX_RATES_SUPPORTED - *rates_no))
+   param->supp_rates[0] = MAX_RATES_SUPPORTED;
+   else
+   param->supp_rates[0] += ext_rates_no;
+   index += 2;
+   for (i = 0; i < (param->supp_rates[0] - *rates_no); i++)
+   param->supp_rates[*rates_no + i + 1] = ies[index + i];
+
+   index += ext_rates_no;
+   } else if (ies[index] == WLAN_EID_HT_CAPABILITY) {
+   param->ht_capable = true;
+   index += ies[index + 1] + 2;
+   } else if ((ies[index] == WLAN_EID_VENDOR_SPECIFIC) &&
+  (ies[index + 2] == 0x00) && (ies[index + 3] == 0x50) &&
+  (ies[index + 4] == 0xF2) && (ies[index + 5] == 0x02) &&
+  ((ies[index + 6] == 0x00) || (ies[index + 6] == 0x01)) &&
+  (ies[index + 7] == 0x01)) {
+   param->wmm_cap = true;
+
+   if (ies[index + 8] & BIT(7))
+   param->uapsd_cap = true;
+   index += ies[index + 1] + 2;
+   } else if ((ies[index] == WLAN_EID_VENDOR_SPECIFIC) &&
+(ies[index + 2] == 0x50) && (ies[index + 3] == 0x6f) &&
+(ies[index + 4] == 0x9a) &&
+(ies[index + 5] == 0x09) && (ies[index + 6] == 0x0c)) {
+   u16 p2p_cnt;
+
+   param->tsf = tsf_lo;
+   param->noa_enabled = 1;
+   param->idx = ies[index + 9];
+
+   if (ies[index + 10] & BIT(7)) {
+   param->opp_enabled = 1;
+   param->ct_window = ies[index + 10];
+   } else {
+   param->opp_enabled = 0;
+   }
+
+   param->cnt = ies[index + 11];
+   p2p_cnt = index + 12;
+
+   memcpy(param->duration, ies + p2p_cnt, 4);
+   p2p_cnt += 4;
+
+   memcpy(param->interval, ies + p2p_cnt, 4);
+   p2p_cnt += 4;
+
+   memcpy(param->start_time, ies + p2p_cnt, 4);
+
+   index += ies[index + 1] + 2;
+   } else if ((ies[index] == WLAN_EID_RSN) ||
+((ies[index] == WLAN_EID_VENDOR_SPECIFIC) &&
+ (ies[index + 2] == 0x00) &&
+ (ies[index + 3] == 0x50) && (ies[index + 4] == 0xF2) &&
+ (ies[index + 5] == 0x01))) {
+   u16 rsn_idx = index;
+
+   if (ies[rsn_idx] == WLAN_EID_RSN) {
+   param->mode_802_11i = 2;
+   } else {
+   if (param->mode_802_11i == 0)
+   param->mode_802_11i = 1;
+   rsn_idx += 4;
+   }
+
+   rsn_idx += 7;
+   param->rsn_grp_policy = ies[rsn_idx];
+   rsn_idx++;
+   offset = ies[rsn_idx] * 4;
+   pcipher_cnt = (ies[rsn_idx] > 3) ? 3 : ies[rsn_idx];
+   rsn_idx += 2;
+
+   i = *pcipher_tc;
+   j = 0;
+   for (; i < (pcipher_cnt + *pcipher_tc) && i < 3; i++, j++) {
+   u8 *policy =  >rsn_pcip_policy[i];
+
+   

[PATCH 11/23] staging: wilc1000: removed unused element from wilc_cfg_frame struct

2018-07-19 Thread Ajay Singh
Cleanup up patch to remove the unused structure elements in
'wilc_cfg_frame' struct.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wlan.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.h 
b/drivers/staging/wilc1000/wilc_wlan.h
index dbdebf0..f29d1ea 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -255,9 +255,6 @@ struct wilc_hif_func {
 #define MAX_CFG_FRAME_SIZE 1468
 
 struct wilc_cfg_frame {
-   u8 ether_header[14];
-   u8 ip_header[20];
-   u8 udp_header[8];
u8 wid_header[8];
u8 frame[MAX_CFG_FRAME_SIZE];
 };
-- 
2.7.4



[PATCH 06/23] staging: wilc1000: rename enum CURRENT_TXRATE to use lowercase

2018-07-19 Thread Ajay Singh
Cleanup patch to rename enums in lowercase to follow linux coding style.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 7309b7e..cc64b14 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -695,7 +695,7 @@ static void handle_cfg_param(struct work_struct *work)
i++;
}
if (param->flag & CURRENT_TX_RATE) {
-   enum CURRENT_TXRATE curr_tx_rate = param->curr_tx_rate;
+   enum current_tx_rate curr_tx_rate = param->curr_tx_rate;
 
if (curr_tx_rate == AUTORATE || curr_tx_rate == MBPS_1 ||
curr_tx_rate == MBPS_2 || curr_tx_rate == MBPS_5_5 ||
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 3cd97dd..64fc269 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -81,7 +81,7 @@ struct host_if_pmkid_attr {
struct host_if_pmkid pmkidlist[WILC_MAX_NUM_PMKIDS];
 };
 
-enum CURRENT_TXRATE {
+enum current_tx_rate {
AUTORATE= 0,
MBPS_1  = 1,
MBPS_2  = 2,
@@ -118,7 +118,7 @@ struct cfg_param_attr {
u8 scan_source;
u16 active_scan_time;
u16 passive_scan_time;
-   enum CURRENT_TXRATE curr_tx_rate;
+   enum current_tx_rate curr_tx_rate;
 
 };
 
-- 
2.7.4



[PATCH 05/23] staging: wilc1000: rename goto to avoid leading '_' in label name

2018-07-19 Thread Ajay Singh
Cleanup patch to avoid use of leading '_' in goto label name. Also used
proper string for lable names.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 8 
 drivers/staging/wilc1000/wilc_wlan.c  | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index f90b9b6..73606c3 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2196,11 +2196,11 @@ static struct wireless_dev *wilc_wfi_cfg_alloc(void)
 
wdev = kzalloc(sizeof(*wdev), GFP_KERNEL);
if (!wdev)
-   goto _fail_;
+   goto out;
 
wdev->wiphy = wiphy_new(_cfg80211_ops, sizeof(struct wilc_priv));
if (!wdev->wiphy)
-   goto _fail_mem_;
+   goto free_mem;
 
wilc_band_2ghz.ht_cap.ht_supported = 1;
wilc_band_2ghz.ht_cap.cap |= (1 << IEEE80211_HT_CAP_RX_STBC_SHIFT);
@@ -2212,9 +2212,9 @@ static struct wireless_dev *wilc_wfi_cfg_alloc(void)
 
return wdev;
 
-_fail_mem_:
+free_mem:
kfree(wdev);
-_fail_:
+out:
return NULL;
 }
 
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 85af365..8e71c28 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -850,13 +850,13 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, 
u32 int_status)
if (wilc->rx_buffer)
buffer = >rx_buffer[offset];
else
-   goto _end_;
+   goto end;
 
wilc->hif_func->hif_clear_int_ext(wilc,
  DATA_INT_CLR | ENABLE_RX_VMM);
ret = wilc->hif_func->hif_block_rx_ext(wilc, 0, buffer, size);
 
-_end_:
+end:
if (ret) {
offset += size;
wilc->rx_buffer_offset = offset;
-- 
2.7.4



[PATCH 00/23] staging: wilc1000: cleanup patch to follow linux coding style

2018-07-19 Thread Ajay Singh
This patch series contains modification to follow Linux coding style &
cleanup change to remove unused variables and enums.
Few patches also contain changes to remove unnecessary typecast.

Ajay Singh (23):
  staging: wilc1000: remove unused enum declaration
  staging: wilc1000: remove enum connect_status instead use
ieee80211_statuscode
  staging: wilc1000: remove extra enum defined for data rates
  staging: wilc1000: remove extra enums defined for ieee80211_eid
  staging: wilc1000: rename goto to avoid leading '_' in label name
  staging: wilc1000: rename enum CURRENT_TXRATE to use lowercase
  staging: wilc1000: rename enum SITESURVEY to use lowercase
  staging: wilc1000: rename enum AUTHTYPE to use lowercase
  staging: wilc1000: remove unused elements in 'wilc' struct
  staging: wilc1000: remove unnecessary elements from 'wilc_priv' struct
  staging: wilc1000: removed unused element from wilc_cfg_frame struct
  staging: wilc1000: remove the mutliple #define used for same macro
  staging: wilc1000: use lowercase for 'IFC_UP' struct element name
  staging: wilc1000: remove unnecessary blank line between variable
declaration
  staging: wilc1000: use single space before opening brances '{'
  staging: wilc1000: remove unnecessary type used for wid id
  staging: wilc1000: avoid forward declaration for handle_scan_done()
  staging: wilc1000: avoid host_int_get_assoc_res_info() forward
declaration
  staging: wilc1000: avoid forward declaration of
host_int_parse_join_bss_param()
  staging: wilc1000: avoid setting default value for variable at
declaration
  staging: wilc1000: use 'int' inplace of 's32' date type
  staging: wilc1000: remove unnecessary 'NULL' check from cfg80211_ops
callbacks
  staging: wilc1000: move variable assignment along with its declaration

 drivers/staging/wilc1000/coreconfigurator.c   |  84 +--
 drivers/staging/wilc1000/coreconfigurator.h   |  20 -
 drivers/staging/wilc1000/host_interface.c | 696 +++---
 drivers/staging/wilc1000/host_interface.h |  20 +-
 drivers/staging/wilc1000/linux_mon.c  |   2 -
 drivers/staging/wilc1000/linux_wlan.c | 122 ++--
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 307 +++---
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  16 +-
 drivers/staging/wilc1000/wilc_wlan.c  |  65 +-
 drivers/staging/wilc1000/wilc_wlan.h  |   3 -
 drivers/staging/wilc1000/wilc_wlan_if.h   |  56 +-
 11 files changed, 517 insertions(+), 874 deletions(-)

-- 
2.7.4



[PATCH 01/23] staging: wilc1000: remove unused enum declaration

2018-07-19 Thread Ajay Singh
Cleanup patch to remove unused enums.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/coreconfigurator.c |  8 
 drivers/staging/wilc1000/host_interface.h   |  6 --
 drivers/staging/wilc1000/wilc_wlan_if.h | 26 --
 3 files changed, 40 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 4481602..0063895 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -4,14 +4,6 @@
 #define TAG_PARAM_OFFSET   (MAC_HDR_LEN + TIME_STAMP_LEN + \
 BEACON_INTERVAL_LEN + CAP_INFO_LEN)
 
-enum basic_frame_type {
-   FRAME_TYPE_CONTROL = 0x04,
-   FRAME_TYPE_DATA= 0x08,
-   FRAME_TYPE_MANAGEMENT  = 0x00,
-   FRAME_TYPE_RESERVED= 0x0C,
-   FRAME_TYPE_FORCE_32BIT = 0x
-};
-
 enum sub_frame_type {
ASSOC_REQ = 0x00,
ASSOC_RSP = 0x10,
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 0ea22ab..3cd97dd 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -252,12 +252,6 @@ struct reg_frame {
u8 reg_id;
 };
 
-enum p2p_listen_state {
-   P2P_IDLE,
-   P2P_LISTEN,
-   P2P_GRP_FORMATION
-};
-
 struct wilc;
 struct host_if_drv {
struct user_scan_req usr_scan_req;
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h 
b/drivers/staging/wilc1000/wilc_wlan_if.h
index e4a7bf5..85ac878 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -176,12 +176,6 @@ enum {
 };
 
 enum {
-   DONT_RESET  = 0,
-   DO_RESET= 1,
-   NO_REQUEST  = 2,
-};
-
-enum {
REKEY_DISABLE   = 1,
REKEY_TIME_BASE,
REKEY_PKT_BASE,
@@ -195,17 +189,6 @@ enum {
 };
 
 enum {
-   PRI_HIGH_RSSI   = 0x00,
-   PRI_LOW_RSSI= 0x04,
-   PRI_DETECT  = 0x08
-};
-
-enum {
-   CH_FILTER_OFF   = 0x00,
-   CH_FILTER_ON= 0x10
-};
-
-enum {
AUTO_PROT   = 0,/* Auto */
NO_PROT,/* Do not use any protection */
ERP_PROT,   /* Protect all ERP frame exchanges */
@@ -244,15 +227,6 @@ enum {
MIMO_MODE   = 3,/* power save disable */
 };
 
-enum {
-   DISABLE_SELF_CTS,
-   ENABLE_SELF_CTS,
-   DISABLE_TX_ABORT,
-   ENABLE_TX_ABORT,
-   HW_TRIGGER_ABORT,
-   SW_TRIGGER_ABORT,
-};
-
 enum wid_type {
WID_CHAR= 0,
WID_SHORT   = 1,
-- 
2.7.4



[PATCH 02/23] staging: wilc1000: remove enum connect_status instead use ieee80211_statuscode

2018-07-19 Thread Ajay Singh
Cleanup patch to remove the use of enum 'connect_status' and instead use
predefined 'ieee80211_statuscode' for error code values.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/coreconfigurator.c   |  4 +++-
 drivers/staging/wilc1000/coreconfigurator.h   | 20 
 drivers/staging/wilc1000/host_interface.c |  6 +++---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  2 +-
 4 files changed, 7 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 0063895..a987953 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -1,4 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
+#include 
+
 #include "coreconfigurator.h"
 
 #define TAG_PARAM_OFFSET   (MAC_HDR_LEN + TIME_STAMP_LEN + \
@@ -316,7 +318,7 @@ s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
u16 ies_len = 0;
 
ret_conn_info->status = get_asoc_status(buffer);
-   if (ret_conn_info->status == SUCCESSFUL_STATUSCODE) {
+   if (ret_conn_info->status == WLAN_STATUS_SUCCESS) {
ies = [CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN];
ies_len = buffer_len - (CAP_INFO_LEN + STATUS_CODE_LEN +
AID_LEN);
diff --git a/drivers/staging/wilc1000/coreconfigurator.h 
b/drivers/staging/wilc1000/coreconfigurator.h
index 55b5531..90d3d65 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -24,26 +24,6 @@
 #define MAKE_WORD16(lsb, msb) u16)(msb) << 8) & 0xFF00) | (lsb))
 #define MAKE_WORD32(lsw, msw) u32)(msw) << 16) & 0x) | (lsw))
 
-enum connect_status {
-   SUCCESSFUL_STATUSCODE= 0,
-   UNSPEC_FAIL  = 1,
-   UNSUP_CAP= 10,
-   REASOC_NO_ASOC   = 11,
-   FAIL_OTHER   = 12,
-   UNSUPT_ALG   = 13,
-   AUTH_SEQ_FAIL= 14,
-   CHLNG_FAIL   = 15,
-   AUTH_TIMEOUT = 16,
-   AP_FULL  = 17,
-   UNSUP_RATE   = 18,
-   SHORT_PREAMBLE_UNSUP = 19,
-   PBCC_UNSUP   = 20,
-   CHANNEL_AGIL_UNSUP   = 21,
-   SHORT_SLOT_UNSUP = 25,
-   OFDM_DSSS_UNSUP  = 26,
-   CONNECT_STS_FORCE_16_BIT = 0x
-};
-
 struct rssi_history_buffer {
bool full;
u8 index;
diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 918d06e..9b5bf3c 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1336,7 +1336,7 @@ static inline void host_int_parse_assoc_resp_info(struct 
wilc_vif *vif,
}
 
if (mac_status == MAC_STATUS_CONNECTED &&
-   conn_info.status != SUCCESSFUL_STATUSCODE) {
+   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");
eth_zero_addr(wilc_connected_ssid);
@@ -1349,7 +1349,7 @@ static inline void host_int_parse_assoc_resp_info(struct 
wilc_vif *vif,
memcpy(conn_info.bssid, hif_drv->usr_conn_req.bssid, 6);
 
if (mac_status == MAC_STATUS_CONNECTED &&
-   conn_info.status == SUCCESSFUL_STATUSCODE) {
+   conn_info.status == WLAN_STATUS_SUCCESS) {
memcpy(hif_drv->assoc_bssid,
   hif_drv->usr_conn_req.bssid, ETH_ALEN);
}
@@ -1369,7 +1369,7 @@ static inline void host_int_parse_assoc_resp_info(struct 
wilc_vif *vif,
  hif_drv->usr_conn_req.arg);
 
if (mac_status == MAC_STATUS_CONNECTED &&
-   conn_info.status == SUCCESSFUL_STATUSCODE) {
+   conn_info.status == WLAN_STATUS_SUCCESS) {
wilc_set_power_mgmt(vif, 0, 0);
 
hif_drv->hif_state = HOST_IF_CONNECTED;
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index e96163f..f90b9b6 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -489,7 +489,7 @@ static void cfg_connect_result(enum conn_event 
conn_disconn_evt,
connect_status = conn_info->status;
 
if (mac_status == MAC_STATUS_DISCONNECTED &&
-   conn_info->status == SUCCESSFUL_STATUSCODE) {
+   conn_info->status == WLAN_STATUS_SUCCESS) {
connect_status = WLAN_STATUS_UNSPECIFIED_FAILURE;
wilc_wlan_set_bssid(priv->dev, null_bssid,
STATION_MODE);
-- 
2.7.4



[PATCH 04/23] staging: wilc1000: remove extra enums defined for ieee80211_eid

2018-07-19 Thread Ajay Singh
Cleanup patch to make use of existing enum 'ieee80211_eid' instead of
adding new enum in WILC for element ID's.

The below mapping is same to remove extra enum in WILC.

SUPP_RATES_IE   -> WLAN_EID_SUPP_RATES
EXT_SUPP_RATES_IE   -> WLAN_EID_EXT_SUPP_RATES
HT_CAPABILITY_IE-> WLAN_EID_HT_CAPABILITY
RSN_IE  -> WLAN_EID_RSN
WPA_IE  -> WLAN_EID_VENDOR_SPECIFIC
WMM_IE  -> WLAN_EID_VENDOR_SPECIFIC
P2P_IE  -> WLAN_EID_VENDOR_SPECIFIC

Also remove enum 'info_element_id' as its same as 'ieee80211_eid', below
the mapping of elements of enums which are used.

ITIM -> WLAN_EID_TIM
IDSPARMS -> WLAN_EID_DS_PARAMS

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/coreconfigurator.c | 47 ++---
 drivers/staging/wilc1000/host_interface.c   | 19 ++--
 drivers/staging/wilc1000/wilc_wlan_if.h | 10 --
 3 files changed, 12 insertions(+), 64 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index a987953..5933e4d 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -45,49 +45,6 @@ enum sub_frame_type {
FRAME_SUBTYPE_FORCE_32BIT  = 0x
 };
 
-enum info_element_id {
-   ISSID   = 0,   /* Service Set Identifier */
-   ISUPRATES   = 1,   /* Supported Rates*/
-   IFHPARMS= 2,   /* FH parameter set   */
-   IDSPARMS= 3,   /* DS parameter set   */
-   ICFPARMS= 4,   /* CF parameter set   */
-   ITIM= 5,   /* Traffic Information Map*/
-   IIBPARMS= 6,   /* IBSS parameter set */
-   ICOUNTRY= 7,   /* Country element*/
-   IEDCAPARAMS = 12,  /* EDCA parameter set */
-   ITSPEC  = 13,  /* Traffic Specification  */
-   ITCLAS  = 14,  /* Traffic Classification */
-   ISCHED  = 15,  /* Schedule   */
-   ICTEXT  = 16,  /* Challenge Text */
-   IPOWERCONSTRAINT= 32,  /* Power Constraint   */
-   IPOWERCAPABILITY= 33,  /* Power Capability   */
-   ITPCREQUEST = 34,  /* TPC Request*/
-   ITPCREPORT  = 35,  /* TPC Report */
-   ISUPCHANNEL = 36,  /* Supported channel list */
-   ICHSWANNOUNC= 37,  /* Channel Switch Announcement*/
-   IMEASUREMENTREQUEST = 38,  /* Measurement request*/
-   IMEASUREMENTREPORT  = 39,  /* Measurement report */
-   IQUIET  = 40,  /* Quiet element Info */
-   IIBSSDFS= 41,  /* IBSS DFS   */
-   IERPINFO= 42,  /* ERP Information*/
-   ITSDELAY= 43,  /* TS Delay   */
-   ITCLASPROCESS   = 44,  /* TCLAS Processing   */
-   IHTCAP  = 45,  /* HT Capabilities*/
-   IQOSCAP = 46,  /* QoS Capability */
-   IRSNELEMENT = 48,  /* RSN Information Element*/
-   IEXSUPRATES = 50,  /* Extended Supported Rates   */
-   IEXCHSWANNOUNC  = 60,  /* Extended Ch Switch Announcement*/
-   IHTOPERATION= 61,  /* HT Information */
-   ISECCHOFF   = 62,  /* Secondary Channel Offeset  */
-   I2040COEX   = 72,  /* 20/40 Coexistence IE   */
-   I2040INTOLCHREPORT  = 73,  /* 20/40 Intolerant channel report*/
-   IOBSSSCAN   = 74,  /* OBSS Scan parameters   */
-   IEXTCAP = 127, /* Extended capability*/
-   IWMM= 221, /* WMM parameters */
-   IWPAELEMENT = 221, /* WPA Information Element*/
-   INFOELEM_ID_FORCE_32BIT  = 0x
-};
-
 static inline u16 get_beacon_period(u8 *data)
 {
u16 bcn_per;
@@ -216,7 +173,7 @@ static u8 *get_tim_elm(u8 *msa, u16 rx_len, u16 
tag_param_offset)
index = tag_param_offset;
 
while (index < (rx_len - FCS_LEN)) {
-   if (msa[index] == ITIM)
+   if (msa[index] == WLAN_EID_TIM)
return [index];
index += (IE_HDR_LEN + msa[index + 1]);
}
@@ -230,7 +187,7 @@ static u8 get_current_channel_802_11n(u8 *msa, u16 rx_len)
 
index = TAG_PARAM_OFFSET;
while (index < (rx_len - FCS_LEN)) {
-   if (msa[index] == IDSPARMS)
+   if (msa[index] == WLAN_EID_DS_PARAMS)
return msa[index + 2];
index += msa[index + 1] + IE_HDR_LEN;
}
diff 

[PATCH 03/23] staging: wilc1000: remove extra enum defined for data rates

2018-07-19 Thread Ajay Singh
Cleanup patch to remove extra enum defined to handle data rates.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/linux_wlan.c   |  2 +-
 drivers/staging/wilc1000/wilc_wlan_if.h | 16 
 2 files changed, 1 insertion(+), 17 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 0019bb8..032afc2 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -378,7 +378,7 @@ static int linux_wlan_init_test_config(struct net_device 
*dev,
if (!wilc_wlan_cfg_set(vif, 0, WID_BSS_TYPE, c_val, 1, 0, 0))
goto fail;
 
-   c_val[0] = RATE_AUTO;
+   c_val[0] = AUTORATE;
if (!wilc_wlan_cfg_set(vif, 0, WID_CURRENT_TX_RATE, c_val, 1, 0, 0))
goto fail;
 
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h 
b/drivers/staging/wilc1000/wilc_wlan_if.h
index 85ac878..b23f86c 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -88,22 +88,6 @@ enum bss_types {
 };
 
 enum {
-   RATE_AUTO   = 0,
-   RATE_1MB= 1,
-   RATE_2MB= 2,
-   RATE_5MB= 5,
-   RATE_6MB= 6,
-   RATE_9MB= 9,
-   RATE_11MB   = 11,
-   RATE_12MB   = 12,
-   RATE_18MB   = 18,
-   RATE_24MB   = 24,
-   RATE_26MB   = 36,
-   RATE_48MB   = 48,
-   RATE_54MB   = 54
-};
-
-enum {
B_ONLY_MODE = 0,/* 1, 2 M, otherwise 5, 11 M */
G_ONLY_MODE,/* 6,12,24 otherwise 9,18,36,48,54 */
G_MIXED_11B_1_MODE, /* 1,2,5.5,11 otherwise all on */
-- 
2.7.4