Re: [PATCH] staging: wilc1000: revert "fix TODO to compile spi and sdio components in single module"

2018-09-10 Thread Ajay Singh
Hi Greg,

On Tue, 14 Aug 2018 10:43:35 +0200
gregkh  wrote:

> On Tue, Aug 14, 2018 at 10:34:27AM +0200, Arnd Bergmann wrote:
> > On Tue, Aug 14, 2018 at 7:22 AM Ajay Singh
> >  wrote:
> > >
> > > Hi Arnd,
> > >
> > > On Mon, 13 Aug 2018 23:20:33 +0200
> > > Arnd Bergmann  wrote:
> > >
> > > > The TODO item named "make spi and sdio components coexist in one
> > > > build" was apparently addressed a long time ago, but never
> > > > removed from the TODO file. However, the new patch that tries
> > > > to address it actually makes it worse again by duplicating the
> > > > common parts of the driver into two separate modules rather
> > > > than sharing them. This also introduces a build regression when
> > > > one of the two is built-in while the other is a loadable module:
> > >
> > > Thanks for sharing your inputs and submitting patch.
> > > I have also submitted a patch to address the compilation error[1].
> > > We can ignore my patch and proceed with your changes.
> > >
> > > [1].https://patchwork.kernel.org/patch/10563873/
> > 
> > That patch seems useful regardless, as it removes dead code,
> > but I'd still prefer to revert staging-linusthe 9abc44ba4e2f ("staging: 
> > wilc1000:
> > fix TODO to compile spi and sdio components in single module")
> > commit for the other reasons I explained.
> 
> I agree, I'll queue it up soon, I have other patches to get to Linus
> first.
> 

This patch is applied only to 'staging-linus' in commit f45b893 and
it's not applied to 'staging-testing/next' tree. 
Please apply this patch to 'staging-next' tree also. Because I have one
patch to submit on top of these changes to delete the 'wilc_debug.c'
unused file.


Regards,
Ajay
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: wilc1000: revert "fix TODO to compile spi and sdio components in single module"

2018-09-11 Thread Ajay Singh
On Tue, 11 Sep 2018 10:21:10 +0200
gregkh  wrote:

> On Mon, Sep 10, 2018 at 04:08:36PM +0530, Ajay Singh wrote:
> > Hi Greg,
> > 
> > On Tue, 14 Aug 2018 10:43:35 +0200
> > gregkh  wrote:
> >   
> > > On Tue, Aug 14, 2018 at 10:34:27AM +0200, Arnd Bergmann wrote:  
> > > > On Tue, Aug 14, 2018 at 7:22 AM Ajay Singh
> > > >  wrote:  
> > > > >
> > > > > Hi Arnd,
> > > > >
> > > > > On Mon, 13 Aug 2018 23:20:33 +0200
> > > > > Arnd Bergmann  wrote:
> > > > >  
> > > > > > The TODO item named "make spi and sdio components coexist
> > > > > > in one build" was apparently addressed a long time ago, but
> > > > > > never removed from the TODO file. However, the new patch
> > > > > > that tries to address it actually makes it worse again by
> > > > > > duplicating the common parts of the driver into two
> > > > > > separate modules rather than sharing them. This also
> > > > > > introduces a build regression when one of the two is
> > > > > > built-in while the other is a loadable module:  
> > > > >
> > > > > Thanks for sharing your inputs and submitting patch.
> > > > > I have also submitted a patch to address the compilation
> > > > > error[1]. We can ignore my patch and proceed with your
> > > > > changes.
> > > > >
> > > > > [1].https://patchwork.kernel.org/patch/10563873/  
> > > > 
> > > > That patch seems useful regardless, as it removes dead code,
> > > > but I'd still prefer to revert staging-linusthe 9abc44ba4e2f
> > > > ("staging: wilc1000: fix TODO to compile spi and sdio
> > > > components in single module") commit for the other reasons I
> > > > explained.  
> > > 
> > > I agree, I'll queue it up soon, I have other patches to get to
> > > Linus first.
> > >   
> > 
> > This patch is applied only to 'staging-linus' in commit f45b893 and
> > it's not applied to 'staging-testing/next' tree. 
> > Please apply this patch to 'staging-next' tree also. Because I have
> > one patch to submit on top of these changes to delete the
> > 'wilc_debug.c' unused file.  
> 
> I will merge the staging-linus branch into staging-testing once Linus
> pulls them in.  Should happen next Monday or so.  You can send me
> patches that build on top of this now, I'll just wait until then to
> apply them to my tree.

Thanks Greg.

Sure, I will send the patch set build on top of this.

Regards,
Ajay
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 25/26] staging: wilc1000: refactor wilc_netdev_init() to handle memory free in error path

2018-09-11 Thread Ajay Singh
Hi Claudiu,

On Tue, 11 Sep 2018 12:21:13 +0300
Claudiu Beznea  wrote:

> On 04.09.2018 09:39, Ajay Singh wrote:
> > Refactor the wilc_netdev_init() to cleanup the memory for error
> > scenario and remove unnecessary 'dev' pointer check.
> > 
> > Signed-off-by: Ajay Singh 
> > ---
> >  drivers/staging/wilc1000/linux_wlan.c | 36
> > ---
> > drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  6 +++- 2 files
> > changed, 30 insertions(+), 12 deletions(-)
> > 
> > diff --git a/drivers/staging/wilc1000/linux_wlan.c
> > b/drivers/staging/wilc1000/linux_wlan.c index d7d43fd..91a45a7
> > 100644 --- a/drivers/staging/wilc1000/linux_wlan.c
> > +++ b/drivers/staging/wilc1000/linux_wlan.c
> > @@ -1073,10 +1073,8 @@ int wilc_netdev_init(struct wilc **wilc,
> > struct device *dev, int io_type, INIT_LIST_HEAD(&wl->rxq_head.list);
> >  
> > wl->hif_workqueue =
> > create_singlethread_workqueue("WILC_wq");
> > -   if (!wl->hif_workqueue) {
> > -   kfree(wl);
> > -   return -ENOMEM;
> > -   }
> > +   if (!wl->hif_workqueue)
> > +   goto free_wl;
> >  
> > register_inetaddr_notifier(&g_dev_notifier);
> >  
> > @@ -1085,7 +1083,7 @@ int wilc_netdev_init(struct wilc **wilc,
> > struct device *dev, int io_type, 
> > ndev = alloc_etherdev(sizeof(struct wilc_vif));
> > if (!ndev)
> > -   return -ENOMEM;
> > +   goto free_ndev;
> >  
> > vif = netdev_priv(ndev);
> > memset(vif, 0, sizeof(struct wilc_vif));
> > @@ -1106,15 +1104,13 @@ int wilc_netdev_init(struct wilc **wilc,
> > struct device *dev, int io_type, ndev->netdev_ops =
> > &wilc_netdev_ops; 
> > wdev = wilc_create_wiphy(ndev, dev);
> > -
> > -   if (dev)
> > -   SET_NETDEV_DEV(ndev, dev);
> > -
> > if (!wdev) {
> > netdev_err(ndev, "Can't register WILC
> > Wiphy\n");
> > -   return -1;
> > +   goto free_ndev;
> > }
> >  
> > +   SET_NETDEV_DEV(ndev, dev);
> > +
> > vif->ndev->ieee80211_ptr = wdev;
> > vif->ndev->ml_priv = vif;
> > wdev->netdev = vif->ndev;
> > @@ -1125,11 +1121,29 @@ int wilc_netdev_init(struct wilc **wilc,
> > struct device *dev, int io_type, 
> > ret = register_netdev(ndev);
> > if (ret)
> > -   return ret;
> > +   goto free_ndev;  
> 
> In case this happens you will loose the return code of
> register_netdev() and you will return instead -ENOMEM. Maybe, the
> best approach will be to initialize ret = -ENOMEM while declaring it

Thanks for your suggestion to handle the return code.
I will work on it and submit the changes in different series. 

Regards,
Ajay
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 07/29] staging: wilc1000: use 'void' return for wilc_wlan_txq_add_to_head()

2018-09-18 Thread Ajay Singh
Use 'void' return for wilc_wlan_txq_add_to_head() as its always
return '0' value.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wlan.c | 11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 590a51c..8057db9 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -71,8 +71,8 @@ static void wilc_wlan_txq_add_to_tail(struct net_device *dev,
complete(&wilc->txq_event);
 }
 
-static int wilc_wlan_txq_add_to_head(struct wilc_vif *vif,
-struct txq_entry_t *tqe)
+static void wilc_wlan_txq_add_to_head(struct wilc_vif *vif,
+ struct txq_entry_t *tqe)
 {
unsigned long flags;
struct wilc *wilc = vif->wilc;
@@ -87,8 +87,6 @@ static int wilc_wlan_txq_add_to_head(struct wilc_vif *vif,
spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
mutex_unlock(&wilc->txq_add_to_head_cs);
complete(&wilc->txq_event);
-
-   return 0;
 }
 
 #define NOT_TCP_ACK(-1)
@@ -275,10 +273,7 @@ static int wilc_wlan_txq_add_cfg_pkt(struct wilc_vif *vif, 
u8 *buffer,
tqe->priv = NULL;
tqe->ack_idx = NOT_TCP_ACK;
 
-   if (wilc_wlan_txq_add_to_head(vif, tqe)) {
-   kfree(tqe);
-   return 0;
-   }
+   wilc_wlan_txq_add_to_head(vif, tqe);
 
return 1;
 }
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 04/29] staging: wilc1000: change return type to 'void' for wilc_deinit_host_int()

2018-09-18 Thread Ajay Singh
Cleanup patch to use 'void' return type for wilc_deinit_host_int(),
as its return value is not used in caller.

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 37c26d4..02a8846 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2175,7 +2175,7 @@ int wilc_init_host_int(struct net_device *net)
return ret;
 }
 
-int wilc_deinit_host_int(struct net_device *net)
+void wilc_deinit_host_int(struct net_device *net)
 {
int ret;
struct wilc_priv *priv = wdev_priv(net->ieee80211_ptr);
@@ -2192,8 +2192,6 @@ int wilc_deinit_host_int(struct net_device *net)
 
if (ret)
netdev_err(net, "Error while deinitializing host interface\n");
-
-   return ret;
 }
 
 void wilc_free_wiphy(struct net_device *net)
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
index be412b6..1858f56 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
@@ -11,7 +11,7 @@
 struct wireless_dev *wilc_create_wiphy(struct net_device *net,
   struct device *dev);
 void wilc_free_wiphy(struct net_device *net);
-int wilc_deinit_host_int(struct net_device *net);
+void wilc_deinit_host_int(struct net_device *net);
 int wilc_init_host_int(struct net_device *net);
 void wilc_wfi_monitor_rx(u8 *buff, u32 size);
 int wilc_wfi_deinit_mon_interface(void);
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 02/29] staging: wilc1000: change return type to 'void' for wilc_wlan_set_bssid()

2018-09-18 Thread Ajay Singh
Cleanup patch to use 'void' return type for wilc_wlan_set_bssid(),
as its always returns the same value.

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

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 49afda6..d1d2c64 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -192,14 +192,12 @@ static struct net_device *get_if_handler(struct wilc 
*wilc, u8 *mac_header)
return NULL;
 }
 
-int wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid, u8 mode)
+void wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid, u8 mode)
 {
struct wilc_vif *vif = netdev_priv(wilc_netdev);
 
memcpy(vif->bssid, bssid, 6);
vif->mode = mode;
-
-   return 0;
 }
 
 int wilc_wlan_get_num_conn_ifcs(struct wilc *wilc)
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 1837808..30151b2 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -215,6 +215,6 @@ void wilc_netdev_cleanup(struct wilc *wilc);
 int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
 const struct wilc_hif_func *ops);
 void wilc_wfi_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size);
-int wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid, u8 mode);
+void wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid, u8 mode);
 
 #endif
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 05/29] staging: wilc1000: change return type to 'void' for wilc_wfi_deinit_mon_interface()

2018-09-18 Thread Ajay Singh
Use 'void' return type for wilc_wfi_deinit_mon_interface(), as same
value always return.

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

diff --git a/drivers/staging/wilc1000/linux_mon.c 
b/drivers/staging/wilc1000/linux_mon.c
index 1afdb9e..a634468 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -253,7 +253,7 @@ struct net_device *wilc_wfi_init_mon_interface(const char 
*name,
return wilc_wfi_mon;
 }
 
-int wilc_wfi_deinit_mon_interface(void)
+void wilc_wfi_deinit_mon_interface(void)
 {
bool rollback_lock = false;
 
@@ -270,5 +270,4 @@ int wilc_wfi_deinit_mon_interface(void)
}
wilc_wfi_mon = NULL;
}
-   return 0;
 }
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
index 1858f56..4812c8e 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
@@ -14,7 +14,7 @@ void wilc_free_wiphy(struct net_device *net);
 void wilc_deinit_host_int(struct net_device *net);
 int wilc_init_host_int(struct net_device *net);
 void wilc_wfi_monitor_rx(u8 *buff, u32 size);
-int wilc_wfi_deinit_mon_interface(void);
+void wilc_wfi_deinit_mon_interface(void);
 struct net_device *wilc_wfi_init_mon_interface(const char *name,
   struct net_device *real_dev);
 void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 01/29] staging: wilc1000: change return type to 'void' for wilc_frame_register()

2018-09-18 Thread Ajay Singh
Cleanup patch to use 'void' return type for wilc_frame_register(), as
its return value is not used.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 5388be9..7729f83 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -3641,14 +3641,14 @@ int wilc_listen_state_expired(struct wilc_vif *vif, u32 
session_id)
return result;
 }
 
-int wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg)
+void wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg)
 {
int result;
struct host_if_msg *msg;
 
msg = wilc_alloc_work(vif, handle_register_frame, false);
if (IS_ERR(msg))
-   return PTR_ERR(msg);
+   return;
 
switch (frame_type) {
case ACTION:
@@ -3670,8 +3670,6 @@ int wilc_frame_register(struct wilc_vif *vif, u16 
frame_type, bool reg)
netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
kfree(msg);
}
-
-   return result;
 }
 
 int wilc_add_beacon(struct wilc_vif *vif, u32 interval, u32 dtim_period,
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index a48818f..15ffaeb 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -348,7 +348,7 @@ int wilc_remain_on_channel(struct wilc_vif *vif, u32 
session_id,
   wilc_remain_on_chan_ready ready,
   void *user_arg);
 int wilc_listen_state_expired(struct wilc_vif *vif, u32 session_id);
-int wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg);
+void wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg);
 int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode,
 u8 ifc_id);
 int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode);
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 03/29] staging: wilc1000: change return type to 'void' for lock init & deinit functions

2018-09-18 Thread Ajay Singh
Cleanup patch to use 'void' return type for wlan_deinit_locks() &
wlan_init_locks(), as same value is return.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/linux_wlan.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index d1d2c64..e2669b9 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -525,7 +525,7 @@ static int linux_wlan_init_test_config(struct net_device 
*dev,
return -1;
 }
 
-static int wlan_deinit_locks(struct net_device *dev)
+static void wlan_deinit_locks(struct net_device *dev)
 {
struct wilc_vif *vif = netdev_priv(dev);
struct wilc *wilc = vif->wilc;
@@ -533,8 +533,6 @@ static int wlan_deinit_locks(struct net_device *dev)
mutex_destroy(&wilc->hif_cs);
mutex_destroy(&wilc->rxq_cs);
mutex_destroy(&wilc->txq_add_to_head_cs);
-
-   return 0;
 }
 
 static void wlan_deinitialize_threads(struct net_device *dev)
@@ -588,7 +586,7 @@ static void wilc_wlan_deinitialize(struct net_device *dev)
}
 }
 
-static int wlan_init_locks(struct net_device *dev)
+static void wlan_init_locks(struct net_device *dev)
 {
struct wilc_vif *vif = netdev_priv(dev);
struct wilc *wl = vif->wilc;
@@ -604,8 +602,6 @@ static int wlan_init_locks(struct net_device *dev)
init_completion(&wl->cfg_event);
init_completion(&wl->sync_event);
init_completion(&wl->txq_thread_started);
-
-   return 0;
 }
 
 static int wlan_initialize_threads(struct net_device *dev)
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 06/29] staging: wilc1000: use 'void' return type for host_int_get_assoc_res_info()

2018-09-18 Thread Ajay Singh
Change return type to 'void' for host_int_get_assoc_res_info() as its
return value is not used. 'rcvd_assoc_resp_info_len' parameter value is
used to know the status.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 7729f83..237a098d 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1388,10 +1388,10 @@ static void handle_rcvd_ntwrk_info(struct work_struct 
*work)
kfree(msg);
 }
 
-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)
+static void 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)
 {
int result;
struct wid wid;
@@ -1406,11 +1406,10 @@ static s32 host_int_get_assoc_res_info(struct wilc_vif 
*vif,
if (result) {
*rcvd_assoc_resp_info_len = 0;
netdev_err(vif->ndev, "Failed to send association response\n");
-   return -EINVAL;
+   return;
}
 
*rcvd_assoc_resp_info_len = wid.size;
-   return result;
 }
 
 static inline void host_int_free_user_conn_req(struct host_if_drv *hif_drv)
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 00/29] staging: wilc1000: avoid static variables and cleanup changes

2018-09-18 Thread Ajay Singh
This patch series contains changes to avoid the use of static variables.
Cleanup changes to fix some checkpatch issues and return void for function
if their return value is not used.
Also deleted 'wilc_debugfs.c' file as it's not used.

Ajay Singh (29):
  staging: wilc1000: change return type to 'void' for
wilc_frame_register()
  staging: wilc1000: change return type to 'void' for
wilc_wlan_set_bssid()
  staging: wilc1000: change return type to 'void' for lock init & deinit
functions
  staging: wilc1000: change return type to 'void' for
wilc_deinit_host_int()
  staging: wilc1000: change return type to 'void' for
wilc_wfi_deinit_mon_interface()
  staging: wilc1000: use 'void' return type for
host_int_get_assoc_res_info()
  staging: wilc1000: use 'void' return for wilc_wlan_txq_add_to_head()
  staging: wilc1000: change return type to 'void' tcp ack filter
functions
  staging: wilc1000: use 'void' return for
wilc_wlan_txq_filter_dup_tcp_ack()
  staging: wilc1000: change return type to 'void' for
wilc_wlan_cfg_indicate_rx()
  staging: wilc1000: refactor wilc_wlan_parse_info_frame() function
  staging: wilc1000: set default value of cfg response type in
wilc_wlan_cfg_indicate_rx()
  staging: wilc1000: changes 'val' type to u8 in wilc_cfg_byte struct
  staging: wilc1000: remove unused wid type values
  staging: wilc1000: remove unused wid from cfg struct
  staging: wilc1000: refactor code to remove 'mac_status' from
'wilc_mac_cfg' struct
  staging: wilc1000: refactor code to avoid static variables for config
parameters
  staging: wilc1000: rename 'wilc_mac_cfg' struct to 'wilc_cfg_str_vals'
  staging: wilc1000: avoid the use of 'hif_driver_comp' completion
variable
  staging: wilc1000: remove use of unnecessary 'wilc_connected_ssid'
variable
  staging: wilc1000: avoid use of 'g_sdio' static variable
  staging: wilc1000: avoid use of 'g_spi' static variable
  staging: wilc1000: remove unnecessary memset in sdio_init() &
wilc_spi_init()
  staging: wilc1000: remove p2p related static variables to wilc_vif
struct
  staging: wilc1000: remove wilc_debugfs.c file as its not used
  staging: wilc1000: remove unnecessary option used with ccflags-y in
Makefile
  staging: wilc1000: use usleep_range() in place of udelay()
  staging: wilc1000: avoid spaces preferred around checkpatch issue
  staging: wilc1000: return exact error of register_netdev() from
wilc_netdev_init()

 drivers/staging/wilc1000/Makefile |   5 +-
 drivers/staging/wilc1000/host_interface.c |  64 ++---
 drivers/staging/wilc1000/host_interface.h |   6 +-
 drivers/staging/wilc1000/linux_mon.c  |   3 +-
 drivers/staging/wilc1000/linux_wlan.c |  40 +--
 drivers/staging/wilc1000/wilc_debugfs.c   | 115 -
 drivers/staging/wilc1000/wilc_sdio.c  |  56 +++--
 drivers/staging/wilc1000/wilc_spi.c   |  57 +++--
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  90 +++
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h |   4 +-
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  14 +-
 drivers/staging/wilc1000/wilc_wlan.c  |  44 ++--
 drivers/staging/wilc1000/wilc_wlan.h  |   3 +-
 drivers/staging/wilc1000/wilc_wlan_cfg.c  | 294 +-
 drivers/staging/wilc1000/wilc_wlan_cfg.h  |  26 +-
 drivers/staging/wilc1000/wilc_wlan_if.h   |   4 -
 16 files changed, 325 insertions(+), 500 deletions(-)
 delete mode 100644 drivers/staging/wilc1000/wilc_debugfs.c

-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 09/29] staging: wilc1000: use 'void' return for wilc_wlan_txq_filter_dup_tcp_ack()

2018-09-18 Thread Ajay Singh
Use 'void' return for wilc_wlan_txq_filter_dup_tcp_ack() as it always
return value '1' and its not used by the caller.

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

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 66ce29d..88808d9 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -182,7 +182,7 @@ static inline void tcp_process(struct net_device *dev, 
struct txq_entry_t *tqe)
spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
 }
 
-static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev)
+static void wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev)
 {
struct wilc_vif *vif = netdev_priv(dev);
struct wilc *wilc = vif->wilc;
@@ -237,8 +237,6 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct 
net_device *dev)
msecs_to_jiffies(1));
dropped--;
}
-
-   return 1;
 }
 
 void wilc_enable_tcp_ack_filter(struct wilc_vif *vif, bool value)
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 08/29] staging: wilc1000: change return type to 'void' tcp ack filter functions

2018-09-18 Thread Ajay Singh
Use 'void' return type for below functions as they always return '0' and
their return value is not used by caller.
add_tcp_pending_ack()
update_tcp_session()
add_tcp_pending_ack()

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wlan.c | 15 ++-
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 8057db9..66ce29d 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -91,8 +91,8 @@ static void wilc_wlan_txq_add_to_head(struct wilc_vif *vif,
 
 #define NOT_TCP_ACK(-1)
 
-static inline int add_tcp_session(struct wilc_vif *vif, u32 src_prt,
- u32 dst_prt, u32 seq)
+static inline void add_tcp_session(struct wilc_vif *vif, u32 src_prt,
+  u32 dst_prt, u32 seq)
 {
struct tcp_ack_filter *f = &vif->ack_filter;
 
@@ -103,22 +103,20 @@ static inline int add_tcp_session(struct wilc_vif *vif, 
u32 src_prt,
f->ack_session_info[f->tcp_session].dst_port = dst_prt;
f->tcp_session++;
}
-   return 0;
 }
 
-static inline int update_tcp_session(struct wilc_vif *vif, u32 index, u32 ack)
+static inline void update_tcp_session(struct wilc_vif *vif, u32 index, u32 ack)
 {
struct tcp_ack_filter *f = &vif->ack_filter;
 
if (index < 2 * MAX_TCP_SESSION &&
ack > f->ack_session_info[index].bigger_ack_num)
f->ack_session_info[index].bigger_ack_num = ack;
-   return 0;
 }
 
-static inline int add_tcp_pending_ack(struct wilc_vif *vif, u32 ack,
- u32 session_index,
- struct txq_entry_t *txqe)
+static inline void add_tcp_pending_ack(struct wilc_vif *vif, u32 ack,
+  u32 session_index,
+  struct txq_entry_t *txqe)
 {
struct tcp_ack_filter *f = &vif->ack_filter;
u32 i = f->pending_base + f->pending_acks_idx;
@@ -130,7 +128,6 @@ static inline int add_tcp_pending_ack(struct wilc_vif *vif, 
u32 ack,
txqe->ack_idx = i;
f->pending_acks_idx++;
}
-   return 0;
 }
 
 static inline void tcp_process(struct net_device *dev, struct txq_entry_t *tqe)
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 10/29] staging: wilc1000: change return type to 'void' for wilc_wlan_cfg_indicate_rx()

2018-09-18 Thread Ajay Singh
Cleanup patch to use 'void' return type for wilc_wlan_cfg_indicate_rx(),
as its return value is not used in caller. The value set in
'rsp' argument is used to get the success status.

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

diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c 
b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index 4215763..42c64ed 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -502,10 +502,9 @@ int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 
buffer_size)
return ret;
 }
 
-int wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size,
- struct wilc_cfg_rsp *rsp)
+void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size,
+  struct wilc_cfg_rsp *rsp)
 {
-   int ret = 1;
u8 msg_type;
u8 msg_id;
 
@@ -547,11 +546,8 @@ int wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 
*frame, int size,
default:
rsp->type = 0;
rsp->seq_no = msg_id;
-   ret = 0;
break;
}
-
-   return ret;
 }
 
 int wilc_wlan_cfg_init(void)
diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.h 
b/drivers/staging/wilc1000/wilc_wlan_cfg.h
index 0c649d1..189e617 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.h
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.h
@@ -31,8 +31,8 @@ struct wilc;
 int wilc_wlan_cfg_set_wid(u8 *frame, u32 offset, u16 id, u8 *buf, int size);
 int wilc_wlan_cfg_get_wid(u8 *frame, u32 offset, u16 id);
 int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 buffer_size);
-int wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size,
- struct wilc_cfg_rsp *rsp);
+void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size,
+  struct wilc_cfg_rsp *rsp);
 int wilc_wlan_cfg_init(void);
 
 #endif
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 14/29] staging: wilc1000: remove unused wid type values

2018-09-18 Thread Ajay Singh
Cleanup patch to remove the wid type not used in the code.

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

diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h 
b/drivers/staging/wilc1000/wilc_wlan_if.h
index b81a73b..ce2066b 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -204,10 +204,6 @@ enum wid_type {
WID_STR = 3,
WID_BIN_DATA= 4,
WID_BIN = 5,
-   WID_IP  = 6,
-   WID_ADR = 7,
-   WID_UNDEF   = 8,
-   WID_TYPE_FORCE_32BIT= 0x
 };
 
 struct wid {
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 12/29] staging: wilc1000: set default value of cfg response type in wilc_wlan_cfg_indicate_rx()

2018-09-18 Thread Ajay Singh
Handle the setting of default value for 'wilc_cfg_rsp' type for all
cases in wilc_wlan_cfg_indicate_rx() as the caller make use of this
value to know the type of the received message.

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

diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c 
b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index 2b5471b..2c463a3 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -507,6 +507,7 @@ void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 
*frame, int size,
msg_id = frame[1];  /* seq no */
frame += 4;
size -= 4;
+   rsp->type = 0;
 
/*
 * The valid types of response messages are
@@ -532,7 +533,6 @@ void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 
*frame, int size,
 
case 'N':
wilc_network_info_received(wilc, frame - 4, size + 4);
-   rsp->type = 0;
break;
 
case 'S':
@@ -540,7 +540,6 @@ void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 
*frame, int size,
break;
 
default:
-   rsp->type = 0;
rsp->seq_no = msg_id;
break;
}
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 16/29] staging: wilc1000: refactor code to remove 'mac_status' from 'wilc_mac_cfg' struct

2018-09-18 Thread Ajay Singh
Refactor the code by removing use of 'mac_status' from 'wilc_mac_cfg'
and only have the string type configuration values in 'wilc_mac_cfg'
struct. Now fetch the value 'WID_STATUS' configuration from 'g_cfg_byte'
array.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/linux_wlan.c |  4 ++--
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  2 +-
 drivers/staging/wilc1000/wilc_wlan_cfg.c  | 23 ++-
 3 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index e2669b9..d9f927e 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -159,9 +159,9 @@ static void deinit_irq(struct net_device *dev)
 
 void wilc_mac_indicate(struct wilc *wilc)
 {
-   int status;
+   s8 status;
 
-   wilc_wlan_cfg_get_val(WID_STATUS, (unsigned char *)&status, 4);
+   wilc_wlan_cfg_get_val(WID_STATUS, &status, 1);
if (wilc->mac_status == MAC_STATUS_INIT) {
wilc->mac_status = status;
complete(&wilc->sync_event);
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 30151b2..70bae3a 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -155,7 +155,7 @@ struct wilc_vif {
 struct wilc {
const struct wilc_hif_func *hif_func;
int io_type;
-   int mac_status;
+   s8 mac_status;
struct gpio_desc *gpio_irq;
bool initialized;
int dev_irq_num;
diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c 
b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index 541251b..4434976 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -18,7 +18,6 @@ enum cfg_cmd_type {
 };
 
 struct wilc_mac_cfg {
-   int mac_status;
u8 mac_address[7];
u8 firmware_version[129];
u8 assoc_rsp[256];
@@ -251,15 +250,26 @@ static void wilc_wlan_parse_response_frame(u8 *info, int 
size)
 
 static void wilc_wlan_parse_info_frame(u8 *info)
 {
-   struct wilc_mac_cfg *pd = &g_mac;
u32 wid, len;
 
wid = info[0] | (info[1] << 8);
 
len = info[2];
 
-   if (len == 1 && wid == WID_STATUS)
-   pd->mac_status = info[3];
+   if (len == 1 && wid == WID_STATUS) {
+   int i = 0;
+
+   do {
+   if (g_cfg_byte[i].id == WID_NIL)
+   break;
+
+   if (g_cfg_byte[i].id == wid) {
+   g_cfg_byte[i].val = info[3];
+   break;
+   }
+   i++;
+   } while (1);
+   }
 }
 
 /
@@ -323,11 +333,6 @@ int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 
buffer_size)
u32 type = (wid >> 12) & 0xf;
int i, ret = 0;
 
-   if (wid == WID_STATUS) {
-   *((u32 *)buffer) = g_mac.mac_status;
-   return 4;
-   }
-
i = 0;
if (type == CFG_BYTE_CMD) {
do {
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 13/29] staging: wilc1000: changes 'val' type to u8 in wilc_cfg_byte struct

2018-09-18 Thread Ajay Singh
Use the correct datatype for storing the byte value in 'wilc_cfg_byte'
struct.

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

diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.h 
b/drivers/staging/wilc1000/wilc_wlan_cfg.h
index 189e617..082093f 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.h
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.h
@@ -9,7 +9,7 @@
 
 struct wilc_cfg_byte {
u16 id;
-   u16 val;
+   u8 val;
 };
 
 struct wilc_cfg_hword {
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 11/29] staging: wilc1000: refactor wilc_wlan_parse_info_frame() function

2018-09-18 Thread Ajay Singh
Return 'void' from wilc_wlan_parse_info_frame() as same constant value
is returned always. Also removed the 'size' from input parameter as its
not used in the function.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wlan_cfg.c | 12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c 
b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index 42c64ed..2b5471b 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -350,22 +350,17 @@ static void wilc_wlan_parse_response_frame(u8 *info, int 
size)
}
 }
 
-static int wilc_wlan_parse_info_frame(u8 *info, int size)
+static void wilc_wlan_parse_info_frame(u8 *info)
 {
struct wilc_mac_cfg *pd = &g_mac;
u32 wid, len;
-   int type = WILC_CFG_RSP_STATUS;
 
wid = info[0] | (info[1] << 8);
 
len = info[2];
 
-   if (len == 1 && wid == WID_STATUS) {
+   if (len == 1 && wid == WID_STATUS)
pd->mac_status = info[3];
-   type = WILC_CFG_RSP_STATUS;
-   }
-
-   return type;
 }
 
 /
@@ -528,7 +523,8 @@ void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 
*frame, int size,
break;
 
case 'I':
-   rsp->type = wilc_wlan_parse_info_frame(frame, size);
+   wilc_wlan_parse_info_frame(frame);
+   rsp->type = WILC_CFG_RSP_STATUS;
rsp->seq_no = msg_id;
/*call host interface info parse as well*/
wilc_gnrl_async_info_received(wilc, frame - 4, size + 4);
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 17/29] staging: wilc1000: refactor code to avoid static variables for config parameters

2018-09-18 Thread Ajay Singh
Refactor the code in wilc_wlan_cfg.c file to avoid the use of static
variables. Move the static variables as part of wilc struct and also
dynamically allocating memory for keeping those variables.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/linux_wlan.c |  12 +-
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |   2 +
 drivers/staging/wilc1000/wilc_wlan.c  |  12 +-
 drivers/staging/wilc1000/wilc_wlan.h  |   3 +-
 drivers/staging/wilc1000/wilc_wlan_cfg.c  | 159 +-
 drivers/staging/wilc1000/wilc_wlan_cfg.h  |  20 +++-
 6 files changed, 138 insertions(+), 70 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index d9f927e..8ecd664 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -161,7 +161,7 @@ void wilc_mac_indicate(struct wilc *wilc)
 {
s8 status;
 
-   wilc_wlan_cfg_get_val(WID_STATUS, &status, 1);
+   wilc_wlan_cfg_get_val(wilc, WID_STATUS, &status, 1);
if (wilc->mac_status == MAC_STATUS_INIT) {
wilc->mac_status = status;
complete(&wilc->sync_event);
@@ -677,7 +677,7 @@ static int wilc_wlan_initialize(struct net_device *dev, 
struct wilc_vif *vif)
int size;
char firmware_ver[20];
 
-   size = wilc_wlan_cfg_get_val(WID_FIRMWARE_VERSION,
+   size = wilc_wlan_cfg_get_val(wl, WID_FIRMWARE_VERSION,
 firmware_ver,
 sizeof(firmware_ver));
firmware_ver[size] = '\0';
@@ -1035,6 +1035,7 @@ void wilc_netdev_cleanup(struct wilc *wilc)
 
flush_workqueue(wilc->hif_workqueue);
destroy_workqueue(wilc->hif_workqueue);
+   wilc_wlan_cfg_deinit(wilc);
kfree(wilc);
 }
 EXPORT_SYMBOL_GPL(wilc_netdev_cleanup);
@@ -1060,6 +1061,9 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
if (!wl)
return -ENOMEM;
 
+   if (wilc_wlan_cfg_init(wl))
+   goto free_wl;
+
*wilc = wl;
wl->io_type = io_type;
wl->hif_func = ops;
@@ -1070,7 +1074,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
 
wl->hif_workqueue = create_singlethread_workqueue("WILC_wq");
if (!wl->hif_workqueue)
-   goto free_wl;
+   goto free_cfg;
 
register_inetaddr_notifier(&g_dev_notifier);
 
@@ -1139,6 +1143,8 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
}
unregister_inetaddr_notifier(&g_dev_notifier);
destroy_workqueue(wl->hif_workqueue);
+free_cfg:
+   wilc_wlan_cfg_deinit(wl);
 free_wl:
kfree(wl);
return -ENOMEM;
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 70bae3a..484c265 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -16,6 +16,7 @@
 
 #include "host_interface.h"
 #include "wilc_wlan.h"
+#include "wilc_wlan_cfg.h"
 
 #define FLOW_CONTROL_LOWER_THRESHOLD   128
 #define FLOW_CONTROL_UPPER_THRESHOLD   256
@@ -203,6 +204,7 @@ struct wilc {
int clients_count;
struct workqueue_struct *hif_workqueue;
enum chip_ps_states chip_ps_state;
+   struct wilc_cfg cfg;
 };
 
 struct wilc_wfi_mon_priv {
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 88808d9..0ec0d9b 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1194,9 +1194,9 @@ int wilc_wlan_cfg_get(struct wilc_vif *vif, int start, 
u16 wid, int commit,
return ret_size;
 }
 
-int wilc_wlan_cfg_get_val(u16 wid, u8 *buffer, u32 buffer_size)
+int wilc_wlan_cfg_get_val(struct wilc *wl, u16 wid, u8 *buffer, u32 
buffer_size)
 {
-   return wilc_wlan_cfg_get_wid_value(wid, buffer, buffer_size);
+   return wilc_wlan_cfg_get_wid_value(wl, wid, buffer, buffer_size);
 }
 
 int wilc_send_config_pkt(struct wilc_vif *vif, u8 mode, struct wid *wids,
@@ -1216,7 +1216,8 @@ int wilc_send_config_pkt(struct wilc_vif *vif, u8 mode, 
struct wid *wids,
}
}
for (i = 0; i < count; i++) {
-   wids[i].size = wilc_wlan_cfg_get_val(wids[i].id,
+   wids[i].size = wilc_wlan_cfg_get_val(vif->wilc,
+wids[i].id,
 wids[i].val,
 wids[i].size);
}
@@ -1315,11 +1316,6 @@ int wil

[PATCH 26/29] staging: wilc1000: remove unnecessary option used with ccflags-y in Makefile

2018-09-18 Thread Ajay Singh
Cleanup patch to remove -I(src) and -DWILC_ASIC_A0 option used in
ccflag-y in Makefile.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/Makefile | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/wilc1000/Makefile 
b/drivers/staging/wilc1000/Makefile
index 5718bc4..37e8560 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -4,8 +4,6 @@ obj-$(CONFIG_WILC1000) += wilc1000.o
 ccflags-y += -DFIRMWARE_1002=\"atmel/wilc1002_firmware.bin\" \
-DFIRMWARE_1003=\"atmel/wilc1003_firmware.bin\"
 
-ccflags-y += -I$(src)/ -DWILC_ASIC_A0
-
 wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \
coreconfigurator.o host_interface.o \
wilc_wlan_cfg.o wilc_wlan.o
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 15/29] staging: wilc1000: remove unused wid from cfg struct

2018-09-18 Thread Ajay Singh
Cleanup patch to remove the unused element stored in cfg struct.
Removed those wid from the cfg variables whose value is not
fetched(GET_CFG) from the code. In case the wid is only set to the
firmware then there is need to store them as part of cfg variables, so
removed the unused code.

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

diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c 
b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index 2c463a3..541251b 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -20,131 +20,36 @@ enum cfg_cmd_type {
 struct wilc_mac_cfg {
int mac_status;
u8 mac_address[7];
-   u8 ip_address[5];
-   u8 bssid[7];
-   u8 ssid[34];
u8 firmware_version[129];
-   u8 supp_rate[24];
-   u8 wep_key[28];
-   u8 i_psk[66];
-   u8 hw_product_version[33];
-   u8 phyversion[17];
-   u8 supp_username[21];
-   u8 supp_password[64];
-   u8 assoc_req[256];
u8 assoc_rsp[256];
-   u8 firmware_info[8];
-   u8 scan_result[256];
-   u8 scan_result1[256];
 };
 
 static struct wilc_mac_cfg g_mac;
 
 static struct wilc_cfg_byte g_cfg_byte[] = {
-   {WID_BSS_TYPE, 0},
-   {WID_CURRENT_TX_RATE, 0},
-   {WID_CURRENT_CHANNEL, 0},
-   {WID_PREAMBLE, 0},
-   {WID_11G_OPERATING_MODE, 0},
{WID_STATUS, 0},
-   {WID_SCAN_TYPE, 0},
-   {WID_KEY_ID, 0},
-   {WID_QOS_ENABLE, 0},
-   {WID_POWER_MANAGEMENT, 0},
-   {WID_11I_MODE, 0},
-   {WID_AUTH_TYPE, 0},
-   {WID_SITE_SURVEY, 0},
-   {WID_LISTEN_INTERVAL, 0},
-   {WID_DTIM_PERIOD, 0},
-   {WID_ACK_POLICY, 0},
-   {WID_BCAST_SSID, 0},
-   {WID_REKEY_POLICY, 0},
-   {WID_SHORT_SLOT_ALLOWED, 0},
-   {WID_START_SCAN_REQ, 0},
{WID_RSSI, 0},
{WID_LINKSPEED, 0},
-   {WID_AUTO_RX_SENSITIVITY, 0},
-   {WID_DATAFLOW_CONTROL, 0},
-   {WID_SCAN_FILTER, 0},
-   {WID_11N_PROT_MECH, 0},
-   {WID_11N_ERP_PROT_TYPE, 0},
-   {WID_11N_ENABLE, 0},
-   {WID_11N_OPERATING_MODE, 0},
-   {WID_11N_OBSS_NONHT_DETECTION, 0},
-   {WID_11N_HT_PROT_TYPE, 0},
-   {WID_11N_RIFS_PROT_ENABLE, 0},
-   {WID_11N_SMPS_MODE, 0},
-   {WID_11N_CURRENT_TX_MCS, 0},
-   {WID_11N_SHORT_GI_ENABLE, 0},
-   {WID_RIFS_MODE, 0},
-   {WID_TX_ABORT_CONFIG, 0},
-   {WID_11N_IMMEDIATE_BA_ENABLED, 0},
-   {WID_11N_TXOP_PROT_DISABLE, 0},
{WID_NIL, 0}
 };
 
 static struct wilc_cfg_hword g_cfg_hword[] = {
-   {WID_LINK_LOSS_THRESHOLD, 0},
-   {WID_RTS_THRESHOLD, 0},
-   {WID_FRAG_THRESHOLD, 0},
-   {WID_SHORT_RETRY_LIMIT, 0},
-   {WID_LONG_RETRY_LIMIT, 0},
-   {WID_BEACON_INTERVAL, 0},
-   {WID_RX_SENSE, 0},
-   {WID_ACTIVE_SCAN_TIME, 0},
-   {WID_PASSIVE_SCAN_TIME, 0},
-   {WID_SITE_SURVEY_SCAN_TIME, 0},
-   {WID_JOIN_START_TIMEOUT, 0},
-   {WID_AUTH_TIMEOUT, 0},
-   {WID_ASOC_TIMEOUT, 0},
-   {WID_11I_PROTOCOL_TIMEOUT, 0},
-   {WID_EAPOL_RESPONSE_TIMEOUT, 0},
-   {WID_11N_SIG_QUAL_VAL, 0},
-   {WID_CCA_THRESHOLD, 0},
{WID_NIL, 0}
 };
 
 static struct wilc_cfg_word g_cfg_word[] = {
{WID_FAILED_COUNT, 0},
-   {WID_RETRY_COUNT, 0},
-   {WID_MULTIPLE_RETRY_COUNT, 0},
-   {WID_FRAME_DUPLICATE_COUNT, 0},
-   {WID_ACK_FAILURE_COUNT, 0},
{WID_RECEIVED_FRAGMENT_COUNT, 0},
-   {WID_MCAST_RECEIVED_FRAME_COUNT, 0},
-   {WID_FCS_ERROR_COUNT, 0},
{WID_SUCCESS_FRAME_COUNT, 0},
-   {WID_TX_FRAGMENT_COUNT, 0},
-   {WID_TX_MULTICAST_FRAME_COUNT, 0},
-   {WID_RTS_SUCCESS_COUNT, 0},
-   {WID_RTS_FAILURE_COUNT, 0},
-   {WID_WEP_UNDECRYPTABLE_COUNT, 0},
-   {WID_REKEY_PERIOD, 0},
-   {WID_REKEY_PACKET_COUNT, 0},
-   {WID_HW_RX_COUNT, 0},
{WID_GET_INACTIVE_TIME, 0},
{WID_NIL, 0}
 
 };
 
 static struct wilc_cfg_str g_cfg_str[] = {
-   {WID_SSID, g_mac.ssid}, /* 33 + 1 bytes */
{WID_FIRMWARE_VERSION, g_mac.firmware_version},
-   {WID_OPERATIONAL_RATE_SET, g_mac.supp_rate},
-   {WID_BSSID, g_mac.bssid},   /* 6 bytes */
-   {WID_WEP_KEY_VALUE, g_mac.wep_key}, /* 27 bytes */
-   {WID_11I_PSK, g_mac.i_psk}, /* 65 bytes */
-   {WID_HARDWARE_VERSION, g_mac.hw_product_version},
{WID_MAC_ADDR, g_mac.mac_address},
-   {WID_PHY_VERSION, g_mac.phyversion},
-   {WID_SUPP_USERNAME, g_mac.supp_username},
-   {WID_SUPP_PASSWORD, g_mac.supp_password},
-   {WID_SITE_SURVEY_RESULTS, g_mac.scan_result},
-   {WID_SITE_SURVEY_RESULTS, g_mac.scan_result1},
-   {WID_ASSOC_REQ_INFO, g_mac.assoc_req},
{WID_ASSOC_RES_INFO, g_mac.assoc_rsp},
-   {WID_FIRMWARE_INFO, g_mac.firmware_version},
-   {WID_IP_ADDRESS, g_mac.ip_address},
{WID_NIL, NULL}
 };
 
@@ -327,12 +232,6 @@ static void

[PATCH 19/29] staging: wilc1000: avoid the use of 'hif_driver_comp' completion variable

2018-09-18 Thread Ajay Singh
Instead of using extra completion variable to handle the sync call now
using msg->is_sync flag to handle the sync call.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 237a098d..529390d 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -187,7 +187,6 @@ struct join_bss_param {
 };
 
 static struct host_if_drv *terminated_handle;
-static struct completion hif_driver_comp;
 static struct mutex hif_deinit_lock;
 
 /* 'msg' should be free by the caller for syc */
@@ -310,10 +309,12 @@ static void handle_set_wfi_drv_handler(struct work_struct 
*work)
if (ret)
netdev_err(vif->ndev, "Failed to set driver handler\n");
 
-   complete(&hif_driver_comp);
kfree(buffer);
 
 free_msg:
+   if (msg->is_sync)
+   complete(&msg->work_comp);
+
kfree(msg);
 }
 
@@ -333,9 +334,6 @@ static void handle_set_operation_mode(struct work_struct 
*work)
ret = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
   wilc_get_vif_idx(vif));
 
-   if (hif_op_mode->mode == IDLE_MODE)
-   complete(&hif_driver_comp);
-
if (ret)
netdev_err(vif->ndev, "Failed to set operation mode\n");
 
@@ -3118,12 +3116,12 @@ int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 
channel)
 }
 
 int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode,
-u8 ifc_id)
+u8 ifc_id, bool is_sync)
 {
int result;
struct host_if_msg *msg;
 
-   msg = wilc_alloc_work(vif, handle_set_wfi_drv_handler, false);
+   msg = wilc_alloc_work(vif, handle_set_wfi_drv_handler, is_sync);
if (IS_ERR(msg))
return PTR_ERR(msg);
 
@@ -3135,8 +3133,12 @@ int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int 
index, u8 mode,
if (result) {
netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
kfree(msg);
+   return result;
}
 
+   if (is_sync)
+   wait_for_completion(&msg->work_comp);
+
return result;
 }
 
@@ -3380,10 +3382,8 @@ int wilc_init(struct net_device *dev, struct host_if_drv 
**hif_drv_handler)
 
vif->obtaining_ip = false;
 
-   if (wilc->clients_count == 0) {
-   init_completion(&hif_driver_comp);
+   if (wilc->clients_count == 0)
mutex_init(&hif_deinit_lock);
-   }
 
timer_setup(&vif->periodic_rssi, get_periodic_rssi, 0);
mod_timer(&vif->periodic_rssi, jiffies + msecs_to_jiffies(5000));
@@ -3430,8 +3430,7 @@ int wilc_deinit(struct wilc_vif *vif)
del_timer_sync(&vif->periodic_rssi);
del_timer_sync(&hif_drv->remain_on_ch_timer);
 
-   wilc_set_wfi_drv_handler(vif, 0, 0, 0);
-   wait_for_completion(&hif_driver_comp);
+   wilc_set_wfi_drv_handler(vif, 0, 0, 0, true);
 
if (hif_drv->usr_scan_req.scan_result) {
hif_drv->usr_scan_req.scan_result(SCAN_EVENT_ABORTED, NULL,
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 15ffaeb..4416f8f 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -350,7 +350,7 @@ int wilc_remain_on_channel(struct wilc_vif *vif, u32 
session_id,
 int wilc_listen_state_expired(struct wilc_vif *vif, u32 session_id);
 void wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg);
 int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode,
-u8 ifc_id);
+u8 ifc_id, bool is_sync);
 int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode);
 int wilc_get_statistics(struct wilc_vif *vif, struct rf_info *stats,
bool is_sync);
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 8ecd664..b666e1e 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -753,7 +753,8 @@ static int wilc_mac_open(struct net_device *ndev)
for (i = 0; i < wl->vif_num; i++) {
if (ndev == wl->vif[i]->ndev) {
wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif),
-vif->iftype, vif->ifc_id);
+vif->iftype, vif-&g

[PATCH 21/29] staging: wilc1000: avoid use of 'g_sdio' static variable

2018-09-18 Thread Ajay Singh
Instead of using static variable 'g_sdio' move it as part of 'wilc'
struct. Also allocating the memory in the probe function and free during
deinitialization.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/linux_wlan.c |  1 +
 drivers/staging/wilc1000/wilc_sdio.c  | 54 +--
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  1 +
 3 files changed, 36 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index b666e1e..560c168 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1037,6 +1037,7 @@ void wilc_netdev_cleanup(struct wilc *wilc)
flush_workqueue(wilc->hif_workqueue);
destroy_workqueue(wilc->hif_workqueue);
wilc_wlan_cfg_deinit(wilc);
+   kfree(wilc->bus_data);
kfree(wilc);
 }
 EXPORT_SYMBOL_GPL(wilc_netdev_cleanup);
diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
b/drivers/staging/wilc1000/wilc_sdio.c
index b2080d8..7ef047c 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -30,7 +30,6 @@ struct wilc_sdio {
int has_thrpt_enh3;
 };
 
-static struct wilc_sdio g_sdio;
 static const struct wilc_hif_func wilc_hif_sdio;
 
 static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data);
@@ -109,6 +108,11 @@ static int linux_sdio_probe(struct sdio_func *func,
struct wilc *wilc;
int ret;
struct gpio_desc *gpio = NULL;
+   struct wilc_sdio *sdio_priv;
+
+   sdio_priv = kzalloc(sizeof(*sdio_priv), GFP_KERNEL);
+   if (!sdio_priv)
+   return -ENOMEM;
 
if (IS_ENABLED(CONFIG_WILC1000_HW_OOB_INTR)) {
gpio = gpiod_get(&func->dev, "irq", GPIOD_IN);
@@ -124,9 +128,11 @@ static int linux_sdio_probe(struct sdio_func *func,
ret = wilc_netdev_init(&wilc, &func->dev, HIF_SDIO, &wilc_hif_sdio);
if (ret) {
dev_err(&func->dev, "Couldn't initialize netdev\n");
+   kfree(sdio_priv);
return ret;
}
sdio_set_drvdata(func, wilc);
+   wilc->bus_data = sdio_priv;
wilc->dev = &func->dev;
wilc->gpio_irq = gpio;
 
@@ -381,6 +387,7 @@ static int sdio_set_func1_block_size(struct wilc *wilc, u32 
block_size)
 static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data)
 {
struct sdio_func *func = dev_to_sdio_func(wilc->dev);
+   struct wilc_sdio *sdio_priv = wilc->bus_data;
int ret;
 
cpu_to_le32s(&data);
@@ -415,7 +422,7 @@ static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 
data)
cmd.increment = 1;
cmd.count = 4;
cmd.buffer = (u8 *)&data;
-   cmd.block_size = g_sdio.block_size;
+   cmd.block_size = sdio_priv->block_size;
ret = wilc_sdio_cmd53(wilc, &cmd);
if (ret) {
dev_err(&func->dev,
@@ -434,7 +441,8 @@ static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 
data)
 static int sdio_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size)
 {
struct sdio_func *func = dev_to_sdio_func(wilc->dev);
-   u32 block_size = g_sdio.block_size;
+   struct wilc_sdio *sdio_priv = wilc->bus_data;
+   u32 block_size = sdio_priv->block_size;
struct sdio_cmd53 cmd;
int nblk, nleft, ret;
 
@@ -523,6 +531,7 @@ static int sdio_write(struct wilc *wilc, u32 addr, u8 *buf, 
u32 size)
 static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data)
 {
struct sdio_func *func = dev_to_sdio_func(wilc->dev);
+   struct wilc_sdio *sdio_priv = wilc->bus_data;
int ret;
 
if (addr >= 0xf0 && addr <= 0xff) {
@@ -553,7 +562,7 @@ static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 
*data)
cmd.count = 4;
cmd.buffer = (u8 *)data;
 
-   cmd.block_size = g_sdio.block_size;
+   cmd.block_size = sdio_priv->block_size;
ret = wilc_sdio_cmd53(wilc, &cmd);
if (ret) {
dev_err(&func->dev,
@@ -574,7 +583,8 @@ static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 
*data)
 static int sdio_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size)
 {
struct sdio_func *func = dev_to_sdio_func(wilc->dev);
-   u32 block_size = g_sdio.block_size;
+   struct wilc_sdio *sdio_priv = wilc->bus_data;
+   u32 block_size = sdio_priv->block_size;
struct sdio_cmd53 cmd;
int nblk, nleft, ret;
 
@@ -674,13 +684,14 @@ static int sdio_deinit(struct wilc *wilc)
 static int sdio_init(struct wilc *wilc, bool resume)
 {
struct sdio_func *func = dev_to_sdio_func(wilc->dev);
+   struct wilc_sdio *sdi

[PATCH 24/29] staging: wilc1000: remove p2p related static variables to wilc_vif struct

2018-09-18 Thread Ajay Singh
Avoid use of static variable and move them as part of private
data(wilc_priv) struct.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/linux_wlan.c |  2 +
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 60 +++
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  7 +++
 3 files changed, 38 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 560c168..695d5b2 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -729,6 +729,7 @@ static int wilc_mac_open(struct net_device *ndev)
 {
struct wilc_vif *vif = netdev_priv(ndev);
struct wilc *wl = vif->wilc;
+   struct wilc_priv *priv = wdev_priv(vif->ndev->ieee80211_ptr);
unsigned char mac_add[ETH_ALEN] = {0};
int ret = 0;
int i = 0;
@@ -782,6 +783,7 @@ static int wilc_mac_open(struct net_device *ndev)
 vif->frame_reg[1].reg);
netif_wake_queue(ndev);
wl->open_ifcs++;
+   priv->p2p.local_random = 0x01;
vif->mac_opened = 1;
return 0;
 }
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 1a4d262..4fd 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -137,10 +137,7 @@ struct p2p_mgmt_data {
 static u8 wlan_channel = INVALID_CHANNEL;
 static u8 curr_channel;
 static u8 p2p_oui[] = {0x50, 0x6f, 0x9A, 0x09};
-static u8 p2p_local_random = 0x01;
-static u8 p2p_recv_random;
 static u8 p2p_vendor_spec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03};
-static bool wilc_ie;
 
 static struct ieee80211_supported_band wilc_band_2ghz = {
.channels = ieee80211_2ghz_channels,
@@ -515,9 +512,9 @@ static void cfg_connect_result(enum conn_event 
conn_disconn_evt,
GFP_KERNEL);
} else if (conn_disconn_evt == CONN_DISCONN_EVENT_DISCONN_NOTIF) {
vif->obtaining_ip = false;
-   p2p_local_random = 0x01;
-   p2p_recv_random = 0x00;
-   wilc_ie = false;
+   priv->p2p.local_random = 0x01;
+   priv->p2p.recv_random = 0x00;
+   priv->p2p.is_wilc_ie = false;
eth_zero_addr(priv->associated_bss);
wilc_wlan_set_bssid(priv->dev, null_bssid, STATION_MODE);
 
@@ -829,9 +826,9 @@ static int disconnect(struct wiphy *wiphy, struct 
net_device *dev,
wlan_channel = INVALID_CHANNEL;
wilc_wlan_set_bssid(priv->dev, null_bssid, STATION_MODE);
 
-   p2p_local_random = 0x01;
-   p2p_recv_random = 0x00;
-   wilc_ie = false;
+   priv->p2p.local_random = 0x01;
+   priv->p2p.recv_random = 0x00;
+   priv->p2p.is_wilc_ie = false;
wfi_drv->p2p_timeout = 0;
 
ret = wilc_disconnect(vif, reason_code);
@@ -1330,20 +1327,21 @@ static void wilc_wfi_cfg_parse_rx_vendor_spec(struct 
wilc_priv *priv, u8 *buff,
struct wilc_vif *vif = netdev_priv(priv->dev);
 
subtype = buff[P2P_PUB_ACTION_SUBTYPE];
-   if ((subtype == GO_NEG_REQ || subtype == GO_NEG_RSP) && !wilc_ie) {
+   if ((subtype == GO_NEG_REQ || subtype == GO_NEG_RSP) &&
+   !priv->p2p.is_wilc_ie) {
for (i = P2P_PUB_ACTION_SUBTYPE; i < size; i++) {
if (!memcmp(p2p_vendor_spec, &buff[i], 6)) {
-   p2p_recv_random = buff[i + 6];
-   wilc_ie = true;
+   priv->p2p.recv_random = buff[i + 6];
+   priv->p2p.is_wilc_ie = true;
break;
}
}
}
 
-   if (p2p_local_random <= p2p_recv_random) {
+   if (priv->p2p.local_random <= priv->p2p.recv_random) {
netdev_dbg(vif->ndev,
   "PEER WILL BE GO LocaRand=%02x RecvRand %02x\n",
-  p2p_local_random, p2p_recv_random);
+  priv->p2p.local_random, priv->p2p.recv_random);
return;
}
 
@@ -1411,7 +1409,7 @@ void wilc_wfi_p2p_rx(struct net_device *dev, u8 *buff, 
u32 size)
  size);
 
if ((subtype == GO_NEG_REQ || subtype == GO_NEG_RSP) &&
-   wilc_ie)
+   priv->p2p.is_wilc_ie)
size -= 7;
 
break;
@@ -1503,7 +1501,8 @@ static int cancel_remain_on_channel(struct wiphy *wiphy,
priv->remain_on_ch_params.listen_session_id);
 }
 
-static void wilc_wfi_cfg_tx_vendor_spec(struct p

[PATCH 18/29] staging: wilc1000: rename 'wilc_mac_cfg' struct to 'wilc_cfg_str_vals'

2018-09-18 Thread Ajay Singh
Rename 'wilc_mac_cfg' struct to 'wilc_cfg_str_vals' as its more
appropriate for structure to store the values of string configuration.

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

diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c 
b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index 8f1e962..930a389 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -438,7 +438,7 @@ void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 
*frame, int size,
 
 int wilc_wlan_cfg_init(struct wilc *wl)
 {
-   struct wilc_mac_cfg *mac_cfg;
+   struct wilc_cfg_str_vals *str_vals;
int i = 0;
 
wl->cfg.b = kmemdup(g_cfg_byte, sizeof(g_cfg_byte), GFP_KERNEL);
@@ -457,20 +457,20 @@ int wilc_wlan_cfg_init(struct wilc *wl)
if (!wl->cfg.s)
goto out_w;
 
-   mac_cfg = kzalloc(sizeof(mac_cfg), GFP_KERNEL);
-   if (!mac_cfg)
+   str_vals = kzalloc(sizeof(str_vals), GFP_KERNEL);
+   if (!str_vals)
goto out_s;
 
-   wl->cfg.str_vals = mac_cfg;
+   wl->cfg.str_vals = str_vals;
/* store the string cfg parameters */
wl->cfg.s[i].id = WID_FIRMWARE_VERSION;
-   wl->cfg.s[i].str = mac_cfg->firmware_version;
+   wl->cfg.s[i].str = str_vals->firmware_version;
i++;
wl->cfg.s[i].id = WID_MAC_ADDR;
-   wl->cfg.s[i].str = mac_cfg->mac_address;
+   wl->cfg.s[i].str = str_vals->mac_address;
i++;
wl->cfg.s[i].id = WID_ASSOC_RES_INFO;
-   wl->cfg.s[i].str = mac_cfg->assoc_rsp;
+   wl->cfg.s[i].str = str_vals->assoc_rsp;
i++;
wl->cfg.s[i].id = WID_NIL;
wl->cfg.s[i].str = NULL;
diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.h 
b/drivers/staging/wilc1000/wilc_wlan_cfg.h
index 176eef1..e5ca6ce 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.h
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.h
@@ -27,7 +27,7 @@ struct wilc_cfg_str {
u8 *str;
 };
 
-struct wilc_mac_cfg {
+struct wilc_cfg_str_vals {
u8 mac_address[7];
u8 firmware_version[129];
u8 assoc_rsp[256];
@@ -38,7 +38,7 @@ struct wilc_cfg {
struct wilc_cfg_hword *hw;
struct wilc_cfg_word *w;
struct wilc_cfg_str *s;
-   struct wilc_mac_cfg *str_vals;
+   struct wilc_cfg_str_vals *str_vals;
 };
 
 struct wilc;
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 22/29] staging: wilc1000: avoid use of 'g_spi' static variable

2018-09-18 Thread Ajay Singh
Instead of using static variable 'g_spi' move it as part of 'wilc'
struct. Also allocating the memory in the probe function and
free is taken care in wilc_netdev_cleanup().

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_spi.c | 58 +++--
 1 file changed, 36 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_spi.c 
b/drivers/staging/wilc1000/wilc_spi.c
index 5517477..2559cf0 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -14,7 +14,6 @@ struct wilc_spi {
int has_thrpt_enh;
 };
 
-static struct wilc_spi g_spi;
 static const struct wilc_hif_func wilc_hif_spi;
 
 /
@@ -107,6 +106,11 @@ static int wilc_bus_probe(struct spi_device *spi)
int ret;
struct wilc *wilc;
struct gpio_desc *gpio;
+   struct wilc_spi *spi_priv;
+
+   spi_priv = kzalloc(sizeof(*spi_priv), GFP_KERNEL);
+   if (!spi_priv)
+   return -ENOMEM;
 
gpio = gpiod_get(&spi->dev, "irq", GPIOD_IN);
if (IS_ERR(gpio)) {
@@ -117,11 +121,14 @@ static int wilc_bus_probe(struct spi_device *spi)
}
 
ret = wilc_netdev_init(&wilc, NULL, HIF_SPI, &wilc_hif_spi);
-   if (ret)
+   if (ret) {
+   kfree(spi_priv);
return ret;
+   }
 
spi_set_drvdata(spi, wilc);
wilc->dev = &spi->dev;
+   wilc->bus_data = spi_priv;
wilc->gpio_irq = gpio;
 
return 0;
@@ -275,6 +282,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
u8 clockless)
 {
struct spi_device *spi = to_spi_device(wilc->dev);
+   struct wilc_spi *spi_priv = wilc->bus_data;
u8 wb[32], rb[32];
u8 wix, rix;
u32 len2;
@@ -375,7 +383,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
if (result != N_OK)
return result;
 
-   if (!g_spi.crc_off)
+   if (!spi_priv->crc_off)
wb[len - 1] = (crc7(0x7f, (const u8 *)&wb[0], len - 1)) << 1;
else
len -= 1;
@@ -393,7 +401,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
} else if (cmd == CMD_INTERNAL_READ || cmd == CMD_SINGLE_READ) {
int tmp = NUM_RSP_BYTES + NUM_DATA_HDR_BYTES + NUM_DATA_BYTES
+ NUM_DUMMY_BYTES;
-   if (!g_spi.crc_off)
+   if (!spi_priv->crc_off)
len2 = len + tmp + NUM_CRC_BYTES;
else
len2 = len + tmp;
@@ -485,7 +493,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
return N_FAIL;
}
 
-   if (!g_spi.crc_off) {
+   if (!spi_priv->crc_off) {
/*
 * Read Crc
 */
@@ -527,7 +535,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
/*
 * Read Crc
 */
-   if (!g_spi.crc_off && wilc_spi_rx(wilc, crc, 2)) {
+   if (!spi_priv->crc_off && wilc_spi_rx(wilc, crc, 2)) {
dev_err(&spi->dev,
"Failed block crc read, bus err\n");
return N_FAIL;
@@ -585,7 +593,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
/*
 * Read Crc
 */
-   if (!g_spi.crc_off && wilc_spi_rx(wilc, crc, 2)) {
+   if (!spi_priv->crc_off && wilc_spi_rx(wilc, crc, 2)) {
dev_err(&spi->dev,
"Failed block crc read, bus err\n");
result = N_FAIL;
@@ -602,6 +610,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
 static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz)
 {
struct spi_device *spi = to_spi_device(wilc->dev);
+   struct wilc_spi *spi_priv = wilc->bus_data;
int ix, nbytes;
int result = 1;
u8 cmd, order, crc[2] = {0};
@@ -648,7 +657,7 @@ static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz)
/*
 * Write Crc
 */
-   if (!g_spi.crc_off) {
+   if (!spi_priv->crc_off) {
if (wilc_spi_tx(wilc, crc, 2)) {
dev_err(&spi->dev, "Failed data block crc 
write, bus error...\n");
   

[PATCH 25/29] staging: wilc1000: remove wilc_debugfs.c file as its not used

2018-09-18 Thread Ajay Singh
Deleted wilc_debugfs.c file as it's not used.

Earlier discussion link:
[1]. https://www.spinics.net/lists/linux-wireless/msg176076.html

Suggested-by: Greg KH 
Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/Makefile   |   5 +-
 drivers/staging/wilc1000/wilc_debugfs.c | 115 
 2 files changed, 2 insertions(+), 118 deletions(-)
 delete mode 100644 drivers/staging/wilc1000/wilc_debugfs.c

diff --git a/drivers/staging/wilc1000/Makefile 
b/drivers/staging/wilc1000/Makefile
index ee7e26b..5718bc4 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -4,12 +4,11 @@ obj-$(CONFIG_WILC1000) += wilc1000.o
 ccflags-y += -DFIRMWARE_1002=\"atmel/wilc1002_firmware.bin\" \
-DFIRMWARE_1003=\"atmel/wilc1003_firmware.bin\"
 
-ccflags-y += -I$(src)/ -DWILC_ASIC_A0 -DWILC_DEBUGFS
+ccflags-y += -I$(src)/ -DWILC_ASIC_A0
 
 wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \
coreconfigurator.o host_interface.o \
-   wilc_wlan_cfg.o wilc_debugfs.o \
-   wilc_wlan.o
+   wilc_wlan_cfg.o wilc_wlan.o
 
 obj-$(CONFIG_WILC1000_SDIO) += wilc1000-sdio.o
 wilc1000-sdio-objs += wilc_sdio.o
diff --git a/drivers/staging/wilc1000/wilc_debugfs.c 
b/drivers/staging/wilc1000/wilc_debugfs.c
deleted file mode 100644
index 8001df6..000
--- a/drivers/staging/wilc1000/wilc_debugfs.c
+++ /dev/null
@@ -1,115 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries.
- * All rights reserved.
- */
-
-#if defined(WILC_DEBUGFS)
-#include 
-#include 
-
-#include "wilc_wlan_if.h"
-
-static struct dentry *wilc_dir;
-
-#define DEBUG   BIT(0)
-#define INFOBIT(1)
-#define WRN BIT(2)
-#define ERR BIT(3)
-
-#define DBG_LEVEL_ALL  (DEBUG | INFO | WRN | ERR)
-static atomic_t WILC_DEBUG_LEVEL = ATOMIC_INIT(ERR);
-EXPORT_SYMBOL_GPL(WILC_DEBUG_LEVEL);
-
-static ssize_t wilc_debug_level_read(struct file *file, char __user *userbuf,
-size_t count, loff_t *ppos)
-{
-   char buf[128];
-   int res = 0;
-
-   /* only allow read from start */
-   if (*ppos > 0)
-   return 0;
-
-   res = scnprintf(buf, sizeof(buf), "Debug Level: %x\n",
-   atomic_read(&WILC_DEBUG_LEVEL));
-
-   return simple_read_from_buffer(userbuf, count, ppos, buf, res);
-}
-
-static ssize_t wilc_debug_level_write(struct file *filp,
- const char __user *buf, size_t count,
- loff_t *ppos)
-{
-   int flag = 0;
-   int ret;
-
-   ret = kstrtouint_from_user(buf, count, 16, &flag);
-   if (ret)
-   return ret;
-
-   if (flag > DBG_LEVEL_ALL) {
-   pr_info("%s, value (0x%08x) is out of range, stay previous flag 
(0x%08x)\n",
-   __func__, flag, atomic_read(&WILC_DEBUG_LEVEL));
-   return -EINVAL;
-   }
-
-   atomic_set(&WILC_DEBUG_LEVEL, (int)flag);
-
-   if (flag == 0)
-   pr_info("Debug-level disabled\n");
-   else
-   pr_info("Debug-level enabled\n");
-
-   return count;
-}
-
-#define FOPS(_open, _read, _write, _poll) { \
-   .owner  = THIS_MODULE, \
-   .open   = (_open), \
-   .read   = (_read), \
-   .write  = (_write), \
-   .poll   = (_poll), \
-}
-
-struct wilc_debugfs_info_t {
-   const char *name;
-   int perm;
-   unsigned int data;
-   const struct file_operations fops;
-};
-
-static struct wilc_debugfs_info_t debugfs_info[] = {
-   {
-   "wilc_debug_level",
-   0666,
-   (DEBUG | ERR),
-   FOPS(NULL, wilc_debug_level_read, wilc_debug_level_write, NULL),
-   },
-};
-
-static int __init wilc_debugfs_init(void)
-{
-   int i;
-   struct wilc_debugfs_info_t *info;
-
-   wilc_dir = debugfs_create_dir("wilc_wifi", NULL);
-   for (i = 0; i < ARRAY_SIZE(debugfs_info); i++) {
-   info = &debugfs_info[i];
-   debugfs_create_file(info->name,
-   info->perm,
-   wilc_dir,
-   &info->data,
-   &info->fops);
-   }
-   return 0;
-}
-module_init(wilc_debugfs_init);
-
-static void __exit wilc_debugfs_remove(void)
-{
-   debugfs_remove_recursive(wilc_dir);
-}
-module_exit(wilc_debugfs_remove);
-
-#endif
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 23/29] staging: wilc1000: remove unnecessary memset in sdio_init() & wilc_spi_init()

2018-09-18 Thread Ajay Singh
Cleanup changes to avoid unnecessary setting 'wilc->bus_data' value to
zero as the buffer was allocated using kzalloc().

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_sdio.c | 4 +---
 drivers/staging/wilc1000/wilc_spi.c  | 3 ---
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
b/drivers/staging/wilc1000/wilc_sdio.c
index 7ef047c..ca351c9 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -689,10 +689,8 @@ static int sdio_init(struct wilc *wilc, bool resume)
int loop, ret;
u32 chipid;
 
-   if (!resume) {
-   memset(sdio_priv, 0, sizeof(struct wilc_sdio));
+   if (!resume)
sdio_priv->irq_gpio = wilc->dev_irq_num;
-   }
 
/**
 *  function 0 csa enable
diff --git a/drivers/staging/wilc1000/wilc_spi.c 
b/drivers/staging/wilc1000/wilc_spi.c
index 2559cf0..cef127b 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -838,12 +838,9 @@ static int wilc_spi_init(struct wilc *wilc, bool resume)
return 1;
}
 
-   memset(spi_priv, 0, sizeof(struct wilc_spi));
-
/*
 * configure protocol
 */
-   spi_priv->crc_off = 0;
 
/*
 * TODO: We can remove the CRC trials if there is a definite
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 20/29] staging: wilc1000: remove use of unnecessary 'wilc_connected_ssid' variable

2018-09-18 Thread Ajay Singh
'wilc_connected_ssid' actually used to store the BSSID information for
connected BSSID. 'wilc_vif' already has 'bssid' variable to store the
same information. So refactor code to remove 'wilc_connected_ssid' and
instead used 'wilc_vif' struct 'bssid' element.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 529390d..01db899 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -813,7 +813,6 @@ static void handle_scan(struct work_struct *work)
kfree(msg);
 }
 
-u8 wilc_connected_ssid[6] = {0};
 static void handle_connect(struct work_struct *work)
 {
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
@@ -835,11 +834,6 @@ static void handle_connect(struct work_struct *work)
return;
}
 
-   if (memcmp(conn_attr->bssid, wilc_connected_ssid, ETH_ALEN) == 0) {
-   netdev_err(vif->ndev, "Discard connect request\n");
-   goto error;
-   }
-
bss_param = conn_attr->params;
if (!bss_param) {
netdev_err(vif->ndev, "Required BSSID not found\n");
@@ -1019,10 +1013,6 @@ static void handle_connect(struct work_struct *work)
cur_byte = wid_list[wid_cnt].val;
wid_cnt++;
 
-   if (conn_attr->bssid)
-   memcpy(wilc_connected_ssid,
-  conn_attr->bssid, ETH_ALEN);
-
result = wilc_send_config_pkt(vif, SET_CFG, wid_list,
  wid_cnt,
  wilc_get_vif_idx(vif));
@@ -1145,8 +1135,6 @@ static void handle_connect_timeout(struct work_struct 
*work)
kfree(hif_drv->usr_conn_req.ies);
hif_drv->usr_conn_req.ies = NULL;
 
-   eth_zero_addr(wilc_connected_ssid);
-
 out:
kfree(msg);
 }
@@ -1452,16 +1440,6 @@ 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, 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");
-   eth_zero_addr(wilc_connected_ssid);
-   }
-
if (hif_drv->usr_conn_req.bssid) {
memcpy(conn_info.bssid, hif_drv->usr_conn_req.bssid, 6);
 
@@ -1874,8 +1852,6 @@ static void handle_disconnect(struct work_struct *work)
vif->obtaining_ip = false;
wilc_set_power_mgmt(vif, 0, 0);
 
-   eth_zero_addr(wilc_connected_ssid);
-
result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
  wilc_get_vif_idx(vif));
 
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 4416f8f..33fb731 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -359,6 +359,4 @@ int wilc_get_vif_idx(struct wilc_vif *vif);
 int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power);
 int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power);
 
-extern u8 wilc_connected_ssid[6];
-
 #endif
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 76d017d..1a4d262 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -478,7 +478,6 @@ static void cfg_connect_result(enum conn_event 
conn_disconn_evt,
connect_status = WLAN_STATUS_UNSPECIFIED_FAILURE;
wilc_wlan_set_bssid(priv->dev, null_bssid,
STATION_MODE);
-   eth_zero_addr(wilc_connected_ssid);
 
if (!wfi_drv->p2p_connect)
wlan_channel = INVALID_CHANNEL;
@@ -521,7 +520,6 @@ static void cfg_connect_result(enum conn_event 
conn_disconn_evt,
wilc_ie = false;
eth_zero_addr(priv->associated_bss);
wilc_wlan_set_bssid(priv->dev, null_bssid, STATION_MODE);
-   eth_zero_addr(wilc_connected_ssid);
 
if (!wfi_drv->p2p_connect)
wlan_channel = INVALID_CHANNE

[PATCH 29/29] staging: wilc1000: return exact error of register_netdev() from wilc_netdev_init()

2018-09-18 Thread Ajay Singh
Modified wilc_netdev_init() to return the error code received from
register_netdev() during the failure condition.

Earlier discussion link
[1]. https://www.spinics.net/lists/linux-wireless/msg177304.html

Suggested-by: Claudiu Beznea 
Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/linux_wlan.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 29c1317..75abaf9 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1056,14 +1056,14 @@ static const struct net_device_ops wilc_netdev_ops = {
 int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
 const struct wilc_hif_func *ops)
 {
-   int i, ret;
+   int i, ret = -ENOMEM;
struct wilc_vif *vif;
struct net_device *ndev;
struct wilc *wl;
 
wl = kzalloc(sizeof(*wl), GFP_KERNEL);
if (!wl)
-   return -ENOMEM;
+   return ret;
 
if (wilc_wlan_cfg_init(wl))
goto free_wl;
@@ -1151,7 +1151,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
wilc_wlan_cfg_deinit(wl);
 free_wl:
kfree(wl);
-   return -ENOMEM;
+   return ret;
 }
 EXPORT_SYMBOL_GPL(wilc_netdev_init);
 
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 27/29] staging: wilc1000: use usleep_range() in place of udelay()

2018-09-18 Thread Ajay Singh
Changes to avoid the below checkpatch warning:

'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 0ec0d9b..a48c906 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -412,7 +412,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, 400);
wilc->hif_func->hif_read_reg(wilc, 0xf0, ®);
do {
wilc->hif_func->hif_write_reg(wilc, 0xf0,
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 28/29] staging: wilc1000: avoid spaces preferred around checkpatch issue

2018-09-18 Thread Ajay Singh
Cleanup patch to add extra spaces around the '/' to avoid the below
checkpatch warning.

'spaces preferred around that '/' (ctx:VxV)'

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

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 695d5b2..29c1317 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -823,7 +823,7 @@ static void wilc_set_multicast_list(struct net_device *dev)
 
netdev_for_each_mc_addr(ha, dev) {
memcpy(mc_list + i, ha->addr, ETH_ALEN);
-   netdev_dbg(dev, "Entry[%d]: %x:%x:%x:%x:%x:%x\n", i/ETH_ALEN,
+   netdev_dbg(dev, "Entry[%d]: %x:%x:%x:%x:%x:%x\n", i / ETH_ALEN,
   mc_list[i], mc_list[i + 1], mc_list[i + 2],
   mc_list[i + 3], mc_list[i + 4], mc_list[i + 5]);
i += ETH_ALEN;
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 29/29] staging: wilc1000: return exact error of register_netdev() from wilc_netdev_init()

2018-09-19 Thread Ajay Singh
Hi Dan,

Thanks your reviewing the patch.

On Wed, 19 Sep 2018 12:41:32 +0300
Dan Carpenter  wrote:

> I was waiting for you to send this like a spider waits for flies.  You
> fell directly into my trap.  Mwuahahahahaha.

Oops!!! I missed seeing it coming :)

> 
> drivers/staging/wilc1000/linux_wlan.c
>   1056  int wilc_netdev_init(struct wilc **wilc, struct device *dev,
> int io_type, 1057   const struct wilc_hif_func
> *ops) 1058  {
>   1059  int i, ret = -ENOMEM;
>   1060  struct wilc_vif *vif;
>   1061  struct net_device *ndev;
>   1062  struct wilc *wl;
>   1063  
>   1064  wl = kzalloc(sizeof(*wl), GFP_KERNEL);
>   1065  if (!wl)
>   1066  return ret;
>^^^
> It's cleaner to return -ENOMEM so that we don't have to glance up to
> the declaration block.  This is especially true when "ret" is zero,
> btw, because that can indicate a reversed test.

I will change it to directly return -ENOMEM value.

> 
>   if (!ret)
>   return ret;
> 
> In this theoretically example it was supposed to be:
> 
>   if (ret)
>   return ret;
> 
> Normally, reversed conditions are caught in testing, but for the
> kernel, no one has the hardware to test everything so we do get
> reversed conditions from time to time.
> 
>   1067  
>   1068  if (wilc_wlan_cfg_init(wl))

I will set 'ret' value to -ENOMEM here also.

>   1069  goto free_wl;
>   1070  
>   1071  *wilc = wl;
>   1072  wl->io_type = io_type;
>   1073  wl->hif_func = ops;
>   1074  wl->enable_ps = true;
>   1075  wl->chip_ps_state = CHIP_WAKEDUP;
>   1076  INIT_LIST_HEAD(&wl->txq_head.list);
>   1077  INIT_LIST_HEAD(&wl->rxq_head.list);
>   1078  
>   1079  wl->hif_workqueue =
> create_singlethread_workqueue("WILC_wq"); 1080  if
> (!wl->hif_workqueue) 1081  goto free_cfg;
>   1082  
>   1083  register_inetaddr_notifier(&g_dev_notifier);
>   1084  
>   1085  for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
>   1086  struct wireless_dev *wdev;
>   1087  
>   1088  ndev = alloc_etherdev(sizeof(struct
> wilc_vif)); 1089  if (!ndev)
>   1090  goto free_ndev;
> ^^^
> ret is zero on the second iteration through the loop.

I will set 'ret' to -ENOMEM before 'goto', which should handle this
scenario.

> 
>   1091  
>   1092  vif = netdev_priv(ndev);
>   1093  memset(vif, 0, sizeof(struct wilc_vif));
>   1094  
>   1095  if (i == 0) {
>   1096  strcpy(ndev->name, "wlan%d");
>   1097  vif->ifc_id = 1;
>   1098  } else {
>   1099  strcpy(ndev->name, "p2p%d");
>   1100  vif->ifc_id = 0;
>   1101  }
>   1102  vif->wilc = *wilc;
>   1103  vif->ndev = ndev;
>   1104  wl->vif[i] = vif;
>   1105  wl->vif_num = i;
>   1106  vif->idx = wl->vif_num;
>   1107  
>   1108  ndev->netdev_ops = &wilc_netdev_ops;
>   1109  
>   1110  wdev = wilc_create_wiphy(ndev, dev);
>     if (!wdev) {
>   1112  netdev_err(ndev, "Can't register WILC
> Wiphy\n"); 1113  goto free_ndev;
> ^^^
> Here too.

Same here, i.e setting ret = -ENOMEM should handle the condition.

Also I will remove the default setting of 'ret' value to -ENOMEM because
after modification the error scenarios will set 'ret' explicitly.

Regards,
Ajay
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 01/29] staging: wilc1000: change return type to 'void' for wilc_frame_register()

2018-09-19 Thread Ajay Singh
Cleanup patch to use 'void' return type for wilc_frame_register(), as
its return value is not used.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 5388be9..7729f83 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -3641,14 +3641,14 @@ int wilc_listen_state_expired(struct wilc_vif *vif, u32 
session_id)
return result;
 }
 
-int wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg)
+void wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg)
 {
int result;
struct host_if_msg *msg;
 
msg = wilc_alloc_work(vif, handle_register_frame, false);
if (IS_ERR(msg))
-   return PTR_ERR(msg);
+   return;
 
switch (frame_type) {
case ACTION:
@@ -3670,8 +3670,6 @@ int wilc_frame_register(struct wilc_vif *vif, u16 
frame_type, bool reg)
netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
kfree(msg);
}
-
-   return result;
 }
 
 int wilc_add_beacon(struct wilc_vif *vif, u32 interval, u32 dtim_period,
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index a48818f..15ffaeb 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -348,7 +348,7 @@ int wilc_remain_on_channel(struct wilc_vif *vif, u32 
session_id,
   wilc_remain_on_chan_ready ready,
   void *user_arg);
 int wilc_listen_state_expired(struct wilc_vif *vif, u32 session_id);
-int wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg);
+void wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg);
 int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode,
 u8 ifc_id);
 int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode);
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 00/29] staging: wilc1000: avoid static variables and cleanup changes

2018-09-19 Thread Ajay Singh
This patch series contains changes to avoid the use of static variables.
Cleanup changes to fix some checkpatch issues and return void for function
if their return value is not used.
Also deleted 'wilc_debugfs.c' file as it's not used

Changes since v1:
   Address Dan's comment for patch#29
- return the correct error for failure in the second iteration.


Ajay Singh (29):
  staging: wilc1000: change return type to 'void' for
wilc_frame_register()
  staging: wilc1000: change return type to 'void' for
wilc_wlan_set_bssid()
  staging: wilc1000: change return type to 'void' for lock init & deinit
functions
  staging: wilc1000: change return type to 'void' for
wilc_deinit_host_int()
  staging: wilc1000: change return type to 'void' for
wilc_wfi_deinit_mon_interface()
  staging: wilc1000: use 'void' return type for
host_int_get_assoc_res_info()
  staging: wilc1000: use 'void' return for wilc_wlan_txq_add_to_head()
  staging: wilc1000: change return type to 'void' tcp ack filter
functions
  staging: wilc1000: use 'void' return for
wilc_wlan_txq_filter_dup_tcp_ack()
  staging: wilc1000: change return type to 'void' for
wilc_wlan_cfg_indicate_rx()
  staging: wilc1000: refactor wilc_wlan_parse_info_frame() function
  staging: wilc1000: set default value of cfg response type in
wilc_wlan_cfg_indicate_rx()
  staging: wilc1000: changes 'val' type to u8 in wilc_cfg_byte struct
  staging: wilc1000: remove unused wid type values
  staging: wilc1000: remove unused wid from cfg struct
  staging: wilc1000: refactor code to remove 'mac_status' from
'wilc_mac_cfg' struct
  staging: wilc1000: refactor code to avoid static variables for config
parameters
  staging: wilc1000: rename 'wilc_mac_cfg' struct to 'wilc_cfg_str_vals'
  staging: wilc1000: avoid the use of 'hif_driver_comp' completion
variable
  staging: wilc1000: remove use of unnecessary 'wilc_connected_ssid'
variable
  staging: wilc1000: avoid use of 'g_sdio' static variable
  staging: wilc1000: avoid use of 'g_spi' static variable
  staging: wilc1000: remove unnecessary memset in sdio_init() &
wilc_spi_init()
  staging: wilc1000: remove p2p related static variables to wilc_vif
struct
  staging: wilc1000: remove wilc_debugfs.c file as its not used
  staging: wilc1000: remove unnecessary option used with ccflags-y in
Makefile
  staging: wilc1000: use usleep_range() in place of udelay()
  staging: wilc1000: avoid spaces preferred around checkpatch issue
  staging: wilc1000: return exact error of register_netdev() from
wilc_netdev_init()

 drivers/staging/wilc1000/Makefile |   5 +-
 drivers/staging/wilc1000/host_interface.c |  64 ++---
 drivers/staging/wilc1000/host_interface.h |   6 +-
 drivers/staging/wilc1000/linux_mon.c  |   3 +-
 drivers/staging/wilc1000/linux_wlan.c |  46 ++--
 drivers/staging/wilc1000/wilc_debugfs.c   | 115 -
 drivers/staging/wilc1000/wilc_sdio.c  |  56 +++--
 drivers/staging/wilc1000/wilc_spi.c   |  57 +++--
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  90 +++
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h |   4 +-
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  14 +-
 drivers/staging/wilc1000/wilc_wlan.c  |  44 ++--
 drivers/staging/wilc1000/wilc_wlan.h  |   3 +-
 drivers/staging/wilc1000/wilc_wlan_cfg.c  | 294 +-
 drivers/staging/wilc1000/wilc_wlan_cfg.h  |  26 +-
 drivers/staging/wilc1000/wilc_wlan_if.h   |   4 -
 16 files changed, 331 insertions(+), 500 deletions(-)
 delete mode 100644 drivers/staging/wilc1000/wilc_debugfs.c

-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 02/29] staging: wilc1000: change return type to 'void' for wilc_wlan_set_bssid()

2018-09-19 Thread Ajay Singh
Cleanup patch to use 'void' return type for wilc_wlan_set_bssid(),
as its always returns the same value.

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

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 49afda6..d1d2c64 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -192,14 +192,12 @@ static struct net_device *get_if_handler(struct wilc 
*wilc, u8 *mac_header)
return NULL;
 }
 
-int wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid, u8 mode)
+void wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid, u8 mode)
 {
struct wilc_vif *vif = netdev_priv(wilc_netdev);
 
memcpy(vif->bssid, bssid, 6);
vif->mode = mode;
-
-   return 0;
 }
 
 int wilc_wlan_get_num_conn_ifcs(struct wilc *wilc)
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 1837808..30151b2 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -215,6 +215,6 @@ void wilc_netdev_cleanup(struct wilc *wilc);
 int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
 const struct wilc_hif_func *ops);
 void wilc_wfi_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size);
-int wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid, u8 mode);
+void wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid, u8 mode);
 
 #endif
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 06/29] staging: wilc1000: use 'void' return type for host_int_get_assoc_res_info()

2018-09-19 Thread Ajay Singh
Change return type to 'void' for host_int_get_assoc_res_info() as its
return value is not used. 'rcvd_assoc_resp_info_len' parameter value is
used to know the status.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 7729f83..237a098d 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1388,10 +1388,10 @@ static void handle_rcvd_ntwrk_info(struct work_struct 
*work)
kfree(msg);
 }
 
-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)
+static void 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)
 {
int result;
struct wid wid;
@@ -1406,11 +1406,10 @@ static s32 host_int_get_assoc_res_info(struct wilc_vif 
*vif,
if (result) {
*rcvd_assoc_resp_info_len = 0;
netdev_err(vif->ndev, "Failed to send association response\n");
-   return -EINVAL;
+   return;
}
 
*rcvd_assoc_resp_info_len = wid.size;
-   return result;
 }
 
 static inline void host_int_free_user_conn_req(struct host_if_drv *hif_drv)
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 04/29] staging: wilc1000: change return type to 'void' for wilc_deinit_host_int()

2018-09-19 Thread Ajay Singh
Cleanup patch to use 'void' return type for wilc_deinit_host_int(),
as its return value is not used in caller.

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 37c26d4..02a8846 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2175,7 +2175,7 @@ int wilc_init_host_int(struct net_device *net)
return ret;
 }
 
-int wilc_deinit_host_int(struct net_device *net)
+void wilc_deinit_host_int(struct net_device *net)
 {
int ret;
struct wilc_priv *priv = wdev_priv(net->ieee80211_ptr);
@@ -2192,8 +2192,6 @@ int wilc_deinit_host_int(struct net_device *net)
 
if (ret)
netdev_err(net, "Error while deinitializing host interface\n");
-
-   return ret;
 }
 
 void wilc_free_wiphy(struct net_device *net)
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
index be412b6..1858f56 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
@@ -11,7 +11,7 @@
 struct wireless_dev *wilc_create_wiphy(struct net_device *net,
   struct device *dev);
 void wilc_free_wiphy(struct net_device *net);
-int wilc_deinit_host_int(struct net_device *net);
+void wilc_deinit_host_int(struct net_device *net);
 int wilc_init_host_int(struct net_device *net);
 void wilc_wfi_monitor_rx(u8 *buff, u32 size);
 int wilc_wfi_deinit_mon_interface(void);
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 05/29] staging: wilc1000: change return type to 'void' for wilc_wfi_deinit_mon_interface()

2018-09-19 Thread Ajay Singh
Use 'void' return type for wilc_wfi_deinit_mon_interface(), as same
value always return.

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

diff --git a/drivers/staging/wilc1000/linux_mon.c 
b/drivers/staging/wilc1000/linux_mon.c
index 1afdb9e..a634468 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -253,7 +253,7 @@ struct net_device *wilc_wfi_init_mon_interface(const char 
*name,
return wilc_wfi_mon;
 }
 
-int wilc_wfi_deinit_mon_interface(void)
+void wilc_wfi_deinit_mon_interface(void)
 {
bool rollback_lock = false;
 
@@ -270,5 +270,4 @@ int wilc_wfi_deinit_mon_interface(void)
}
wilc_wfi_mon = NULL;
}
-   return 0;
 }
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
index 1858f56..4812c8e 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
@@ -14,7 +14,7 @@ void wilc_free_wiphy(struct net_device *net);
 void wilc_deinit_host_int(struct net_device *net);
 int wilc_init_host_int(struct net_device *net);
 void wilc_wfi_monitor_rx(u8 *buff, u32 size);
-int wilc_wfi_deinit_mon_interface(void);
+void wilc_wfi_deinit_mon_interface(void);
 struct net_device *wilc_wfi_init_mon_interface(const char *name,
   struct net_device *real_dev);
 void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 03/29] staging: wilc1000: change return type to 'void' for lock init & deinit functions

2018-09-19 Thread Ajay Singh
Cleanup patch to use 'void' return type for wlan_deinit_locks() &
wlan_init_locks(), as same value is return.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/linux_wlan.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index d1d2c64..e2669b9 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -525,7 +525,7 @@ static int linux_wlan_init_test_config(struct net_device 
*dev,
return -1;
 }
 
-static int wlan_deinit_locks(struct net_device *dev)
+static void wlan_deinit_locks(struct net_device *dev)
 {
struct wilc_vif *vif = netdev_priv(dev);
struct wilc *wilc = vif->wilc;
@@ -533,8 +533,6 @@ static int wlan_deinit_locks(struct net_device *dev)
mutex_destroy(&wilc->hif_cs);
mutex_destroy(&wilc->rxq_cs);
mutex_destroy(&wilc->txq_add_to_head_cs);
-
-   return 0;
 }
 
 static void wlan_deinitialize_threads(struct net_device *dev)
@@ -588,7 +586,7 @@ static void wilc_wlan_deinitialize(struct net_device *dev)
}
 }
 
-static int wlan_init_locks(struct net_device *dev)
+static void wlan_init_locks(struct net_device *dev)
 {
struct wilc_vif *vif = netdev_priv(dev);
struct wilc *wl = vif->wilc;
@@ -604,8 +602,6 @@ static int wlan_init_locks(struct net_device *dev)
init_completion(&wl->cfg_event);
init_completion(&wl->sync_event);
init_completion(&wl->txq_thread_started);
-
-   return 0;
 }
 
 static int wlan_initialize_threads(struct net_device *dev)
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 07/29] staging: wilc1000: use 'void' return for wilc_wlan_txq_add_to_head()

2018-09-19 Thread Ajay Singh
Use 'void' return for wilc_wlan_txq_add_to_head() as its always
return '0' value.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wlan.c | 11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 590a51c..8057db9 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -71,8 +71,8 @@ static void wilc_wlan_txq_add_to_tail(struct net_device *dev,
complete(&wilc->txq_event);
 }
 
-static int wilc_wlan_txq_add_to_head(struct wilc_vif *vif,
-struct txq_entry_t *tqe)
+static void wilc_wlan_txq_add_to_head(struct wilc_vif *vif,
+ struct txq_entry_t *tqe)
 {
unsigned long flags;
struct wilc *wilc = vif->wilc;
@@ -87,8 +87,6 @@ static int wilc_wlan_txq_add_to_head(struct wilc_vif *vif,
spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
mutex_unlock(&wilc->txq_add_to_head_cs);
complete(&wilc->txq_event);
-
-   return 0;
 }
 
 #define NOT_TCP_ACK(-1)
@@ -275,10 +273,7 @@ static int wilc_wlan_txq_add_cfg_pkt(struct wilc_vif *vif, 
u8 *buffer,
tqe->priv = NULL;
tqe->ack_idx = NOT_TCP_ACK;
 
-   if (wilc_wlan_txq_add_to_head(vif, tqe)) {
-   kfree(tqe);
-   return 0;
-   }
+   wilc_wlan_txq_add_to_head(vif, tqe);
 
return 1;
 }
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 08/29] staging: wilc1000: change return type to 'void' tcp ack filter functions

2018-09-19 Thread Ajay Singh
Use 'void' return type for below functions as they always return '0' and
their return value is not used by caller.
add_tcp_pending_ack()
update_tcp_session()
add_tcp_pending_ack()

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wlan.c | 15 ++-
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 8057db9..66ce29d 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -91,8 +91,8 @@ static void wilc_wlan_txq_add_to_head(struct wilc_vif *vif,
 
 #define NOT_TCP_ACK(-1)
 
-static inline int add_tcp_session(struct wilc_vif *vif, u32 src_prt,
- u32 dst_prt, u32 seq)
+static inline void add_tcp_session(struct wilc_vif *vif, u32 src_prt,
+  u32 dst_prt, u32 seq)
 {
struct tcp_ack_filter *f = &vif->ack_filter;
 
@@ -103,22 +103,20 @@ static inline int add_tcp_session(struct wilc_vif *vif, 
u32 src_prt,
f->ack_session_info[f->tcp_session].dst_port = dst_prt;
f->tcp_session++;
}
-   return 0;
 }
 
-static inline int update_tcp_session(struct wilc_vif *vif, u32 index, u32 ack)
+static inline void update_tcp_session(struct wilc_vif *vif, u32 index, u32 ack)
 {
struct tcp_ack_filter *f = &vif->ack_filter;
 
if (index < 2 * MAX_TCP_SESSION &&
ack > f->ack_session_info[index].bigger_ack_num)
f->ack_session_info[index].bigger_ack_num = ack;
-   return 0;
 }
 
-static inline int add_tcp_pending_ack(struct wilc_vif *vif, u32 ack,
- u32 session_index,
- struct txq_entry_t *txqe)
+static inline void add_tcp_pending_ack(struct wilc_vif *vif, u32 ack,
+  u32 session_index,
+  struct txq_entry_t *txqe)
 {
struct tcp_ack_filter *f = &vif->ack_filter;
u32 i = f->pending_base + f->pending_acks_idx;
@@ -130,7 +128,6 @@ static inline int add_tcp_pending_ack(struct wilc_vif *vif, 
u32 ack,
txqe->ack_idx = i;
f->pending_acks_idx++;
}
-   return 0;
 }
 
 static inline void tcp_process(struct net_device *dev, struct txq_entry_t *tqe)
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 14/29] staging: wilc1000: remove unused wid type values

2018-09-19 Thread Ajay Singh
Cleanup patch to remove the wid type not used in the code.

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

diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h 
b/drivers/staging/wilc1000/wilc_wlan_if.h
index b81a73b..ce2066b 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -204,10 +204,6 @@ enum wid_type {
WID_STR = 3,
WID_BIN_DATA= 4,
WID_BIN = 5,
-   WID_IP  = 6,
-   WID_ADR = 7,
-   WID_UNDEF   = 8,
-   WID_TYPE_FORCE_32BIT= 0x
 };
 
 struct wid {
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 13/29] staging: wilc1000: changes 'val' type to u8 in wilc_cfg_byte struct

2018-09-19 Thread Ajay Singh
Use the correct datatype for storing the byte value in 'wilc_cfg_byte'
struct.

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

diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.h 
b/drivers/staging/wilc1000/wilc_wlan_cfg.h
index 189e617..082093f 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.h
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.h
@@ -9,7 +9,7 @@
 
 struct wilc_cfg_byte {
u16 id;
-   u16 val;
+   u8 val;
 };
 
 struct wilc_cfg_hword {
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 17/29] staging: wilc1000: refactor code to avoid static variables for config parameters

2018-09-19 Thread Ajay Singh
Refactor the code in wilc_wlan_cfg.c file to avoid the use of static
variables. Move the static variables as part of wilc struct and also
dynamically allocating memory for keeping those variables.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/linux_wlan.c |  12 +-
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |   2 +
 drivers/staging/wilc1000/wilc_wlan.c  |  12 +-
 drivers/staging/wilc1000/wilc_wlan.h  |   3 +-
 drivers/staging/wilc1000/wilc_wlan_cfg.c  | 159 +-
 drivers/staging/wilc1000/wilc_wlan_cfg.h  |  20 +++-
 6 files changed, 138 insertions(+), 70 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index d9f927e..8ecd664 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -161,7 +161,7 @@ void wilc_mac_indicate(struct wilc *wilc)
 {
s8 status;
 
-   wilc_wlan_cfg_get_val(WID_STATUS, &status, 1);
+   wilc_wlan_cfg_get_val(wilc, WID_STATUS, &status, 1);
if (wilc->mac_status == MAC_STATUS_INIT) {
wilc->mac_status = status;
complete(&wilc->sync_event);
@@ -677,7 +677,7 @@ static int wilc_wlan_initialize(struct net_device *dev, 
struct wilc_vif *vif)
int size;
char firmware_ver[20];
 
-   size = wilc_wlan_cfg_get_val(WID_FIRMWARE_VERSION,
+   size = wilc_wlan_cfg_get_val(wl, WID_FIRMWARE_VERSION,
 firmware_ver,
 sizeof(firmware_ver));
firmware_ver[size] = '\0';
@@ -1035,6 +1035,7 @@ void wilc_netdev_cleanup(struct wilc *wilc)
 
flush_workqueue(wilc->hif_workqueue);
destroy_workqueue(wilc->hif_workqueue);
+   wilc_wlan_cfg_deinit(wilc);
kfree(wilc);
 }
 EXPORT_SYMBOL_GPL(wilc_netdev_cleanup);
@@ -1060,6 +1061,9 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
if (!wl)
return -ENOMEM;
 
+   if (wilc_wlan_cfg_init(wl))
+   goto free_wl;
+
*wilc = wl;
wl->io_type = io_type;
wl->hif_func = ops;
@@ -1070,7 +1074,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
 
wl->hif_workqueue = create_singlethread_workqueue("WILC_wq");
if (!wl->hif_workqueue)
-   goto free_wl;
+   goto free_cfg;
 
register_inetaddr_notifier(&g_dev_notifier);
 
@@ -1139,6 +1143,8 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
}
unregister_inetaddr_notifier(&g_dev_notifier);
destroy_workqueue(wl->hif_workqueue);
+free_cfg:
+   wilc_wlan_cfg_deinit(wl);
 free_wl:
kfree(wl);
return -ENOMEM;
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 70bae3a..484c265 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -16,6 +16,7 @@
 
 #include "host_interface.h"
 #include "wilc_wlan.h"
+#include "wilc_wlan_cfg.h"
 
 #define FLOW_CONTROL_LOWER_THRESHOLD   128
 #define FLOW_CONTROL_UPPER_THRESHOLD   256
@@ -203,6 +204,7 @@ struct wilc {
int clients_count;
struct workqueue_struct *hif_workqueue;
enum chip_ps_states chip_ps_state;
+   struct wilc_cfg cfg;
 };
 
 struct wilc_wfi_mon_priv {
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 88808d9..0ec0d9b 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1194,9 +1194,9 @@ int wilc_wlan_cfg_get(struct wilc_vif *vif, int start, 
u16 wid, int commit,
return ret_size;
 }
 
-int wilc_wlan_cfg_get_val(u16 wid, u8 *buffer, u32 buffer_size)
+int wilc_wlan_cfg_get_val(struct wilc *wl, u16 wid, u8 *buffer, u32 
buffer_size)
 {
-   return wilc_wlan_cfg_get_wid_value(wid, buffer, buffer_size);
+   return wilc_wlan_cfg_get_wid_value(wl, wid, buffer, buffer_size);
 }
 
 int wilc_send_config_pkt(struct wilc_vif *vif, u8 mode, struct wid *wids,
@@ -1216,7 +1216,8 @@ int wilc_send_config_pkt(struct wilc_vif *vif, u8 mode, 
struct wid *wids,
}
}
for (i = 0; i < count; i++) {
-   wids[i].size = wilc_wlan_cfg_get_val(wids[i].id,
+   wids[i].size = wilc_wlan_cfg_get_val(vif->wilc,
+wids[i].id,
 wids[i].val,
 wids[i].size);
}
@@ -1315,11 +1316,6 @@ int wil

[PATCH v2 10/29] staging: wilc1000: change return type to 'void' for wilc_wlan_cfg_indicate_rx()

2018-09-19 Thread Ajay Singh
Cleanup patch to use 'void' return type for wilc_wlan_cfg_indicate_rx(),
as its return value is not used in caller. The value set in
'rsp' argument is used to get the success status.

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

diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c 
b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index 4215763..42c64ed 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -502,10 +502,9 @@ int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 
buffer_size)
return ret;
 }
 
-int wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size,
- struct wilc_cfg_rsp *rsp)
+void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size,
+  struct wilc_cfg_rsp *rsp)
 {
-   int ret = 1;
u8 msg_type;
u8 msg_id;
 
@@ -547,11 +546,8 @@ int wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 
*frame, int size,
default:
rsp->type = 0;
rsp->seq_no = msg_id;
-   ret = 0;
break;
}
-
-   return ret;
 }
 
 int wilc_wlan_cfg_init(void)
diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.h 
b/drivers/staging/wilc1000/wilc_wlan_cfg.h
index 0c649d1..189e617 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.h
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.h
@@ -31,8 +31,8 @@ struct wilc;
 int wilc_wlan_cfg_set_wid(u8 *frame, u32 offset, u16 id, u8 *buf, int size);
 int wilc_wlan_cfg_get_wid(u8 *frame, u32 offset, u16 id);
 int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 buffer_size);
-int wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size,
- struct wilc_cfg_rsp *rsp);
+void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size,
+  struct wilc_cfg_rsp *rsp);
 int wilc_wlan_cfg_init(void);
 
 #endif
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 22/29] staging: wilc1000: avoid use of 'g_spi' static variable

2018-09-19 Thread Ajay Singh
Instead of using static variable 'g_spi' move it as part of 'wilc'
struct. Also allocating the memory in the probe function and
free is taken care in wilc_netdev_cleanup().

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_spi.c | 58 +++--
 1 file changed, 36 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_spi.c 
b/drivers/staging/wilc1000/wilc_spi.c
index 5517477..2559cf0 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -14,7 +14,6 @@ struct wilc_spi {
int has_thrpt_enh;
 };
 
-static struct wilc_spi g_spi;
 static const struct wilc_hif_func wilc_hif_spi;
 
 /
@@ -107,6 +106,11 @@ static int wilc_bus_probe(struct spi_device *spi)
int ret;
struct wilc *wilc;
struct gpio_desc *gpio;
+   struct wilc_spi *spi_priv;
+
+   spi_priv = kzalloc(sizeof(*spi_priv), GFP_KERNEL);
+   if (!spi_priv)
+   return -ENOMEM;
 
gpio = gpiod_get(&spi->dev, "irq", GPIOD_IN);
if (IS_ERR(gpio)) {
@@ -117,11 +121,14 @@ static int wilc_bus_probe(struct spi_device *spi)
}
 
ret = wilc_netdev_init(&wilc, NULL, HIF_SPI, &wilc_hif_spi);
-   if (ret)
+   if (ret) {
+   kfree(spi_priv);
return ret;
+   }
 
spi_set_drvdata(spi, wilc);
wilc->dev = &spi->dev;
+   wilc->bus_data = spi_priv;
wilc->gpio_irq = gpio;
 
return 0;
@@ -275,6 +282,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
u8 clockless)
 {
struct spi_device *spi = to_spi_device(wilc->dev);
+   struct wilc_spi *spi_priv = wilc->bus_data;
u8 wb[32], rb[32];
u8 wix, rix;
u32 len2;
@@ -375,7 +383,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
if (result != N_OK)
return result;
 
-   if (!g_spi.crc_off)
+   if (!spi_priv->crc_off)
wb[len - 1] = (crc7(0x7f, (const u8 *)&wb[0], len - 1)) << 1;
else
len -= 1;
@@ -393,7 +401,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
} else if (cmd == CMD_INTERNAL_READ || cmd == CMD_SINGLE_READ) {
int tmp = NUM_RSP_BYTES + NUM_DATA_HDR_BYTES + NUM_DATA_BYTES
+ NUM_DUMMY_BYTES;
-   if (!g_spi.crc_off)
+   if (!spi_priv->crc_off)
len2 = len + tmp + NUM_CRC_BYTES;
else
len2 = len + tmp;
@@ -485,7 +493,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
return N_FAIL;
}
 
-   if (!g_spi.crc_off) {
+   if (!spi_priv->crc_off) {
/*
 * Read Crc
 */
@@ -527,7 +535,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
/*
 * Read Crc
 */
-   if (!g_spi.crc_off && wilc_spi_rx(wilc, crc, 2)) {
+   if (!spi_priv->crc_off && wilc_spi_rx(wilc, crc, 2)) {
dev_err(&spi->dev,
"Failed block crc read, bus err\n");
return N_FAIL;
@@ -585,7 +593,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
/*
 * Read Crc
 */
-   if (!g_spi.crc_off && wilc_spi_rx(wilc, crc, 2)) {
+   if (!spi_priv->crc_off && wilc_spi_rx(wilc, crc, 2)) {
dev_err(&spi->dev,
"Failed block crc read, bus err\n");
result = N_FAIL;
@@ -602,6 +610,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
 static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz)
 {
struct spi_device *spi = to_spi_device(wilc->dev);
+   struct wilc_spi *spi_priv = wilc->bus_data;
int ix, nbytes;
int result = 1;
u8 cmd, order, crc[2] = {0};
@@ -648,7 +657,7 @@ static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz)
/*
 * Write Crc
 */
-   if (!g_spi.crc_off) {
+   if (!spi_priv->crc_off) {
if (wilc_spi_tx(wilc, crc, 2)) {
dev_err(&spi->dev, "Failed data block crc 
write, bus error...\n");
   

[PATCH v2 11/29] staging: wilc1000: refactor wilc_wlan_parse_info_frame() function

2018-09-19 Thread Ajay Singh
Return 'void' from wilc_wlan_parse_info_frame() as same constant value
is returned always. Also removed the 'size' from input parameter as its
not used in the function.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wlan_cfg.c | 12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c 
b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index 42c64ed..2b5471b 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -350,22 +350,17 @@ static void wilc_wlan_parse_response_frame(u8 *info, int 
size)
}
 }
 
-static int wilc_wlan_parse_info_frame(u8 *info, int size)
+static void wilc_wlan_parse_info_frame(u8 *info)
 {
struct wilc_mac_cfg *pd = &g_mac;
u32 wid, len;
-   int type = WILC_CFG_RSP_STATUS;
 
wid = info[0] | (info[1] << 8);
 
len = info[2];
 
-   if (len == 1 && wid == WID_STATUS) {
+   if (len == 1 && wid == WID_STATUS)
pd->mac_status = info[3];
-   type = WILC_CFG_RSP_STATUS;
-   }
-
-   return type;
 }
 
 /
@@ -528,7 +523,8 @@ void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 
*frame, int size,
break;
 
case 'I':
-   rsp->type = wilc_wlan_parse_info_frame(frame, size);
+   wilc_wlan_parse_info_frame(frame);
+   rsp->type = WILC_CFG_RSP_STATUS;
rsp->seq_no = msg_id;
/*call host interface info parse as well*/
wilc_gnrl_async_info_received(wilc, frame - 4, size + 4);
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 16/29] staging: wilc1000: refactor code to remove 'mac_status' from 'wilc_mac_cfg' struct

2018-09-19 Thread Ajay Singh
Refactor the code by removing use of 'mac_status' from 'wilc_mac_cfg'
and only have the string type configuration values in 'wilc_mac_cfg'
struct. Now fetch the value 'WID_STATUS' configuration from 'g_cfg_byte'
array.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/linux_wlan.c |  4 ++--
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  2 +-
 drivers/staging/wilc1000/wilc_wlan_cfg.c  | 23 ++-
 3 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index e2669b9..d9f927e 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -159,9 +159,9 @@ static void deinit_irq(struct net_device *dev)
 
 void wilc_mac_indicate(struct wilc *wilc)
 {
-   int status;
+   s8 status;
 
-   wilc_wlan_cfg_get_val(WID_STATUS, (unsigned char *)&status, 4);
+   wilc_wlan_cfg_get_val(WID_STATUS, &status, 1);
if (wilc->mac_status == MAC_STATUS_INIT) {
wilc->mac_status = status;
complete(&wilc->sync_event);
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 30151b2..70bae3a 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -155,7 +155,7 @@ struct wilc_vif {
 struct wilc {
const struct wilc_hif_func *hif_func;
int io_type;
-   int mac_status;
+   s8 mac_status;
struct gpio_desc *gpio_irq;
bool initialized;
int dev_irq_num;
diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c 
b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index 541251b..4434976 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -18,7 +18,6 @@ enum cfg_cmd_type {
 };
 
 struct wilc_mac_cfg {
-   int mac_status;
u8 mac_address[7];
u8 firmware_version[129];
u8 assoc_rsp[256];
@@ -251,15 +250,26 @@ static void wilc_wlan_parse_response_frame(u8 *info, int 
size)
 
 static void wilc_wlan_parse_info_frame(u8 *info)
 {
-   struct wilc_mac_cfg *pd = &g_mac;
u32 wid, len;
 
wid = info[0] | (info[1] << 8);
 
len = info[2];
 
-   if (len == 1 && wid == WID_STATUS)
-   pd->mac_status = info[3];
+   if (len == 1 && wid == WID_STATUS) {
+   int i = 0;
+
+   do {
+   if (g_cfg_byte[i].id == WID_NIL)
+   break;
+
+   if (g_cfg_byte[i].id == wid) {
+   g_cfg_byte[i].val = info[3];
+   break;
+   }
+   i++;
+   } while (1);
+   }
 }
 
 /
@@ -323,11 +333,6 @@ int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 
buffer_size)
u32 type = (wid >> 12) & 0xf;
int i, ret = 0;
 
-   if (wid == WID_STATUS) {
-   *((u32 *)buffer) = g_mac.mac_status;
-   return 4;
-   }
-
i = 0;
if (type == CFG_BYTE_CMD) {
do {
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 21/29] staging: wilc1000: avoid use of 'g_sdio' static variable

2018-09-19 Thread Ajay Singh
Instead of using static variable 'g_sdio' move it as part of 'wilc'
struct. Also allocating the memory in the probe function and free during
deinitialization.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/linux_wlan.c |  1 +
 drivers/staging/wilc1000/wilc_sdio.c  | 54 +--
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  1 +
 3 files changed, 36 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index b666e1e..560c168 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1037,6 +1037,7 @@ void wilc_netdev_cleanup(struct wilc *wilc)
flush_workqueue(wilc->hif_workqueue);
destroy_workqueue(wilc->hif_workqueue);
wilc_wlan_cfg_deinit(wilc);
+   kfree(wilc->bus_data);
kfree(wilc);
 }
 EXPORT_SYMBOL_GPL(wilc_netdev_cleanup);
diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
b/drivers/staging/wilc1000/wilc_sdio.c
index b2080d8..7ef047c 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -30,7 +30,6 @@ struct wilc_sdio {
int has_thrpt_enh3;
 };
 
-static struct wilc_sdio g_sdio;
 static const struct wilc_hif_func wilc_hif_sdio;
 
 static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data);
@@ -109,6 +108,11 @@ static int linux_sdio_probe(struct sdio_func *func,
struct wilc *wilc;
int ret;
struct gpio_desc *gpio = NULL;
+   struct wilc_sdio *sdio_priv;
+
+   sdio_priv = kzalloc(sizeof(*sdio_priv), GFP_KERNEL);
+   if (!sdio_priv)
+   return -ENOMEM;
 
if (IS_ENABLED(CONFIG_WILC1000_HW_OOB_INTR)) {
gpio = gpiod_get(&func->dev, "irq", GPIOD_IN);
@@ -124,9 +128,11 @@ static int linux_sdio_probe(struct sdio_func *func,
ret = wilc_netdev_init(&wilc, &func->dev, HIF_SDIO, &wilc_hif_sdio);
if (ret) {
dev_err(&func->dev, "Couldn't initialize netdev\n");
+   kfree(sdio_priv);
return ret;
}
sdio_set_drvdata(func, wilc);
+   wilc->bus_data = sdio_priv;
wilc->dev = &func->dev;
wilc->gpio_irq = gpio;
 
@@ -381,6 +387,7 @@ static int sdio_set_func1_block_size(struct wilc *wilc, u32 
block_size)
 static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data)
 {
struct sdio_func *func = dev_to_sdio_func(wilc->dev);
+   struct wilc_sdio *sdio_priv = wilc->bus_data;
int ret;
 
cpu_to_le32s(&data);
@@ -415,7 +422,7 @@ static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 
data)
cmd.increment = 1;
cmd.count = 4;
cmd.buffer = (u8 *)&data;
-   cmd.block_size = g_sdio.block_size;
+   cmd.block_size = sdio_priv->block_size;
ret = wilc_sdio_cmd53(wilc, &cmd);
if (ret) {
dev_err(&func->dev,
@@ -434,7 +441,8 @@ static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 
data)
 static int sdio_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size)
 {
struct sdio_func *func = dev_to_sdio_func(wilc->dev);
-   u32 block_size = g_sdio.block_size;
+   struct wilc_sdio *sdio_priv = wilc->bus_data;
+   u32 block_size = sdio_priv->block_size;
struct sdio_cmd53 cmd;
int nblk, nleft, ret;
 
@@ -523,6 +531,7 @@ static int sdio_write(struct wilc *wilc, u32 addr, u8 *buf, 
u32 size)
 static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data)
 {
struct sdio_func *func = dev_to_sdio_func(wilc->dev);
+   struct wilc_sdio *sdio_priv = wilc->bus_data;
int ret;
 
if (addr >= 0xf0 && addr <= 0xff) {
@@ -553,7 +562,7 @@ static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 
*data)
cmd.count = 4;
cmd.buffer = (u8 *)data;
 
-   cmd.block_size = g_sdio.block_size;
+   cmd.block_size = sdio_priv->block_size;
ret = wilc_sdio_cmd53(wilc, &cmd);
if (ret) {
dev_err(&func->dev,
@@ -574,7 +583,8 @@ static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 
*data)
 static int sdio_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size)
 {
struct sdio_func *func = dev_to_sdio_func(wilc->dev);
-   u32 block_size = g_sdio.block_size;
+   struct wilc_sdio *sdio_priv = wilc->bus_data;
+   u32 block_size = sdio_priv->block_size;
struct sdio_cmd53 cmd;
int nblk, nleft, ret;
 
@@ -674,13 +684,14 @@ static int sdio_deinit(struct wilc *wilc)
 static int sdio_init(struct wilc *wilc, bool resume)
 {
struct sdio_func *func = dev_to_sdio_func(wilc->dev);
+   struct wilc_sdio *sdi

[PATCH v2 24/29] staging: wilc1000: remove p2p related static variables to wilc_vif struct

2018-09-19 Thread Ajay Singh
Avoid use of static variable and move them as part of private
data(wilc_priv) struct.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/linux_wlan.c |  2 +
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 60 +++
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  7 +++
 3 files changed, 38 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 560c168..695d5b2 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -729,6 +729,7 @@ static int wilc_mac_open(struct net_device *ndev)
 {
struct wilc_vif *vif = netdev_priv(ndev);
struct wilc *wl = vif->wilc;
+   struct wilc_priv *priv = wdev_priv(vif->ndev->ieee80211_ptr);
unsigned char mac_add[ETH_ALEN] = {0};
int ret = 0;
int i = 0;
@@ -782,6 +783,7 @@ static int wilc_mac_open(struct net_device *ndev)
 vif->frame_reg[1].reg);
netif_wake_queue(ndev);
wl->open_ifcs++;
+   priv->p2p.local_random = 0x01;
vif->mac_opened = 1;
return 0;
 }
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 1a4d262..4fd 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -137,10 +137,7 @@ struct p2p_mgmt_data {
 static u8 wlan_channel = INVALID_CHANNEL;
 static u8 curr_channel;
 static u8 p2p_oui[] = {0x50, 0x6f, 0x9A, 0x09};
-static u8 p2p_local_random = 0x01;
-static u8 p2p_recv_random;
 static u8 p2p_vendor_spec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03};
-static bool wilc_ie;
 
 static struct ieee80211_supported_band wilc_band_2ghz = {
.channels = ieee80211_2ghz_channels,
@@ -515,9 +512,9 @@ static void cfg_connect_result(enum conn_event 
conn_disconn_evt,
GFP_KERNEL);
} else if (conn_disconn_evt == CONN_DISCONN_EVENT_DISCONN_NOTIF) {
vif->obtaining_ip = false;
-   p2p_local_random = 0x01;
-   p2p_recv_random = 0x00;
-   wilc_ie = false;
+   priv->p2p.local_random = 0x01;
+   priv->p2p.recv_random = 0x00;
+   priv->p2p.is_wilc_ie = false;
eth_zero_addr(priv->associated_bss);
wilc_wlan_set_bssid(priv->dev, null_bssid, STATION_MODE);
 
@@ -829,9 +826,9 @@ static int disconnect(struct wiphy *wiphy, struct 
net_device *dev,
wlan_channel = INVALID_CHANNEL;
wilc_wlan_set_bssid(priv->dev, null_bssid, STATION_MODE);
 
-   p2p_local_random = 0x01;
-   p2p_recv_random = 0x00;
-   wilc_ie = false;
+   priv->p2p.local_random = 0x01;
+   priv->p2p.recv_random = 0x00;
+   priv->p2p.is_wilc_ie = false;
wfi_drv->p2p_timeout = 0;
 
ret = wilc_disconnect(vif, reason_code);
@@ -1330,20 +1327,21 @@ static void wilc_wfi_cfg_parse_rx_vendor_spec(struct 
wilc_priv *priv, u8 *buff,
struct wilc_vif *vif = netdev_priv(priv->dev);
 
subtype = buff[P2P_PUB_ACTION_SUBTYPE];
-   if ((subtype == GO_NEG_REQ || subtype == GO_NEG_RSP) && !wilc_ie) {
+   if ((subtype == GO_NEG_REQ || subtype == GO_NEG_RSP) &&
+   !priv->p2p.is_wilc_ie) {
for (i = P2P_PUB_ACTION_SUBTYPE; i < size; i++) {
if (!memcmp(p2p_vendor_spec, &buff[i], 6)) {
-   p2p_recv_random = buff[i + 6];
-   wilc_ie = true;
+   priv->p2p.recv_random = buff[i + 6];
+   priv->p2p.is_wilc_ie = true;
break;
}
}
}
 
-   if (p2p_local_random <= p2p_recv_random) {
+   if (priv->p2p.local_random <= priv->p2p.recv_random) {
netdev_dbg(vif->ndev,
   "PEER WILL BE GO LocaRand=%02x RecvRand %02x\n",
-  p2p_local_random, p2p_recv_random);
+  priv->p2p.local_random, priv->p2p.recv_random);
return;
}
 
@@ -1411,7 +1409,7 @@ void wilc_wfi_p2p_rx(struct net_device *dev, u8 *buff, 
u32 size)
  size);
 
if ((subtype == GO_NEG_REQ || subtype == GO_NEG_RSP) &&
-   wilc_ie)
+   priv->p2p.is_wilc_ie)
size -= 7;
 
break;
@@ -1503,7 +1501,8 @@ static int cancel_remain_on_channel(struct wiphy *wiphy,
priv->remain_on_ch_params.listen_session_id);
 }
 
-static void wilc_wfi_cfg_tx_vendor_spec(struct p

[PATCH v2 15/29] staging: wilc1000: remove unused wid from cfg struct

2018-09-19 Thread Ajay Singh
Cleanup patch to remove the unused element stored in cfg struct.
Removed those wid from the cfg variables whose value is not
fetched(GET_CFG) from the code. In case the wid is only set to the
firmware then there is need to store them as part of cfg variables, so
removed the unused code.

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

diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c 
b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index 2c463a3..541251b 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -20,131 +20,36 @@ enum cfg_cmd_type {
 struct wilc_mac_cfg {
int mac_status;
u8 mac_address[7];
-   u8 ip_address[5];
-   u8 bssid[7];
-   u8 ssid[34];
u8 firmware_version[129];
-   u8 supp_rate[24];
-   u8 wep_key[28];
-   u8 i_psk[66];
-   u8 hw_product_version[33];
-   u8 phyversion[17];
-   u8 supp_username[21];
-   u8 supp_password[64];
-   u8 assoc_req[256];
u8 assoc_rsp[256];
-   u8 firmware_info[8];
-   u8 scan_result[256];
-   u8 scan_result1[256];
 };
 
 static struct wilc_mac_cfg g_mac;
 
 static struct wilc_cfg_byte g_cfg_byte[] = {
-   {WID_BSS_TYPE, 0},
-   {WID_CURRENT_TX_RATE, 0},
-   {WID_CURRENT_CHANNEL, 0},
-   {WID_PREAMBLE, 0},
-   {WID_11G_OPERATING_MODE, 0},
{WID_STATUS, 0},
-   {WID_SCAN_TYPE, 0},
-   {WID_KEY_ID, 0},
-   {WID_QOS_ENABLE, 0},
-   {WID_POWER_MANAGEMENT, 0},
-   {WID_11I_MODE, 0},
-   {WID_AUTH_TYPE, 0},
-   {WID_SITE_SURVEY, 0},
-   {WID_LISTEN_INTERVAL, 0},
-   {WID_DTIM_PERIOD, 0},
-   {WID_ACK_POLICY, 0},
-   {WID_BCAST_SSID, 0},
-   {WID_REKEY_POLICY, 0},
-   {WID_SHORT_SLOT_ALLOWED, 0},
-   {WID_START_SCAN_REQ, 0},
{WID_RSSI, 0},
{WID_LINKSPEED, 0},
-   {WID_AUTO_RX_SENSITIVITY, 0},
-   {WID_DATAFLOW_CONTROL, 0},
-   {WID_SCAN_FILTER, 0},
-   {WID_11N_PROT_MECH, 0},
-   {WID_11N_ERP_PROT_TYPE, 0},
-   {WID_11N_ENABLE, 0},
-   {WID_11N_OPERATING_MODE, 0},
-   {WID_11N_OBSS_NONHT_DETECTION, 0},
-   {WID_11N_HT_PROT_TYPE, 0},
-   {WID_11N_RIFS_PROT_ENABLE, 0},
-   {WID_11N_SMPS_MODE, 0},
-   {WID_11N_CURRENT_TX_MCS, 0},
-   {WID_11N_SHORT_GI_ENABLE, 0},
-   {WID_RIFS_MODE, 0},
-   {WID_TX_ABORT_CONFIG, 0},
-   {WID_11N_IMMEDIATE_BA_ENABLED, 0},
-   {WID_11N_TXOP_PROT_DISABLE, 0},
{WID_NIL, 0}
 };
 
 static struct wilc_cfg_hword g_cfg_hword[] = {
-   {WID_LINK_LOSS_THRESHOLD, 0},
-   {WID_RTS_THRESHOLD, 0},
-   {WID_FRAG_THRESHOLD, 0},
-   {WID_SHORT_RETRY_LIMIT, 0},
-   {WID_LONG_RETRY_LIMIT, 0},
-   {WID_BEACON_INTERVAL, 0},
-   {WID_RX_SENSE, 0},
-   {WID_ACTIVE_SCAN_TIME, 0},
-   {WID_PASSIVE_SCAN_TIME, 0},
-   {WID_SITE_SURVEY_SCAN_TIME, 0},
-   {WID_JOIN_START_TIMEOUT, 0},
-   {WID_AUTH_TIMEOUT, 0},
-   {WID_ASOC_TIMEOUT, 0},
-   {WID_11I_PROTOCOL_TIMEOUT, 0},
-   {WID_EAPOL_RESPONSE_TIMEOUT, 0},
-   {WID_11N_SIG_QUAL_VAL, 0},
-   {WID_CCA_THRESHOLD, 0},
{WID_NIL, 0}
 };
 
 static struct wilc_cfg_word g_cfg_word[] = {
{WID_FAILED_COUNT, 0},
-   {WID_RETRY_COUNT, 0},
-   {WID_MULTIPLE_RETRY_COUNT, 0},
-   {WID_FRAME_DUPLICATE_COUNT, 0},
-   {WID_ACK_FAILURE_COUNT, 0},
{WID_RECEIVED_FRAGMENT_COUNT, 0},
-   {WID_MCAST_RECEIVED_FRAME_COUNT, 0},
-   {WID_FCS_ERROR_COUNT, 0},
{WID_SUCCESS_FRAME_COUNT, 0},
-   {WID_TX_FRAGMENT_COUNT, 0},
-   {WID_TX_MULTICAST_FRAME_COUNT, 0},
-   {WID_RTS_SUCCESS_COUNT, 0},
-   {WID_RTS_FAILURE_COUNT, 0},
-   {WID_WEP_UNDECRYPTABLE_COUNT, 0},
-   {WID_REKEY_PERIOD, 0},
-   {WID_REKEY_PACKET_COUNT, 0},
-   {WID_HW_RX_COUNT, 0},
{WID_GET_INACTIVE_TIME, 0},
{WID_NIL, 0}
 
 };
 
 static struct wilc_cfg_str g_cfg_str[] = {
-   {WID_SSID, g_mac.ssid}, /* 33 + 1 bytes */
{WID_FIRMWARE_VERSION, g_mac.firmware_version},
-   {WID_OPERATIONAL_RATE_SET, g_mac.supp_rate},
-   {WID_BSSID, g_mac.bssid},   /* 6 bytes */
-   {WID_WEP_KEY_VALUE, g_mac.wep_key}, /* 27 bytes */
-   {WID_11I_PSK, g_mac.i_psk}, /* 65 bytes */
-   {WID_HARDWARE_VERSION, g_mac.hw_product_version},
{WID_MAC_ADDR, g_mac.mac_address},
-   {WID_PHY_VERSION, g_mac.phyversion},
-   {WID_SUPP_USERNAME, g_mac.supp_username},
-   {WID_SUPP_PASSWORD, g_mac.supp_password},
-   {WID_SITE_SURVEY_RESULTS, g_mac.scan_result},
-   {WID_SITE_SURVEY_RESULTS, g_mac.scan_result1},
-   {WID_ASSOC_REQ_INFO, g_mac.assoc_req},
{WID_ASSOC_RES_INFO, g_mac.assoc_rsp},
-   {WID_FIRMWARE_INFO, g_mac.firmware_version},
-   {WID_IP_ADDRESS, g_mac.ip_address},
{WID_NIL, NULL}
 };
 
@@ -327,12 +232,6 @@ static void

[PATCH v2 18/29] staging: wilc1000: rename 'wilc_mac_cfg' struct to 'wilc_cfg_str_vals'

2018-09-19 Thread Ajay Singh
Rename 'wilc_mac_cfg' struct to 'wilc_cfg_str_vals' as its more
appropriate for structure to store the values of string configuration.

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

diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c 
b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index 8f1e962..930a389 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -438,7 +438,7 @@ void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 
*frame, int size,
 
 int wilc_wlan_cfg_init(struct wilc *wl)
 {
-   struct wilc_mac_cfg *mac_cfg;
+   struct wilc_cfg_str_vals *str_vals;
int i = 0;
 
wl->cfg.b = kmemdup(g_cfg_byte, sizeof(g_cfg_byte), GFP_KERNEL);
@@ -457,20 +457,20 @@ int wilc_wlan_cfg_init(struct wilc *wl)
if (!wl->cfg.s)
goto out_w;
 
-   mac_cfg = kzalloc(sizeof(mac_cfg), GFP_KERNEL);
-   if (!mac_cfg)
+   str_vals = kzalloc(sizeof(str_vals), GFP_KERNEL);
+   if (!str_vals)
goto out_s;
 
-   wl->cfg.str_vals = mac_cfg;
+   wl->cfg.str_vals = str_vals;
/* store the string cfg parameters */
wl->cfg.s[i].id = WID_FIRMWARE_VERSION;
-   wl->cfg.s[i].str = mac_cfg->firmware_version;
+   wl->cfg.s[i].str = str_vals->firmware_version;
i++;
wl->cfg.s[i].id = WID_MAC_ADDR;
-   wl->cfg.s[i].str = mac_cfg->mac_address;
+   wl->cfg.s[i].str = str_vals->mac_address;
i++;
wl->cfg.s[i].id = WID_ASSOC_RES_INFO;
-   wl->cfg.s[i].str = mac_cfg->assoc_rsp;
+   wl->cfg.s[i].str = str_vals->assoc_rsp;
i++;
wl->cfg.s[i].id = WID_NIL;
wl->cfg.s[i].str = NULL;
diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.h 
b/drivers/staging/wilc1000/wilc_wlan_cfg.h
index 176eef1..e5ca6ce 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.h
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.h
@@ -27,7 +27,7 @@ struct wilc_cfg_str {
u8 *str;
 };
 
-struct wilc_mac_cfg {
+struct wilc_cfg_str_vals {
u8 mac_address[7];
u8 firmware_version[129];
u8 assoc_rsp[256];
@@ -38,7 +38,7 @@ struct wilc_cfg {
struct wilc_cfg_hword *hw;
struct wilc_cfg_word *w;
struct wilc_cfg_str *s;
-   struct wilc_mac_cfg *str_vals;
+   struct wilc_cfg_str_vals *str_vals;
 };
 
 struct wilc;
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 09/29] staging: wilc1000: use 'void' return for wilc_wlan_txq_filter_dup_tcp_ack()

2018-09-19 Thread Ajay Singh
Use 'void' return for wilc_wlan_txq_filter_dup_tcp_ack() as it always
return value '1' and its not used by the caller.

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

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 66ce29d..88808d9 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -182,7 +182,7 @@ static inline void tcp_process(struct net_device *dev, 
struct txq_entry_t *tqe)
spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
 }
 
-static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev)
+static void wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev)
 {
struct wilc_vif *vif = netdev_priv(dev);
struct wilc *wilc = vif->wilc;
@@ -237,8 +237,6 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct 
net_device *dev)
msecs_to_jiffies(1));
dropped--;
}
-
-   return 1;
 }
 
 void wilc_enable_tcp_ack_filter(struct wilc_vif *vif, bool value)
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 12/29] staging: wilc1000: set default value of cfg response type in wilc_wlan_cfg_indicate_rx()

2018-09-19 Thread Ajay Singh
Handle the setting of default value for 'wilc_cfg_rsp' type for all
cases in wilc_wlan_cfg_indicate_rx() as the caller make use of this
value to know the type of the received message.

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

diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c 
b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index 2b5471b..2c463a3 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -507,6 +507,7 @@ void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 
*frame, int size,
msg_id = frame[1];  /* seq no */
frame += 4;
size -= 4;
+   rsp->type = 0;
 
/*
 * The valid types of response messages are
@@ -532,7 +533,6 @@ void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 
*frame, int size,
 
case 'N':
wilc_network_info_received(wilc, frame - 4, size + 4);
-   rsp->type = 0;
break;
 
case 'S':
@@ -540,7 +540,6 @@ void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 
*frame, int size,
break;
 
default:
-   rsp->type = 0;
rsp->seq_no = msg_id;
break;
}
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 20/29] staging: wilc1000: remove use of unnecessary 'wilc_connected_ssid' variable

2018-09-19 Thread Ajay Singh
'wilc_connected_ssid' actually used to store the BSSID information for
connected BSSID. 'wilc_vif' already has 'bssid' variable to store the
same information. So refactor code to remove 'wilc_connected_ssid' and
instead used 'wilc_vif' struct 'bssid' element.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 529390d..01db899 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -813,7 +813,6 @@ static void handle_scan(struct work_struct *work)
kfree(msg);
 }
 
-u8 wilc_connected_ssid[6] = {0};
 static void handle_connect(struct work_struct *work)
 {
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
@@ -835,11 +834,6 @@ static void handle_connect(struct work_struct *work)
return;
}
 
-   if (memcmp(conn_attr->bssid, wilc_connected_ssid, ETH_ALEN) == 0) {
-   netdev_err(vif->ndev, "Discard connect request\n");
-   goto error;
-   }
-
bss_param = conn_attr->params;
if (!bss_param) {
netdev_err(vif->ndev, "Required BSSID not found\n");
@@ -1019,10 +1013,6 @@ static void handle_connect(struct work_struct *work)
cur_byte = wid_list[wid_cnt].val;
wid_cnt++;
 
-   if (conn_attr->bssid)
-   memcpy(wilc_connected_ssid,
-  conn_attr->bssid, ETH_ALEN);
-
result = wilc_send_config_pkt(vif, SET_CFG, wid_list,
  wid_cnt,
  wilc_get_vif_idx(vif));
@@ -1145,8 +1135,6 @@ static void handle_connect_timeout(struct work_struct 
*work)
kfree(hif_drv->usr_conn_req.ies);
hif_drv->usr_conn_req.ies = NULL;
 
-   eth_zero_addr(wilc_connected_ssid);
-
 out:
kfree(msg);
 }
@@ -1452,16 +1440,6 @@ 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, 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");
-   eth_zero_addr(wilc_connected_ssid);
-   }
-
if (hif_drv->usr_conn_req.bssid) {
memcpy(conn_info.bssid, hif_drv->usr_conn_req.bssid, 6);
 
@@ -1874,8 +1852,6 @@ static void handle_disconnect(struct work_struct *work)
vif->obtaining_ip = false;
wilc_set_power_mgmt(vif, 0, 0);
 
-   eth_zero_addr(wilc_connected_ssid);
-
result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
  wilc_get_vif_idx(vif));
 
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 4416f8f..33fb731 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -359,6 +359,4 @@ int wilc_get_vif_idx(struct wilc_vif *vif);
 int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power);
 int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power);
 
-extern u8 wilc_connected_ssid[6];
-
 #endif
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 76d017d..1a4d262 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -478,7 +478,6 @@ static void cfg_connect_result(enum conn_event 
conn_disconn_evt,
connect_status = WLAN_STATUS_UNSPECIFIED_FAILURE;
wilc_wlan_set_bssid(priv->dev, null_bssid,
STATION_MODE);
-   eth_zero_addr(wilc_connected_ssid);
 
if (!wfi_drv->p2p_connect)
wlan_channel = INVALID_CHANNEL;
@@ -521,7 +520,6 @@ static void cfg_connect_result(enum conn_event 
conn_disconn_evt,
wilc_ie = false;
eth_zero_addr(priv->associated_bss);
wilc_wlan_set_bssid(priv->dev, null_bssid, STATION_MODE);
-   eth_zero_addr(wilc_connected_ssid);
 
if (!wfi_drv->p2p_connect)
wlan_channel = INVALID_CHANNE

[PATCH v2 19/29] staging: wilc1000: avoid the use of 'hif_driver_comp' completion variable

2018-09-19 Thread Ajay Singh
Instead of using extra completion variable to handle the sync call now
using msg->is_sync flag to handle the sync call.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 237a098d..529390d 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -187,7 +187,6 @@ struct join_bss_param {
 };
 
 static struct host_if_drv *terminated_handle;
-static struct completion hif_driver_comp;
 static struct mutex hif_deinit_lock;
 
 /* 'msg' should be free by the caller for syc */
@@ -310,10 +309,12 @@ static void handle_set_wfi_drv_handler(struct work_struct 
*work)
if (ret)
netdev_err(vif->ndev, "Failed to set driver handler\n");
 
-   complete(&hif_driver_comp);
kfree(buffer);
 
 free_msg:
+   if (msg->is_sync)
+   complete(&msg->work_comp);
+
kfree(msg);
 }
 
@@ -333,9 +334,6 @@ static void handle_set_operation_mode(struct work_struct 
*work)
ret = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
   wilc_get_vif_idx(vif));
 
-   if (hif_op_mode->mode == IDLE_MODE)
-   complete(&hif_driver_comp);
-
if (ret)
netdev_err(vif->ndev, "Failed to set operation mode\n");
 
@@ -3118,12 +3116,12 @@ int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 
channel)
 }
 
 int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode,
-u8 ifc_id)
+u8 ifc_id, bool is_sync)
 {
int result;
struct host_if_msg *msg;
 
-   msg = wilc_alloc_work(vif, handle_set_wfi_drv_handler, false);
+   msg = wilc_alloc_work(vif, handle_set_wfi_drv_handler, is_sync);
if (IS_ERR(msg))
return PTR_ERR(msg);
 
@@ -3135,8 +3133,12 @@ int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int 
index, u8 mode,
if (result) {
netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
kfree(msg);
+   return result;
}
 
+   if (is_sync)
+   wait_for_completion(&msg->work_comp);
+
return result;
 }
 
@@ -3380,10 +3382,8 @@ int wilc_init(struct net_device *dev, struct host_if_drv 
**hif_drv_handler)
 
vif->obtaining_ip = false;
 
-   if (wilc->clients_count == 0) {
-   init_completion(&hif_driver_comp);
+   if (wilc->clients_count == 0)
mutex_init(&hif_deinit_lock);
-   }
 
timer_setup(&vif->periodic_rssi, get_periodic_rssi, 0);
mod_timer(&vif->periodic_rssi, jiffies + msecs_to_jiffies(5000));
@@ -3430,8 +3430,7 @@ int wilc_deinit(struct wilc_vif *vif)
del_timer_sync(&vif->periodic_rssi);
del_timer_sync(&hif_drv->remain_on_ch_timer);
 
-   wilc_set_wfi_drv_handler(vif, 0, 0, 0);
-   wait_for_completion(&hif_driver_comp);
+   wilc_set_wfi_drv_handler(vif, 0, 0, 0, true);
 
if (hif_drv->usr_scan_req.scan_result) {
hif_drv->usr_scan_req.scan_result(SCAN_EVENT_ABORTED, NULL,
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 15ffaeb..4416f8f 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -350,7 +350,7 @@ int wilc_remain_on_channel(struct wilc_vif *vif, u32 
session_id,
 int wilc_listen_state_expired(struct wilc_vif *vif, u32 session_id);
 void wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg);
 int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode,
-u8 ifc_id);
+u8 ifc_id, bool is_sync);
 int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode);
 int wilc_get_statistics(struct wilc_vif *vif, struct rf_info *stats,
bool is_sync);
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 8ecd664..b666e1e 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -753,7 +753,8 @@ static int wilc_mac_open(struct net_device *ndev)
for (i = 0; i < wl->vif_num; i++) {
if (ndev == wl->vif[i]->ndev) {
wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif),
-vif->iftype, vif->ifc_id);
+vif->iftype, vif-&g

[PATCH v2 23/29] staging: wilc1000: remove unnecessary memset in sdio_init() & wilc_spi_init()

2018-09-19 Thread Ajay Singh
Cleanup changes to avoid unnecessary setting 'wilc->bus_data' value to
zero as the buffer was allocated using kzalloc().

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_sdio.c | 4 +---
 drivers/staging/wilc1000/wilc_spi.c  | 3 ---
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
b/drivers/staging/wilc1000/wilc_sdio.c
index 7ef047c..ca351c9 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -689,10 +689,8 @@ static int sdio_init(struct wilc *wilc, bool resume)
int loop, ret;
u32 chipid;
 
-   if (!resume) {
-   memset(sdio_priv, 0, sizeof(struct wilc_sdio));
+   if (!resume)
sdio_priv->irq_gpio = wilc->dev_irq_num;
-   }
 
/**
 *  function 0 csa enable
diff --git a/drivers/staging/wilc1000/wilc_spi.c 
b/drivers/staging/wilc1000/wilc_spi.c
index 2559cf0..cef127b 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -838,12 +838,9 @@ static int wilc_spi_init(struct wilc *wilc, bool resume)
return 1;
}
 
-   memset(spi_priv, 0, sizeof(struct wilc_spi));
-
/*
 * configure protocol
 */
-   spi_priv->crc_off = 0;
 
/*
 * TODO: We can remove the CRC trials if there is a definite
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 26/29] staging: wilc1000: remove unnecessary option used with ccflags-y in Makefile

2018-09-19 Thread Ajay Singh
Cleanup patch to remove -I(src) and -DWILC_ASIC_A0 option used in
ccflag-y in Makefile.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/Makefile | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/wilc1000/Makefile 
b/drivers/staging/wilc1000/Makefile
index 5718bc4..37e8560 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -4,8 +4,6 @@ obj-$(CONFIG_WILC1000) += wilc1000.o
 ccflags-y += -DFIRMWARE_1002=\"atmel/wilc1002_firmware.bin\" \
-DFIRMWARE_1003=\"atmel/wilc1003_firmware.bin\"
 
-ccflags-y += -I$(src)/ -DWILC_ASIC_A0
-
 wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \
coreconfigurator.o host_interface.o \
wilc_wlan_cfg.o wilc_wlan.o
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 28/29] staging: wilc1000: avoid spaces preferred around checkpatch issue

2018-09-19 Thread Ajay Singh
Cleanup patch to add extra spaces around the '/' to avoid the below
checkpatch warning.

'spaces preferred around that '/' (ctx:VxV)'

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

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 695d5b2..29c1317 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -823,7 +823,7 @@ static void wilc_set_multicast_list(struct net_device *dev)
 
netdev_for_each_mc_addr(ha, dev) {
memcpy(mc_list + i, ha->addr, ETH_ALEN);
-   netdev_dbg(dev, "Entry[%d]: %x:%x:%x:%x:%x:%x\n", i/ETH_ALEN,
+   netdev_dbg(dev, "Entry[%d]: %x:%x:%x:%x:%x:%x\n", i / ETH_ALEN,
   mc_list[i], mc_list[i + 1], mc_list[i + 2],
   mc_list[i + 3], mc_list[i + 4], mc_list[i + 5]);
i += ETH_ALEN;
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 25/29] staging: wilc1000: remove wilc_debugfs.c file as its not used

2018-09-19 Thread Ajay Singh
Deleted wilc_debugfs.c file as it's not used.

Earlier discussion link:
[1]. https://www.spinics.net/lists/linux-wireless/msg176076.html

Suggested-by: Greg KH 
Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/Makefile   |   5 +-
 drivers/staging/wilc1000/wilc_debugfs.c | 115 
 2 files changed, 2 insertions(+), 118 deletions(-)
 delete mode 100644 drivers/staging/wilc1000/wilc_debugfs.c

diff --git a/drivers/staging/wilc1000/Makefile 
b/drivers/staging/wilc1000/Makefile
index ee7e26b..5718bc4 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -4,12 +4,11 @@ obj-$(CONFIG_WILC1000) += wilc1000.o
 ccflags-y += -DFIRMWARE_1002=\"atmel/wilc1002_firmware.bin\" \
-DFIRMWARE_1003=\"atmel/wilc1003_firmware.bin\"
 
-ccflags-y += -I$(src)/ -DWILC_ASIC_A0 -DWILC_DEBUGFS
+ccflags-y += -I$(src)/ -DWILC_ASIC_A0
 
 wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \
coreconfigurator.o host_interface.o \
-   wilc_wlan_cfg.o wilc_debugfs.o \
-   wilc_wlan.o
+   wilc_wlan_cfg.o wilc_wlan.o
 
 obj-$(CONFIG_WILC1000_SDIO) += wilc1000-sdio.o
 wilc1000-sdio-objs += wilc_sdio.o
diff --git a/drivers/staging/wilc1000/wilc_debugfs.c 
b/drivers/staging/wilc1000/wilc_debugfs.c
deleted file mode 100644
index 8001df6..000
--- a/drivers/staging/wilc1000/wilc_debugfs.c
+++ /dev/null
@@ -1,115 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries.
- * All rights reserved.
- */
-
-#if defined(WILC_DEBUGFS)
-#include 
-#include 
-
-#include "wilc_wlan_if.h"
-
-static struct dentry *wilc_dir;
-
-#define DEBUG   BIT(0)
-#define INFOBIT(1)
-#define WRN BIT(2)
-#define ERR BIT(3)
-
-#define DBG_LEVEL_ALL  (DEBUG | INFO | WRN | ERR)
-static atomic_t WILC_DEBUG_LEVEL = ATOMIC_INIT(ERR);
-EXPORT_SYMBOL_GPL(WILC_DEBUG_LEVEL);
-
-static ssize_t wilc_debug_level_read(struct file *file, char __user *userbuf,
-size_t count, loff_t *ppos)
-{
-   char buf[128];
-   int res = 0;
-
-   /* only allow read from start */
-   if (*ppos > 0)
-   return 0;
-
-   res = scnprintf(buf, sizeof(buf), "Debug Level: %x\n",
-   atomic_read(&WILC_DEBUG_LEVEL));
-
-   return simple_read_from_buffer(userbuf, count, ppos, buf, res);
-}
-
-static ssize_t wilc_debug_level_write(struct file *filp,
- const char __user *buf, size_t count,
- loff_t *ppos)
-{
-   int flag = 0;
-   int ret;
-
-   ret = kstrtouint_from_user(buf, count, 16, &flag);
-   if (ret)
-   return ret;
-
-   if (flag > DBG_LEVEL_ALL) {
-   pr_info("%s, value (0x%08x) is out of range, stay previous flag 
(0x%08x)\n",
-   __func__, flag, atomic_read(&WILC_DEBUG_LEVEL));
-   return -EINVAL;
-   }
-
-   atomic_set(&WILC_DEBUG_LEVEL, (int)flag);
-
-   if (flag == 0)
-   pr_info("Debug-level disabled\n");
-   else
-   pr_info("Debug-level enabled\n");
-
-   return count;
-}
-
-#define FOPS(_open, _read, _write, _poll) { \
-   .owner  = THIS_MODULE, \
-   .open   = (_open), \
-   .read   = (_read), \
-   .write  = (_write), \
-   .poll   = (_poll), \
-}
-
-struct wilc_debugfs_info_t {
-   const char *name;
-   int perm;
-   unsigned int data;
-   const struct file_operations fops;
-};
-
-static struct wilc_debugfs_info_t debugfs_info[] = {
-   {
-   "wilc_debug_level",
-   0666,
-   (DEBUG | ERR),
-   FOPS(NULL, wilc_debug_level_read, wilc_debug_level_write, NULL),
-   },
-};
-
-static int __init wilc_debugfs_init(void)
-{
-   int i;
-   struct wilc_debugfs_info_t *info;
-
-   wilc_dir = debugfs_create_dir("wilc_wifi", NULL);
-   for (i = 0; i < ARRAY_SIZE(debugfs_info); i++) {
-   info = &debugfs_info[i];
-   debugfs_create_file(info->name,
-   info->perm,
-   wilc_dir,
-   &info->data,
-   &info->fops);
-   }
-   return 0;
-}
-module_init(wilc_debugfs_init);
-
-static void __exit wilc_debugfs_remove(void)
-{
-   debugfs_remove_recursive(wilc_dir);
-}
-module_exit(wilc_debugfs_remove);
-
-#endif
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 29/29] staging: wilc1000: return exact error of register_netdev() from wilc_netdev_init()

2018-09-19 Thread Ajay Singh
Refactor wilc_netdev_init() to return the error code received from
register_netdev() during the failure condition.

Earlier discussion link
[1]. https://www.spinics.net/lists/linux-wireless/msg177304.html

Suggested-by: Claudiu Beznea 
Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/linux_wlan.c | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 29c1317..b5e6765 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1065,7 +1065,8 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
if (!wl)
return -ENOMEM;
 
-   if (wilc_wlan_cfg_init(wl))
+   ret = wilc_wlan_cfg_init(wl);
+   if (ret)
goto free_wl;
 
*wilc = wl;
@@ -1077,8 +1078,10 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
INIT_LIST_HEAD(&wl->rxq_head.list);
 
wl->hif_workqueue = create_singlethread_workqueue("WILC_wq");
-   if (!wl->hif_workqueue)
+   if (!wl->hif_workqueue) {
+   ret = -ENOMEM;
goto free_cfg;
+   }
 
register_inetaddr_notifier(&g_dev_notifier);
 
@@ -1086,8 +1089,10 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
struct wireless_dev *wdev;
 
ndev = alloc_etherdev(sizeof(struct wilc_vif));
-   if (!ndev)
+   if (!ndev) {
+   ret = -ENOMEM;
goto free_ndev;
+   }
 
vif = netdev_priv(ndev);
memset(vif, 0, sizeof(struct wilc_vif));
@@ -1110,6 +1115,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
wdev = wilc_create_wiphy(ndev, dev);
if (!wdev) {
netdev_err(ndev, "Can't register WILC Wiphy\n");
+   ret = -ENOMEM;
goto free_ndev;
}
 
@@ -1151,7 +1157,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
wilc_wlan_cfg_deinit(wl);
 free_wl:
kfree(wl);
-   return -ENOMEM;
+   return ret;
 }
 EXPORT_SYMBOL_GPL(wilc_netdev_init);
 
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 27/29] staging: wilc1000: use usleep_range() in place of udelay()

2018-09-19 Thread Ajay Singh
Changes to avoid the below checkpatch warning:

'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 0ec0d9b..a48c906 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -412,7 +412,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, 400);
wilc->hif_func->hif_read_reg(wilc, 0xf0, ®);
do {
wilc->hif_func->hif_write_reg(wilc, 0xf0,
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 28/29] staging: wilc1000: avoid spaces preferred around checkpatch issue

2018-09-20 Thread Ajay Singh
On Thu, 20 Sep 2018 02:57:21 -0700
Joe Perches  wrote:

> On Thu, 2018-09-20 at 11:53 +0530, Ajay Singh wrote:
> > Cleanup patch to add extra spaces around the '/' to avoid the below
> > checkpatch warning.
> > 
> > 'spaces preferred around that '/' (ctx:VxV)'
> > 
> > Signed-off-by: Ajay Singh 
> > ---
> >  drivers/staging/wilc1000/linux_wlan.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/staging/wilc1000/linux_wlan.c
> > b/drivers/staging/wilc1000/linux_wlan.c index 695d5b2..29c1317
> > 100644 --- a/drivers/staging/wilc1000/linux_wlan.c
> > +++ b/drivers/staging/wilc1000/linux_wlan.c
> > @@ -823,7 +823,7 @@ static void wilc_set_multicast_list(struct
> > net_device *dev) 
> > netdev_for_each_mc_addr(ha, dev) {
> > memcpy(mc_list + i, ha->addr, ETH_ALEN);
> > -   netdev_dbg(dev, "Entry[%d]: %x:%x:%x:%x:%x:%x\n",
> > i/ETH_ALEN,
> > +   netdev_dbg(dev, "Entry[%d]: %x:%x:%x:%x:%x:%x\n",
> > i / ETH_ALEN, mc_list[i], mc_list[i + 1], mc_list[i + 2],
> >mc_list[i + 3], mc_list[i + 4],
> > mc_list[i + 5]); i += ETH_ALEN;  
> 
> Probably better using the vsprintf %pM extension:
> 
>   netdev_dbg(dev, Entry[%d]: %pM\n", i / ETH_ALEN, mc_list + i);
> 
> though I would also suggest using another temporary
> pointer instead of an offset and divisions.
> 
> Something like:
> 
> o use kmalloc_array
> o remove unnecessary res
> o add u8 *cur_mc
> o use i as index

Hi Joe,

Thanks for your suggestion and sharing the code changes.
I agree, it looks better with your modification.


Do I need to resend the updated patch series by including your
changes or can this patch be applied from your mail ?

Regards,
Ajay
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: wilc1000: Remove unnecessary pointer check

2018-09-20 Thread Ajay Singh
Reviewed-by: Ajay Singh 

On Thu, 20 Sep 2018 22:39:11 -0700
Nathan Chancellor  wrote:

> On Fri, Sep 21, 2018 at 01:25:32AM -0400, valdis.kletni...@vt.edu
> wrote:
> > On Thu, 20 Sep 2018 14:26:49 -0700, Nathan Chancellor said:  
> > > Clang warns that the address of a pointer will always evaluated
> > > as true in a boolean context:
> > >
> > > drivers/staging/wilc1000/linux_wlan.c:267:20: warning: address of
> > > 'vif->ndev->dev' will always evaluate to 'true'
> > > [-Wpointer-bool-conversion]
> > > if (!(&vif->ndev->dev))
> > > ~  ~~~^~~
> > > 1 warning generated.
> > >
> > > Since this statement always evaluates to false due to the logical
> > > not, remove it.  
> > 
> > Often, "just nuke it because it's now dead code" isn't the best
> > answer...
> > 
> > At one time, that was likely intended to be checking whether ->dev
> > was a null pointer, to make sure we don't pass request_firmware() a
> > null pointer and oops the kernel, or other things that go
> > pear-shaped
> > 
> > So the question becomes:   Is it safe to just remove it, or was it
> > intended to test for something that could  legitimately be null if
> > we've hit an error along the way (which means we should fix the
> > condition to be proper and acceptable to both gcc and clang)?
> > 
> >   
> 
> I certainly considered whether or not removing the check versus fixing
> it was the correct answer. Given that this check can be traced back to
> the initial check in of the driver in 2015, I figured it was safe to
> remove it (since a null pointer dereference would most likely have
> been noticed by now).
> 
> Most patches addressing this warning just remove the check given that
> it's not actually changing the code, such as commit a7dc662c6a7b
> ("ASoC: codecs: PCM1789: unconditionally flush work"). However, if
> the driver authors and/or maintainers think that this check should be
> something else (maybe checking that the contents of dev is not null
> versus the address, I'm perfectly happy to submit a v2 with this
> change.
> 

The 'if' condition was intended to check the validity of net_device
structure, but i think its not required here.
The device pointer used in request_firmware(), was received in
the probe functions and different from the one checked in 'if'
condition.

Thus its safe to remove the 'if (!(&vif->ndev->dev))' condition
block.
  

Regards,
Ajay
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 06/29] staging: wilc1000: use 'void' return type for host_int_get_assoc_res_info()

2018-09-24 Thread Ajay Singh
Change return type to 'void' for host_int_get_assoc_res_info() as its
return value is not used. 'rcvd_assoc_resp_info_len' parameter value is
used to know the status.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 7729f83..237a098d 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1388,10 +1388,10 @@ static void handle_rcvd_ntwrk_info(struct work_struct 
*work)
kfree(msg);
 }
 
-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)
+static void 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)
 {
int result;
struct wid wid;
@@ -1406,11 +1406,10 @@ static s32 host_int_get_assoc_res_info(struct wilc_vif 
*vif,
if (result) {
*rcvd_assoc_resp_info_len = 0;
netdev_err(vif->ndev, "Failed to send association response\n");
-   return -EINVAL;
+   return;
}
 
*rcvd_assoc_resp_info_len = wid.size;
-   return result;
 }
 
 static inline void host_int_free_user_conn_req(struct host_if_drv *hif_drv)
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 00/29] staging: wilc1000: avoid static variables and cleanup changes

2018-09-24 Thread Ajay Singh
This patch series contains changes to avoid the use of static variables.
Cleanup changes to fix some checkpatch issues and return void for
function if their return value is not used.
Also deleted 'wilc_debugfs.c' file as it's not used.

Changes since v2:
   Included Joe's suggestion for patch#28
- replaced previous patch with an improved version(refactor code)

Changes since v1:
   Address Dan's comment for patch#29
- return the correct error for failure in the second iteration

Ajay Singh (29):
  staging: wilc1000: change return type to 'void' for
wilc_frame_register()
  staging: wilc1000: change return type to 'void' for
wilc_wlan_set_bssid()
  staging: wilc1000: change return type to 'void' for lock init & deinit
functions
  staging: wilc1000: change return type to 'void' for
wilc_deinit_host_int()
  staging: wilc1000: change return type to 'void' for
wilc_wfi_deinit_mon_interface()
  staging: wilc1000: use 'void' return type for
host_int_get_assoc_res_info()
  staging: wilc1000: use 'void' return for wilc_wlan_txq_add_to_head()
  staging: wilc1000: change return type to 'void' tcp ack filter
functions
  staging: wilc1000: use 'void' return for
wilc_wlan_txq_filter_dup_tcp_ack()
  staging: wilc1000: change return type to 'void' for
wilc_wlan_cfg_indicate_rx()
  staging: wilc1000: refactor wilc_wlan_parse_info_frame() function
  staging: wilc1000: set default value of cfg response type in
wilc_wlan_cfg_indicate_rx()
  staging: wilc1000: changes 'val' type to u8 in wilc_cfg_byte struct
  staging: wilc1000: remove unused wid type values
  staging: wilc1000: remove unused wid from cfg struct
  staging: wilc1000: refactor code to remove 'mac_status' from
'wilc_mac_cfg' struct
  staging: wilc1000: refactor code to avoid static variables for config
parameters
  staging: wilc1000: rename 'wilc_mac_cfg' struct to 'wilc_cfg_str_vals'
  staging: wilc1000: avoid the use of 'hif_driver_comp' completion
variable
  staging: wilc1000: remove use of unnecessary 'wilc_connected_ssid'
variable
  staging: wilc1000: avoid use of 'g_sdio' static variable
  staging: wilc1000: avoid use of 'g_spi' static variable
  staging: wilc1000: remove unnecessary memset in sdio_init() &
wilc_spi_init()
  staging: wilc1000: remove p2p related static variables to wilc_vif
struct
  staging: wilc1000: remove wilc_debugfs.c file as its not used
  staging: wilc1000: remove unnecessary option used with ccflags-y in
Makefile
  staging: wilc1000: use usleep_range() in place of udelay()
  staging: wilc1000: refactor wilc_set_multicast_list() function
  staging: wilc1000: return exact error of register_netdev() from
wilc_netdev_init()

 drivers/staging/wilc1000/Makefile |   5 +-
 drivers/staging/wilc1000/host_interface.c |  64 ++---
 drivers/staging/wilc1000/host_interface.h |   6 +-
 drivers/staging/wilc1000/linux_mon.c  |   3 +-
 drivers/staging/wilc1000/linux_wlan.c |  64 +++--
 drivers/staging/wilc1000/wilc_debugfs.c   | 115 -
 drivers/staging/wilc1000/wilc_sdio.c  |  56 +++--
 drivers/staging/wilc1000/wilc_spi.c   |  57 +++--
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  90 +++
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h |   4 +-
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  14 +-
 drivers/staging/wilc1000/wilc_wlan.c  |  44 ++--
 drivers/staging/wilc1000/wilc_wlan.h  |   3 +-
 drivers/staging/wilc1000/wilc_wlan_cfg.c  | 294 +-
 drivers/staging/wilc1000/wilc_wlan_cfg.h  |  26 +-
 drivers/staging/wilc1000/wilc_wlan_if.h   |   4 -
 16 files changed, 340 insertions(+), 509 deletions(-)
 delete mode 100644 drivers/staging/wilc1000/wilc_debugfs.c

-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 01/29] staging: wilc1000: change return type to 'void' for wilc_frame_register()

2018-09-24 Thread Ajay Singh
Cleanup patch to use 'void' return type for wilc_frame_register(), as
its return value is not used.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 5388be9..7729f83 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -3641,14 +3641,14 @@ int wilc_listen_state_expired(struct wilc_vif *vif, u32 
session_id)
return result;
 }
 
-int wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg)
+void wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg)
 {
int result;
struct host_if_msg *msg;
 
msg = wilc_alloc_work(vif, handle_register_frame, false);
if (IS_ERR(msg))
-   return PTR_ERR(msg);
+   return;
 
switch (frame_type) {
case ACTION:
@@ -3670,8 +3670,6 @@ int wilc_frame_register(struct wilc_vif *vif, u16 
frame_type, bool reg)
netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
kfree(msg);
}
-
-   return result;
 }
 
 int wilc_add_beacon(struct wilc_vif *vif, u32 interval, u32 dtim_period,
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index a48818f..15ffaeb 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -348,7 +348,7 @@ int wilc_remain_on_channel(struct wilc_vif *vif, u32 
session_id,
   wilc_remain_on_chan_ready ready,
   void *user_arg);
 int wilc_listen_state_expired(struct wilc_vif *vif, u32 session_id);
-int wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg);
+void wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg);
 int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode,
 u8 ifc_id);
 int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode);
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 02/29] staging: wilc1000: change return type to 'void' for wilc_wlan_set_bssid()

2018-09-24 Thread Ajay Singh
Cleanup patch to use 'void' return type for wilc_wlan_set_bssid(),
as its always returns the same value.

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

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 49afda6..d1d2c64 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -192,14 +192,12 @@ static struct net_device *get_if_handler(struct wilc 
*wilc, u8 *mac_header)
return NULL;
 }
 
-int wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid, u8 mode)
+void wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid, u8 mode)
 {
struct wilc_vif *vif = netdev_priv(wilc_netdev);
 
memcpy(vif->bssid, bssid, 6);
vif->mode = mode;
-
-   return 0;
 }
 
 int wilc_wlan_get_num_conn_ifcs(struct wilc *wilc)
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 1837808..30151b2 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -215,6 +215,6 @@ void wilc_netdev_cleanup(struct wilc *wilc);
 int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
 const struct wilc_hif_func *ops);
 void wilc_wfi_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size);
-int wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid, u8 mode);
+void wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid, u8 mode);
 
 #endif
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 03/29] staging: wilc1000: change return type to 'void' for lock init & deinit functions

2018-09-24 Thread Ajay Singh
Cleanup patch to use 'void' return type for wlan_deinit_locks() &
wlan_init_locks(), as same value is return.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/linux_wlan.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index d1d2c64..e2669b9 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -525,7 +525,7 @@ static int linux_wlan_init_test_config(struct net_device 
*dev,
return -1;
 }
 
-static int wlan_deinit_locks(struct net_device *dev)
+static void wlan_deinit_locks(struct net_device *dev)
 {
struct wilc_vif *vif = netdev_priv(dev);
struct wilc *wilc = vif->wilc;
@@ -533,8 +533,6 @@ static int wlan_deinit_locks(struct net_device *dev)
mutex_destroy(&wilc->hif_cs);
mutex_destroy(&wilc->rxq_cs);
mutex_destroy(&wilc->txq_add_to_head_cs);
-
-   return 0;
 }
 
 static void wlan_deinitialize_threads(struct net_device *dev)
@@ -588,7 +586,7 @@ static void wilc_wlan_deinitialize(struct net_device *dev)
}
 }
 
-static int wlan_init_locks(struct net_device *dev)
+static void wlan_init_locks(struct net_device *dev)
 {
struct wilc_vif *vif = netdev_priv(dev);
struct wilc *wl = vif->wilc;
@@ -604,8 +602,6 @@ static int wlan_init_locks(struct net_device *dev)
init_completion(&wl->cfg_event);
init_completion(&wl->sync_event);
init_completion(&wl->txq_thread_started);
-
-   return 0;
 }
 
 static int wlan_initialize_threads(struct net_device *dev)
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 07/29] staging: wilc1000: use 'void' return for wilc_wlan_txq_add_to_head()

2018-09-24 Thread Ajay Singh
Use 'void' return for wilc_wlan_txq_add_to_head() as its always
return '0' value.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wlan.c | 11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 590a51c..8057db9 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -71,8 +71,8 @@ static void wilc_wlan_txq_add_to_tail(struct net_device *dev,
complete(&wilc->txq_event);
 }
 
-static int wilc_wlan_txq_add_to_head(struct wilc_vif *vif,
-struct txq_entry_t *tqe)
+static void wilc_wlan_txq_add_to_head(struct wilc_vif *vif,
+ struct txq_entry_t *tqe)
 {
unsigned long flags;
struct wilc *wilc = vif->wilc;
@@ -87,8 +87,6 @@ static int wilc_wlan_txq_add_to_head(struct wilc_vif *vif,
spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
mutex_unlock(&wilc->txq_add_to_head_cs);
complete(&wilc->txq_event);
-
-   return 0;
 }
 
 #define NOT_TCP_ACK(-1)
@@ -275,10 +273,7 @@ static int wilc_wlan_txq_add_cfg_pkt(struct wilc_vif *vif, 
u8 *buffer,
tqe->priv = NULL;
tqe->ack_idx = NOT_TCP_ACK;
 
-   if (wilc_wlan_txq_add_to_head(vif, tqe)) {
-   kfree(tqe);
-   return 0;
-   }
+   wilc_wlan_txq_add_to_head(vif, tqe);
 
return 1;
 }
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 04/29] staging: wilc1000: change return type to 'void' for wilc_deinit_host_int()

2018-09-24 Thread Ajay Singh
Cleanup patch to use 'void' return type for wilc_deinit_host_int(),
as its return value is not used in caller.

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 37c26d4..02a8846 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2175,7 +2175,7 @@ int wilc_init_host_int(struct net_device *net)
return ret;
 }
 
-int wilc_deinit_host_int(struct net_device *net)
+void wilc_deinit_host_int(struct net_device *net)
 {
int ret;
struct wilc_priv *priv = wdev_priv(net->ieee80211_ptr);
@@ -2192,8 +2192,6 @@ int wilc_deinit_host_int(struct net_device *net)
 
if (ret)
netdev_err(net, "Error while deinitializing host interface\n");
-
-   return ret;
 }
 
 void wilc_free_wiphy(struct net_device *net)
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
index be412b6..1858f56 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
@@ -11,7 +11,7 @@
 struct wireless_dev *wilc_create_wiphy(struct net_device *net,
   struct device *dev);
 void wilc_free_wiphy(struct net_device *net);
-int wilc_deinit_host_int(struct net_device *net);
+void wilc_deinit_host_int(struct net_device *net);
 int wilc_init_host_int(struct net_device *net);
 void wilc_wfi_monitor_rx(u8 *buff, u32 size);
 int wilc_wfi_deinit_mon_interface(void);
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 12/29] staging: wilc1000: set default value of cfg response type in wilc_wlan_cfg_indicate_rx()

2018-09-24 Thread Ajay Singh
Handle the setting of default value for 'wilc_cfg_rsp' type for all
cases in wilc_wlan_cfg_indicate_rx() as the caller make use of this
value to know the type of the received message.

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

diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c 
b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index 2b5471b..2c463a3 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -507,6 +507,7 @@ void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 
*frame, int size,
msg_id = frame[1];  /* seq no */
frame += 4;
size -= 4;
+   rsp->type = 0;
 
/*
 * The valid types of response messages are
@@ -532,7 +533,6 @@ void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 
*frame, int size,
 
case 'N':
wilc_network_info_received(wilc, frame - 4, size + 4);
-   rsp->type = 0;
break;
 
case 'S':
@@ -540,7 +540,6 @@ void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 
*frame, int size,
break;
 
default:
-   rsp->type = 0;
rsp->seq_no = msg_id;
break;
}
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 10/29] staging: wilc1000: change return type to 'void' for wilc_wlan_cfg_indicate_rx()

2018-09-24 Thread Ajay Singh
Cleanup patch to use 'void' return type for wilc_wlan_cfg_indicate_rx(),
as its return value is not used in caller. The value set in
'rsp' argument is used to get the success status.

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

diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c 
b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index 4215763..42c64ed 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -502,10 +502,9 @@ int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 
buffer_size)
return ret;
 }
 
-int wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size,
- struct wilc_cfg_rsp *rsp)
+void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size,
+  struct wilc_cfg_rsp *rsp)
 {
-   int ret = 1;
u8 msg_type;
u8 msg_id;
 
@@ -547,11 +546,8 @@ int wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 
*frame, int size,
default:
rsp->type = 0;
rsp->seq_no = msg_id;
-   ret = 0;
break;
}
-
-   return ret;
 }
 
 int wilc_wlan_cfg_init(void)
diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.h 
b/drivers/staging/wilc1000/wilc_wlan_cfg.h
index 0c649d1..189e617 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.h
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.h
@@ -31,8 +31,8 @@ struct wilc;
 int wilc_wlan_cfg_set_wid(u8 *frame, u32 offset, u16 id, u8 *buf, int size);
 int wilc_wlan_cfg_get_wid(u8 *frame, u32 offset, u16 id);
 int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 buffer_size);
-int wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size,
- struct wilc_cfg_rsp *rsp);
+void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size,
+  struct wilc_cfg_rsp *rsp);
 int wilc_wlan_cfg_init(void);
 
 #endif
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 09/29] staging: wilc1000: use 'void' return for wilc_wlan_txq_filter_dup_tcp_ack()

2018-09-24 Thread Ajay Singh
Use 'void' return for wilc_wlan_txq_filter_dup_tcp_ack() as it always
return value '1' and its not used by the caller.

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

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 66ce29d..88808d9 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -182,7 +182,7 @@ static inline void tcp_process(struct net_device *dev, 
struct txq_entry_t *tqe)
spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
 }
 
-static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev)
+static void wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev)
 {
struct wilc_vif *vif = netdev_priv(dev);
struct wilc *wilc = vif->wilc;
@@ -237,8 +237,6 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct 
net_device *dev)
msecs_to_jiffies(1));
dropped--;
}
-
-   return 1;
 }
 
 void wilc_enable_tcp_ack_filter(struct wilc_vif *vif, bool value)
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 11/29] staging: wilc1000: refactor wilc_wlan_parse_info_frame() function

2018-09-24 Thread Ajay Singh
Return 'void' from wilc_wlan_parse_info_frame() as same constant value
is returned always. Also removed the 'size' from input parameter as its
not used in the function.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wlan_cfg.c | 12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c 
b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index 42c64ed..2b5471b 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -350,22 +350,17 @@ static void wilc_wlan_parse_response_frame(u8 *info, int 
size)
}
 }
 
-static int wilc_wlan_parse_info_frame(u8 *info, int size)
+static void wilc_wlan_parse_info_frame(u8 *info)
 {
struct wilc_mac_cfg *pd = &g_mac;
u32 wid, len;
-   int type = WILC_CFG_RSP_STATUS;
 
wid = info[0] | (info[1] << 8);
 
len = info[2];
 
-   if (len == 1 && wid == WID_STATUS) {
+   if (len == 1 && wid == WID_STATUS)
pd->mac_status = info[3];
-   type = WILC_CFG_RSP_STATUS;
-   }
-
-   return type;
 }
 
 /
@@ -528,7 +523,8 @@ void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 
*frame, int size,
break;
 
case 'I':
-   rsp->type = wilc_wlan_parse_info_frame(frame, size);
+   wilc_wlan_parse_info_frame(frame);
+   rsp->type = WILC_CFG_RSP_STATUS;
rsp->seq_no = msg_id;
/*call host interface info parse as well*/
wilc_gnrl_async_info_received(wilc, frame - 4, size + 4);
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 08/29] staging: wilc1000: change return type to 'void' tcp ack filter functions

2018-09-24 Thread Ajay Singh
Use 'void' return type for below functions as they always return '0' and
their return value is not used by caller.
add_tcp_pending_ack()
update_tcp_session()
add_tcp_pending_ack()

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wlan.c | 15 ++-
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 8057db9..66ce29d 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -91,8 +91,8 @@ static void wilc_wlan_txq_add_to_head(struct wilc_vif *vif,
 
 #define NOT_TCP_ACK(-1)
 
-static inline int add_tcp_session(struct wilc_vif *vif, u32 src_prt,
- u32 dst_prt, u32 seq)
+static inline void add_tcp_session(struct wilc_vif *vif, u32 src_prt,
+  u32 dst_prt, u32 seq)
 {
struct tcp_ack_filter *f = &vif->ack_filter;
 
@@ -103,22 +103,20 @@ static inline int add_tcp_session(struct wilc_vif *vif, 
u32 src_prt,
f->ack_session_info[f->tcp_session].dst_port = dst_prt;
f->tcp_session++;
}
-   return 0;
 }
 
-static inline int update_tcp_session(struct wilc_vif *vif, u32 index, u32 ack)
+static inline void update_tcp_session(struct wilc_vif *vif, u32 index, u32 ack)
 {
struct tcp_ack_filter *f = &vif->ack_filter;
 
if (index < 2 * MAX_TCP_SESSION &&
ack > f->ack_session_info[index].bigger_ack_num)
f->ack_session_info[index].bigger_ack_num = ack;
-   return 0;
 }
 
-static inline int add_tcp_pending_ack(struct wilc_vif *vif, u32 ack,
- u32 session_index,
- struct txq_entry_t *txqe)
+static inline void add_tcp_pending_ack(struct wilc_vif *vif, u32 ack,
+  u32 session_index,
+  struct txq_entry_t *txqe)
 {
struct tcp_ack_filter *f = &vif->ack_filter;
u32 i = f->pending_base + f->pending_acks_idx;
@@ -130,7 +128,6 @@ static inline int add_tcp_pending_ack(struct wilc_vif *vif, 
u32 ack,
txqe->ack_idx = i;
f->pending_acks_idx++;
}
-   return 0;
 }
 
 static inline void tcp_process(struct net_device *dev, struct txq_entry_t *tqe)
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 05/29] staging: wilc1000: change return type to 'void' for wilc_wfi_deinit_mon_interface()

2018-09-24 Thread Ajay Singh
Use 'void' return type for wilc_wfi_deinit_mon_interface(), as same
value always return.

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

diff --git a/drivers/staging/wilc1000/linux_mon.c 
b/drivers/staging/wilc1000/linux_mon.c
index 1afdb9e..a634468 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -253,7 +253,7 @@ struct net_device *wilc_wfi_init_mon_interface(const char 
*name,
return wilc_wfi_mon;
 }
 
-int wilc_wfi_deinit_mon_interface(void)
+void wilc_wfi_deinit_mon_interface(void)
 {
bool rollback_lock = false;
 
@@ -270,5 +270,4 @@ int wilc_wfi_deinit_mon_interface(void)
}
wilc_wfi_mon = NULL;
}
-   return 0;
 }
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
index 1858f56..4812c8e 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
@@ -14,7 +14,7 @@ void wilc_free_wiphy(struct net_device *net);
 void wilc_deinit_host_int(struct net_device *net);
 int wilc_init_host_int(struct net_device *net);
 void wilc_wfi_monitor_rx(u8 *buff, u32 size);
-int wilc_wfi_deinit_mon_interface(void);
+void wilc_wfi_deinit_mon_interface(void);
 struct net_device *wilc_wfi_init_mon_interface(const char *name,
   struct net_device *real_dev);
 void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 14/29] staging: wilc1000: remove unused wid type values

2018-09-24 Thread Ajay Singh
Cleanup patch to remove the wid type not used in the code.

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

diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h 
b/drivers/staging/wilc1000/wilc_wlan_if.h
index b81a73b..ce2066b 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -204,10 +204,6 @@ enum wid_type {
WID_STR = 3,
WID_BIN_DATA= 4,
WID_BIN = 5,
-   WID_IP  = 6,
-   WID_ADR = 7,
-   WID_UNDEF   = 8,
-   WID_TYPE_FORCE_32BIT= 0x
 };
 
 struct wid {
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 15/29] staging: wilc1000: remove unused wid from cfg struct

2018-09-24 Thread Ajay Singh
Cleanup patch to remove the unused element stored in cfg struct.
Removed those wid from the cfg variables whose value is not
fetched(GET_CFG) from the code. In case the wid is only set to the
firmware then there is need to store them as part of cfg variables, so
removed the unused code.

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

diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c 
b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index 2c463a3..541251b 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -20,131 +20,36 @@ enum cfg_cmd_type {
 struct wilc_mac_cfg {
int mac_status;
u8 mac_address[7];
-   u8 ip_address[5];
-   u8 bssid[7];
-   u8 ssid[34];
u8 firmware_version[129];
-   u8 supp_rate[24];
-   u8 wep_key[28];
-   u8 i_psk[66];
-   u8 hw_product_version[33];
-   u8 phyversion[17];
-   u8 supp_username[21];
-   u8 supp_password[64];
-   u8 assoc_req[256];
u8 assoc_rsp[256];
-   u8 firmware_info[8];
-   u8 scan_result[256];
-   u8 scan_result1[256];
 };
 
 static struct wilc_mac_cfg g_mac;
 
 static struct wilc_cfg_byte g_cfg_byte[] = {
-   {WID_BSS_TYPE, 0},
-   {WID_CURRENT_TX_RATE, 0},
-   {WID_CURRENT_CHANNEL, 0},
-   {WID_PREAMBLE, 0},
-   {WID_11G_OPERATING_MODE, 0},
{WID_STATUS, 0},
-   {WID_SCAN_TYPE, 0},
-   {WID_KEY_ID, 0},
-   {WID_QOS_ENABLE, 0},
-   {WID_POWER_MANAGEMENT, 0},
-   {WID_11I_MODE, 0},
-   {WID_AUTH_TYPE, 0},
-   {WID_SITE_SURVEY, 0},
-   {WID_LISTEN_INTERVAL, 0},
-   {WID_DTIM_PERIOD, 0},
-   {WID_ACK_POLICY, 0},
-   {WID_BCAST_SSID, 0},
-   {WID_REKEY_POLICY, 0},
-   {WID_SHORT_SLOT_ALLOWED, 0},
-   {WID_START_SCAN_REQ, 0},
{WID_RSSI, 0},
{WID_LINKSPEED, 0},
-   {WID_AUTO_RX_SENSITIVITY, 0},
-   {WID_DATAFLOW_CONTROL, 0},
-   {WID_SCAN_FILTER, 0},
-   {WID_11N_PROT_MECH, 0},
-   {WID_11N_ERP_PROT_TYPE, 0},
-   {WID_11N_ENABLE, 0},
-   {WID_11N_OPERATING_MODE, 0},
-   {WID_11N_OBSS_NONHT_DETECTION, 0},
-   {WID_11N_HT_PROT_TYPE, 0},
-   {WID_11N_RIFS_PROT_ENABLE, 0},
-   {WID_11N_SMPS_MODE, 0},
-   {WID_11N_CURRENT_TX_MCS, 0},
-   {WID_11N_SHORT_GI_ENABLE, 0},
-   {WID_RIFS_MODE, 0},
-   {WID_TX_ABORT_CONFIG, 0},
-   {WID_11N_IMMEDIATE_BA_ENABLED, 0},
-   {WID_11N_TXOP_PROT_DISABLE, 0},
{WID_NIL, 0}
 };
 
 static struct wilc_cfg_hword g_cfg_hword[] = {
-   {WID_LINK_LOSS_THRESHOLD, 0},
-   {WID_RTS_THRESHOLD, 0},
-   {WID_FRAG_THRESHOLD, 0},
-   {WID_SHORT_RETRY_LIMIT, 0},
-   {WID_LONG_RETRY_LIMIT, 0},
-   {WID_BEACON_INTERVAL, 0},
-   {WID_RX_SENSE, 0},
-   {WID_ACTIVE_SCAN_TIME, 0},
-   {WID_PASSIVE_SCAN_TIME, 0},
-   {WID_SITE_SURVEY_SCAN_TIME, 0},
-   {WID_JOIN_START_TIMEOUT, 0},
-   {WID_AUTH_TIMEOUT, 0},
-   {WID_ASOC_TIMEOUT, 0},
-   {WID_11I_PROTOCOL_TIMEOUT, 0},
-   {WID_EAPOL_RESPONSE_TIMEOUT, 0},
-   {WID_11N_SIG_QUAL_VAL, 0},
-   {WID_CCA_THRESHOLD, 0},
{WID_NIL, 0}
 };
 
 static struct wilc_cfg_word g_cfg_word[] = {
{WID_FAILED_COUNT, 0},
-   {WID_RETRY_COUNT, 0},
-   {WID_MULTIPLE_RETRY_COUNT, 0},
-   {WID_FRAME_DUPLICATE_COUNT, 0},
-   {WID_ACK_FAILURE_COUNT, 0},
{WID_RECEIVED_FRAGMENT_COUNT, 0},
-   {WID_MCAST_RECEIVED_FRAME_COUNT, 0},
-   {WID_FCS_ERROR_COUNT, 0},
{WID_SUCCESS_FRAME_COUNT, 0},
-   {WID_TX_FRAGMENT_COUNT, 0},
-   {WID_TX_MULTICAST_FRAME_COUNT, 0},
-   {WID_RTS_SUCCESS_COUNT, 0},
-   {WID_RTS_FAILURE_COUNT, 0},
-   {WID_WEP_UNDECRYPTABLE_COUNT, 0},
-   {WID_REKEY_PERIOD, 0},
-   {WID_REKEY_PACKET_COUNT, 0},
-   {WID_HW_RX_COUNT, 0},
{WID_GET_INACTIVE_TIME, 0},
{WID_NIL, 0}
 
 };
 
 static struct wilc_cfg_str g_cfg_str[] = {
-   {WID_SSID, g_mac.ssid}, /* 33 + 1 bytes */
{WID_FIRMWARE_VERSION, g_mac.firmware_version},
-   {WID_OPERATIONAL_RATE_SET, g_mac.supp_rate},
-   {WID_BSSID, g_mac.bssid},   /* 6 bytes */
-   {WID_WEP_KEY_VALUE, g_mac.wep_key}, /* 27 bytes */
-   {WID_11I_PSK, g_mac.i_psk}, /* 65 bytes */
-   {WID_HARDWARE_VERSION, g_mac.hw_product_version},
{WID_MAC_ADDR, g_mac.mac_address},
-   {WID_PHY_VERSION, g_mac.phyversion},
-   {WID_SUPP_USERNAME, g_mac.supp_username},
-   {WID_SUPP_PASSWORD, g_mac.supp_password},
-   {WID_SITE_SURVEY_RESULTS, g_mac.scan_result},
-   {WID_SITE_SURVEY_RESULTS, g_mac.scan_result1},
-   {WID_ASSOC_REQ_INFO, g_mac.assoc_req},
{WID_ASSOC_RES_INFO, g_mac.assoc_rsp},
-   {WID_FIRMWARE_INFO, g_mac.firmware_version},
-   {WID_IP_ADDRESS, g_mac.ip_address},
{WID_NIL, NULL}
 };
 
@@ -327,12 +232,6 @@ static void

[PATCH v3 16/29] staging: wilc1000: refactor code to remove 'mac_status' from 'wilc_mac_cfg' struct

2018-09-24 Thread Ajay Singh
Refactor the code by removing use of 'mac_status' from 'wilc_mac_cfg'
and only have the string type configuration values in 'wilc_mac_cfg'
struct. Now fetch the value 'WID_STATUS' configuration from 'g_cfg_byte'
array.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/linux_wlan.c |  4 ++--
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  2 +-
 drivers/staging/wilc1000/wilc_wlan_cfg.c  | 23 ++-
 3 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index e2669b9..d9f927e 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -159,9 +159,9 @@ static void deinit_irq(struct net_device *dev)
 
 void wilc_mac_indicate(struct wilc *wilc)
 {
-   int status;
+   s8 status;
 
-   wilc_wlan_cfg_get_val(WID_STATUS, (unsigned char *)&status, 4);
+   wilc_wlan_cfg_get_val(WID_STATUS, &status, 1);
if (wilc->mac_status == MAC_STATUS_INIT) {
wilc->mac_status = status;
complete(&wilc->sync_event);
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 30151b2..70bae3a 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -155,7 +155,7 @@ struct wilc_vif {
 struct wilc {
const struct wilc_hif_func *hif_func;
int io_type;
-   int mac_status;
+   s8 mac_status;
struct gpio_desc *gpio_irq;
bool initialized;
int dev_irq_num;
diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c 
b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index 541251b..4434976 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -18,7 +18,6 @@ enum cfg_cmd_type {
 };
 
 struct wilc_mac_cfg {
-   int mac_status;
u8 mac_address[7];
u8 firmware_version[129];
u8 assoc_rsp[256];
@@ -251,15 +250,26 @@ static void wilc_wlan_parse_response_frame(u8 *info, int 
size)
 
 static void wilc_wlan_parse_info_frame(u8 *info)
 {
-   struct wilc_mac_cfg *pd = &g_mac;
u32 wid, len;
 
wid = info[0] | (info[1] << 8);
 
len = info[2];
 
-   if (len == 1 && wid == WID_STATUS)
-   pd->mac_status = info[3];
+   if (len == 1 && wid == WID_STATUS) {
+   int i = 0;
+
+   do {
+   if (g_cfg_byte[i].id == WID_NIL)
+   break;
+
+   if (g_cfg_byte[i].id == wid) {
+   g_cfg_byte[i].val = info[3];
+   break;
+   }
+   i++;
+   } while (1);
+   }
 }
 
 /
@@ -323,11 +333,6 @@ int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 
buffer_size)
u32 type = (wid >> 12) & 0xf;
int i, ret = 0;
 
-   if (wid == WID_STATUS) {
-   *((u32 *)buffer) = g_mac.mac_status;
-   return 4;
-   }
-
i = 0;
if (type == CFG_BYTE_CMD) {
do {
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 17/29] staging: wilc1000: refactor code to avoid static variables for config parameters

2018-09-24 Thread Ajay Singh
Refactor the code in wilc_wlan_cfg.c file to avoid the use of static
variables. Move the static variables as part of wilc struct and also
dynamically allocating memory for keeping those variables.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/linux_wlan.c |  12 +-
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |   2 +
 drivers/staging/wilc1000/wilc_wlan.c  |  12 +-
 drivers/staging/wilc1000/wilc_wlan.h  |   3 +-
 drivers/staging/wilc1000/wilc_wlan_cfg.c  | 159 +-
 drivers/staging/wilc1000/wilc_wlan_cfg.h  |  20 +++-
 6 files changed, 138 insertions(+), 70 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index d9f927e..8ecd664 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -161,7 +161,7 @@ void wilc_mac_indicate(struct wilc *wilc)
 {
s8 status;
 
-   wilc_wlan_cfg_get_val(WID_STATUS, &status, 1);
+   wilc_wlan_cfg_get_val(wilc, WID_STATUS, &status, 1);
if (wilc->mac_status == MAC_STATUS_INIT) {
wilc->mac_status = status;
complete(&wilc->sync_event);
@@ -677,7 +677,7 @@ static int wilc_wlan_initialize(struct net_device *dev, 
struct wilc_vif *vif)
int size;
char firmware_ver[20];
 
-   size = wilc_wlan_cfg_get_val(WID_FIRMWARE_VERSION,
+   size = wilc_wlan_cfg_get_val(wl, WID_FIRMWARE_VERSION,
 firmware_ver,
 sizeof(firmware_ver));
firmware_ver[size] = '\0';
@@ -1035,6 +1035,7 @@ void wilc_netdev_cleanup(struct wilc *wilc)
 
flush_workqueue(wilc->hif_workqueue);
destroy_workqueue(wilc->hif_workqueue);
+   wilc_wlan_cfg_deinit(wilc);
kfree(wilc);
 }
 EXPORT_SYMBOL_GPL(wilc_netdev_cleanup);
@@ -1060,6 +1061,9 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
if (!wl)
return -ENOMEM;
 
+   if (wilc_wlan_cfg_init(wl))
+   goto free_wl;
+
*wilc = wl;
wl->io_type = io_type;
wl->hif_func = ops;
@@ -1070,7 +1074,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
 
wl->hif_workqueue = create_singlethread_workqueue("WILC_wq");
if (!wl->hif_workqueue)
-   goto free_wl;
+   goto free_cfg;
 
register_inetaddr_notifier(&g_dev_notifier);
 
@@ -1139,6 +1143,8 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
}
unregister_inetaddr_notifier(&g_dev_notifier);
destroy_workqueue(wl->hif_workqueue);
+free_cfg:
+   wilc_wlan_cfg_deinit(wl);
 free_wl:
kfree(wl);
return -ENOMEM;
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 70bae3a..484c265 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -16,6 +16,7 @@
 
 #include "host_interface.h"
 #include "wilc_wlan.h"
+#include "wilc_wlan_cfg.h"
 
 #define FLOW_CONTROL_LOWER_THRESHOLD   128
 #define FLOW_CONTROL_UPPER_THRESHOLD   256
@@ -203,6 +204,7 @@ struct wilc {
int clients_count;
struct workqueue_struct *hif_workqueue;
enum chip_ps_states chip_ps_state;
+   struct wilc_cfg cfg;
 };
 
 struct wilc_wfi_mon_priv {
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 88808d9..0ec0d9b 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1194,9 +1194,9 @@ int wilc_wlan_cfg_get(struct wilc_vif *vif, int start, 
u16 wid, int commit,
return ret_size;
 }
 
-int wilc_wlan_cfg_get_val(u16 wid, u8 *buffer, u32 buffer_size)
+int wilc_wlan_cfg_get_val(struct wilc *wl, u16 wid, u8 *buffer, u32 
buffer_size)
 {
-   return wilc_wlan_cfg_get_wid_value(wid, buffer, buffer_size);
+   return wilc_wlan_cfg_get_wid_value(wl, wid, buffer, buffer_size);
 }
 
 int wilc_send_config_pkt(struct wilc_vif *vif, u8 mode, struct wid *wids,
@@ -1216,7 +1216,8 @@ int wilc_send_config_pkt(struct wilc_vif *vif, u8 mode, 
struct wid *wids,
}
}
for (i = 0; i < count; i++) {
-   wids[i].size = wilc_wlan_cfg_get_val(wids[i].id,
+   wids[i].size = wilc_wlan_cfg_get_val(vif->wilc,
+wids[i].id,
 wids[i].val,
 wids[i].size);
}
@@ -1315,11 +1316,6 @@ int wil

[PATCH v3 22/29] staging: wilc1000: avoid use of 'g_spi' static variable

2018-09-24 Thread Ajay Singh
Instead of using static variable 'g_spi' move it as part of 'wilc'
struct. Also allocating the memory in the probe function and
free is taken care in wilc_netdev_cleanup().

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_spi.c | 58 +++--
 1 file changed, 36 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_spi.c 
b/drivers/staging/wilc1000/wilc_spi.c
index 5517477..2559cf0 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -14,7 +14,6 @@ struct wilc_spi {
int has_thrpt_enh;
 };
 
-static struct wilc_spi g_spi;
 static const struct wilc_hif_func wilc_hif_spi;
 
 /
@@ -107,6 +106,11 @@ static int wilc_bus_probe(struct spi_device *spi)
int ret;
struct wilc *wilc;
struct gpio_desc *gpio;
+   struct wilc_spi *spi_priv;
+
+   spi_priv = kzalloc(sizeof(*spi_priv), GFP_KERNEL);
+   if (!spi_priv)
+   return -ENOMEM;
 
gpio = gpiod_get(&spi->dev, "irq", GPIOD_IN);
if (IS_ERR(gpio)) {
@@ -117,11 +121,14 @@ static int wilc_bus_probe(struct spi_device *spi)
}
 
ret = wilc_netdev_init(&wilc, NULL, HIF_SPI, &wilc_hif_spi);
-   if (ret)
+   if (ret) {
+   kfree(spi_priv);
return ret;
+   }
 
spi_set_drvdata(spi, wilc);
wilc->dev = &spi->dev;
+   wilc->bus_data = spi_priv;
wilc->gpio_irq = gpio;
 
return 0;
@@ -275,6 +282,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
u8 clockless)
 {
struct spi_device *spi = to_spi_device(wilc->dev);
+   struct wilc_spi *spi_priv = wilc->bus_data;
u8 wb[32], rb[32];
u8 wix, rix;
u32 len2;
@@ -375,7 +383,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
if (result != N_OK)
return result;
 
-   if (!g_spi.crc_off)
+   if (!spi_priv->crc_off)
wb[len - 1] = (crc7(0x7f, (const u8 *)&wb[0], len - 1)) << 1;
else
len -= 1;
@@ -393,7 +401,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
} else if (cmd == CMD_INTERNAL_READ || cmd == CMD_SINGLE_READ) {
int tmp = NUM_RSP_BYTES + NUM_DATA_HDR_BYTES + NUM_DATA_BYTES
+ NUM_DUMMY_BYTES;
-   if (!g_spi.crc_off)
+   if (!spi_priv->crc_off)
len2 = len + tmp + NUM_CRC_BYTES;
else
len2 = len + tmp;
@@ -485,7 +493,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
return N_FAIL;
}
 
-   if (!g_spi.crc_off) {
+   if (!spi_priv->crc_off) {
/*
 * Read Crc
 */
@@ -527,7 +535,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
/*
 * Read Crc
 */
-   if (!g_spi.crc_off && wilc_spi_rx(wilc, crc, 2)) {
+   if (!spi_priv->crc_off && wilc_spi_rx(wilc, crc, 2)) {
dev_err(&spi->dev,
"Failed block crc read, bus err\n");
return N_FAIL;
@@ -585,7 +593,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
/*
 * Read Crc
 */
-   if (!g_spi.crc_off && wilc_spi_rx(wilc, crc, 2)) {
+   if (!spi_priv->crc_off && wilc_spi_rx(wilc, crc, 2)) {
dev_err(&spi->dev,
"Failed block crc read, bus err\n");
result = N_FAIL;
@@ -602,6 +610,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
 static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz)
 {
struct spi_device *spi = to_spi_device(wilc->dev);
+   struct wilc_spi *spi_priv = wilc->bus_data;
int ix, nbytes;
int result = 1;
u8 cmd, order, crc[2] = {0};
@@ -648,7 +657,7 @@ static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz)
/*
 * Write Crc
 */
-   if (!g_spi.crc_off) {
+   if (!spi_priv->crc_off) {
if (wilc_spi_tx(wilc, crc, 2)) {
dev_err(&spi->dev, "Failed data block crc 
write, bus error...\n");
   

[PATCH v3 13/29] staging: wilc1000: changes 'val' type to u8 in wilc_cfg_byte struct

2018-09-24 Thread Ajay Singh
Use the correct datatype for storing the byte value in 'wilc_cfg_byte'
struct.

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

diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.h 
b/drivers/staging/wilc1000/wilc_wlan_cfg.h
index 189e617..082093f 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.h
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.h
@@ -9,7 +9,7 @@
 
 struct wilc_cfg_byte {
u16 id;
-   u16 val;
+   u8 val;
 };
 
 struct wilc_cfg_hword {
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 21/29] staging: wilc1000: avoid use of 'g_sdio' static variable

2018-09-24 Thread Ajay Singh
Instead of using static variable 'g_sdio' move it as part of 'wilc'
struct. Also allocating the memory in the probe function and free during
deinitialization.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/linux_wlan.c |  1 +
 drivers/staging/wilc1000/wilc_sdio.c  | 54 +--
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  1 +
 3 files changed, 36 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index b666e1e..560c168 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1037,6 +1037,7 @@ void wilc_netdev_cleanup(struct wilc *wilc)
flush_workqueue(wilc->hif_workqueue);
destroy_workqueue(wilc->hif_workqueue);
wilc_wlan_cfg_deinit(wilc);
+   kfree(wilc->bus_data);
kfree(wilc);
 }
 EXPORT_SYMBOL_GPL(wilc_netdev_cleanup);
diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
b/drivers/staging/wilc1000/wilc_sdio.c
index b2080d8..7ef047c 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -30,7 +30,6 @@ struct wilc_sdio {
int has_thrpt_enh3;
 };
 
-static struct wilc_sdio g_sdio;
 static const struct wilc_hif_func wilc_hif_sdio;
 
 static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data);
@@ -109,6 +108,11 @@ static int linux_sdio_probe(struct sdio_func *func,
struct wilc *wilc;
int ret;
struct gpio_desc *gpio = NULL;
+   struct wilc_sdio *sdio_priv;
+
+   sdio_priv = kzalloc(sizeof(*sdio_priv), GFP_KERNEL);
+   if (!sdio_priv)
+   return -ENOMEM;
 
if (IS_ENABLED(CONFIG_WILC1000_HW_OOB_INTR)) {
gpio = gpiod_get(&func->dev, "irq", GPIOD_IN);
@@ -124,9 +128,11 @@ static int linux_sdio_probe(struct sdio_func *func,
ret = wilc_netdev_init(&wilc, &func->dev, HIF_SDIO, &wilc_hif_sdio);
if (ret) {
dev_err(&func->dev, "Couldn't initialize netdev\n");
+   kfree(sdio_priv);
return ret;
}
sdio_set_drvdata(func, wilc);
+   wilc->bus_data = sdio_priv;
wilc->dev = &func->dev;
wilc->gpio_irq = gpio;
 
@@ -381,6 +387,7 @@ static int sdio_set_func1_block_size(struct wilc *wilc, u32 
block_size)
 static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data)
 {
struct sdio_func *func = dev_to_sdio_func(wilc->dev);
+   struct wilc_sdio *sdio_priv = wilc->bus_data;
int ret;
 
cpu_to_le32s(&data);
@@ -415,7 +422,7 @@ static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 
data)
cmd.increment = 1;
cmd.count = 4;
cmd.buffer = (u8 *)&data;
-   cmd.block_size = g_sdio.block_size;
+   cmd.block_size = sdio_priv->block_size;
ret = wilc_sdio_cmd53(wilc, &cmd);
if (ret) {
dev_err(&func->dev,
@@ -434,7 +441,8 @@ static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 
data)
 static int sdio_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size)
 {
struct sdio_func *func = dev_to_sdio_func(wilc->dev);
-   u32 block_size = g_sdio.block_size;
+   struct wilc_sdio *sdio_priv = wilc->bus_data;
+   u32 block_size = sdio_priv->block_size;
struct sdio_cmd53 cmd;
int nblk, nleft, ret;
 
@@ -523,6 +531,7 @@ static int sdio_write(struct wilc *wilc, u32 addr, u8 *buf, 
u32 size)
 static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data)
 {
struct sdio_func *func = dev_to_sdio_func(wilc->dev);
+   struct wilc_sdio *sdio_priv = wilc->bus_data;
int ret;
 
if (addr >= 0xf0 && addr <= 0xff) {
@@ -553,7 +562,7 @@ static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 
*data)
cmd.count = 4;
cmd.buffer = (u8 *)data;
 
-   cmd.block_size = g_sdio.block_size;
+   cmd.block_size = sdio_priv->block_size;
ret = wilc_sdio_cmd53(wilc, &cmd);
if (ret) {
dev_err(&func->dev,
@@ -574,7 +583,8 @@ static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 
*data)
 static int sdio_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size)
 {
struct sdio_func *func = dev_to_sdio_func(wilc->dev);
-   u32 block_size = g_sdio.block_size;
+   struct wilc_sdio *sdio_priv = wilc->bus_data;
+   u32 block_size = sdio_priv->block_size;
struct sdio_cmd53 cmd;
int nblk, nleft, ret;
 
@@ -674,13 +684,14 @@ static int sdio_deinit(struct wilc *wilc)
 static int sdio_init(struct wilc *wilc, bool resume)
 {
struct sdio_func *func = dev_to_sdio_func(wilc->dev);
+   struct wilc_sdio *sdi

[PATCH v3 18/29] staging: wilc1000: rename 'wilc_mac_cfg' struct to 'wilc_cfg_str_vals'

2018-09-24 Thread Ajay Singh
Rename 'wilc_mac_cfg' struct to 'wilc_cfg_str_vals' as its more
appropriate for structure to store the values of string configuration.

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

diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c 
b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index 8f1e962..930a389 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -438,7 +438,7 @@ void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 
*frame, int size,
 
 int wilc_wlan_cfg_init(struct wilc *wl)
 {
-   struct wilc_mac_cfg *mac_cfg;
+   struct wilc_cfg_str_vals *str_vals;
int i = 0;
 
wl->cfg.b = kmemdup(g_cfg_byte, sizeof(g_cfg_byte), GFP_KERNEL);
@@ -457,20 +457,20 @@ int wilc_wlan_cfg_init(struct wilc *wl)
if (!wl->cfg.s)
goto out_w;
 
-   mac_cfg = kzalloc(sizeof(mac_cfg), GFP_KERNEL);
-   if (!mac_cfg)
+   str_vals = kzalloc(sizeof(str_vals), GFP_KERNEL);
+   if (!str_vals)
goto out_s;
 
-   wl->cfg.str_vals = mac_cfg;
+   wl->cfg.str_vals = str_vals;
/* store the string cfg parameters */
wl->cfg.s[i].id = WID_FIRMWARE_VERSION;
-   wl->cfg.s[i].str = mac_cfg->firmware_version;
+   wl->cfg.s[i].str = str_vals->firmware_version;
i++;
wl->cfg.s[i].id = WID_MAC_ADDR;
-   wl->cfg.s[i].str = mac_cfg->mac_address;
+   wl->cfg.s[i].str = str_vals->mac_address;
i++;
wl->cfg.s[i].id = WID_ASSOC_RES_INFO;
-   wl->cfg.s[i].str = mac_cfg->assoc_rsp;
+   wl->cfg.s[i].str = str_vals->assoc_rsp;
i++;
wl->cfg.s[i].id = WID_NIL;
wl->cfg.s[i].str = NULL;
diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.h 
b/drivers/staging/wilc1000/wilc_wlan_cfg.h
index 176eef1..e5ca6ce 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.h
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.h
@@ -27,7 +27,7 @@ struct wilc_cfg_str {
u8 *str;
 };
 
-struct wilc_mac_cfg {
+struct wilc_cfg_str_vals {
u8 mac_address[7];
u8 firmware_version[129];
u8 assoc_rsp[256];
@@ -38,7 +38,7 @@ struct wilc_cfg {
struct wilc_cfg_hword *hw;
struct wilc_cfg_word *w;
struct wilc_cfg_str *s;
-   struct wilc_mac_cfg *str_vals;
+   struct wilc_cfg_str_vals *str_vals;
 };
 
 struct wilc;
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 19/29] staging: wilc1000: avoid the use of 'hif_driver_comp' completion variable

2018-09-24 Thread Ajay Singh
Instead of using extra completion variable to handle the sync call now
using msg->is_sync flag to handle the sync call.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 237a098d..529390d 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -187,7 +187,6 @@ struct join_bss_param {
 };
 
 static struct host_if_drv *terminated_handle;
-static struct completion hif_driver_comp;
 static struct mutex hif_deinit_lock;
 
 /* 'msg' should be free by the caller for syc */
@@ -310,10 +309,12 @@ static void handle_set_wfi_drv_handler(struct work_struct 
*work)
if (ret)
netdev_err(vif->ndev, "Failed to set driver handler\n");
 
-   complete(&hif_driver_comp);
kfree(buffer);
 
 free_msg:
+   if (msg->is_sync)
+   complete(&msg->work_comp);
+
kfree(msg);
 }
 
@@ -333,9 +334,6 @@ static void handle_set_operation_mode(struct work_struct 
*work)
ret = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
   wilc_get_vif_idx(vif));
 
-   if (hif_op_mode->mode == IDLE_MODE)
-   complete(&hif_driver_comp);
-
if (ret)
netdev_err(vif->ndev, "Failed to set operation mode\n");
 
@@ -3118,12 +3116,12 @@ int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 
channel)
 }
 
 int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode,
-u8 ifc_id)
+u8 ifc_id, bool is_sync)
 {
int result;
struct host_if_msg *msg;
 
-   msg = wilc_alloc_work(vif, handle_set_wfi_drv_handler, false);
+   msg = wilc_alloc_work(vif, handle_set_wfi_drv_handler, is_sync);
if (IS_ERR(msg))
return PTR_ERR(msg);
 
@@ -3135,8 +3133,12 @@ int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int 
index, u8 mode,
if (result) {
netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
kfree(msg);
+   return result;
}
 
+   if (is_sync)
+   wait_for_completion(&msg->work_comp);
+
return result;
 }
 
@@ -3380,10 +3382,8 @@ int wilc_init(struct net_device *dev, struct host_if_drv 
**hif_drv_handler)
 
vif->obtaining_ip = false;
 
-   if (wilc->clients_count == 0) {
-   init_completion(&hif_driver_comp);
+   if (wilc->clients_count == 0)
mutex_init(&hif_deinit_lock);
-   }
 
timer_setup(&vif->periodic_rssi, get_periodic_rssi, 0);
mod_timer(&vif->periodic_rssi, jiffies + msecs_to_jiffies(5000));
@@ -3430,8 +3430,7 @@ int wilc_deinit(struct wilc_vif *vif)
del_timer_sync(&vif->periodic_rssi);
del_timer_sync(&hif_drv->remain_on_ch_timer);
 
-   wilc_set_wfi_drv_handler(vif, 0, 0, 0);
-   wait_for_completion(&hif_driver_comp);
+   wilc_set_wfi_drv_handler(vif, 0, 0, 0, true);
 
if (hif_drv->usr_scan_req.scan_result) {
hif_drv->usr_scan_req.scan_result(SCAN_EVENT_ABORTED, NULL,
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 15ffaeb..4416f8f 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -350,7 +350,7 @@ int wilc_remain_on_channel(struct wilc_vif *vif, u32 
session_id,
 int wilc_listen_state_expired(struct wilc_vif *vif, u32 session_id);
 void wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg);
 int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode,
-u8 ifc_id);
+u8 ifc_id, bool is_sync);
 int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode);
 int wilc_get_statistics(struct wilc_vif *vif, struct rf_info *stats,
bool is_sync);
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 8ecd664..b666e1e 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -753,7 +753,8 @@ static int wilc_mac_open(struct net_device *ndev)
for (i = 0; i < wl->vif_num; i++) {
if (ndev == wl->vif[i]->ndev) {
wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif),
-vif->iftype, vif->ifc_id);
+vif->iftype, vif-&g

[PATCH v3 20/29] staging: wilc1000: remove use of unnecessary 'wilc_connected_ssid' variable

2018-09-24 Thread Ajay Singh
'wilc_connected_ssid' actually used to store the BSSID information for
connected BSSID. 'wilc_vif' already has 'bssid' variable to store the
same information. So refactor code to remove 'wilc_connected_ssid' and
instead used 'wilc_vif' struct 'bssid' element.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 529390d..01db899 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -813,7 +813,6 @@ static void handle_scan(struct work_struct *work)
kfree(msg);
 }
 
-u8 wilc_connected_ssid[6] = {0};
 static void handle_connect(struct work_struct *work)
 {
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
@@ -835,11 +834,6 @@ static void handle_connect(struct work_struct *work)
return;
}
 
-   if (memcmp(conn_attr->bssid, wilc_connected_ssid, ETH_ALEN) == 0) {
-   netdev_err(vif->ndev, "Discard connect request\n");
-   goto error;
-   }
-
bss_param = conn_attr->params;
if (!bss_param) {
netdev_err(vif->ndev, "Required BSSID not found\n");
@@ -1019,10 +1013,6 @@ static void handle_connect(struct work_struct *work)
cur_byte = wid_list[wid_cnt].val;
wid_cnt++;
 
-   if (conn_attr->bssid)
-   memcpy(wilc_connected_ssid,
-  conn_attr->bssid, ETH_ALEN);
-
result = wilc_send_config_pkt(vif, SET_CFG, wid_list,
  wid_cnt,
  wilc_get_vif_idx(vif));
@@ -1145,8 +1135,6 @@ static void handle_connect_timeout(struct work_struct 
*work)
kfree(hif_drv->usr_conn_req.ies);
hif_drv->usr_conn_req.ies = NULL;
 
-   eth_zero_addr(wilc_connected_ssid);
-
 out:
kfree(msg);
 }
@@ -1452,16 +1440,6 @@ 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, 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");
-   eth_zero_addr(wilc_connected_ssid);
-   }
-
if (hif_drv->usr_conn_req.bssid) {
memcpy(conn_info.bssid, hif_drv->usr_conn_req.bssid, 6);
 
@@ -1874,8 +1852,6 @@ static void handle_disconnect(struct work_struct *work)
vif->obtaining_ip = false;
wilc_set_power_mgmt(vif, 0, 0);
 
-   eth_zero_addr(wilc_connected_ssid);
-
result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
  wilc_get_vif_idx(vif));
 
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 4416f8f..33fb731 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -359,6 +359,4 @@ int wilc_get_vif_idx(struct wilc_vif *vif);
 int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power);
 int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power);
 
-extern u8 wilc_connected_ssid[6];
-
 #endif
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 76d017d..1a4d262 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -478,7 +478,6 @@ static void cfg_connect_result(enum conn_event 
conn_disconn_evt,
connect_status = WLAN_STATUS_UNSPECIFIED_FAILURE;
wilc_wlan_set_bssid(priv->dev, null_bssid,
STATION_MODE);
-   eth_zero_addr(wilc_connected_ssid);
 
if (!wfi_drv->p2p_connect)
wlan_channel = INVALID_CHANNEL;
@@ -521,7 +520,6 @@ static void cfg_connect_result(enum conn_event 
conn_disconn_evt,
wilc_ie = false;
eth_zero_addr(priv->associated_bss);
wilc_wlan_set_bssid(priv->dev, null_bssid, STATION_MODE);
-   eth_zero_addr(wilc_connected_ssid);
 
if (!wfi_drv->p2p_connect)
wlan_channel = INVALID_CHANNE

[PATCH v3 27/29] staging: wilc1000: use usleep_range() in place of udelay()

2018-09-24 Thread Ajay Singh
Changes to avoid the below checkpatch warning:

'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 0ec0d9b..a48c906 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -412,7 +412,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, 400);
wilc->hif_func->hif_read_reg(wilc, 0xf0, ®);
do {
wilc->hif_func->hif_write_reg(wilc, 0xf0,
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 24/29] staging: wilc1000: remove p2p related static variables to wilc_vif struct

2018-09-24 Thread Ajay Singh
Avoid use of static variable and move them as part of private
data(wilc_priv) struct.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/linux_wlan.c |  2 +
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 60 +++
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  7 +++
 3 files changed, 38 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 560c168..695d5b2 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -729,6 +729,7 @@ static int wilc_mac_open(struct net_device *ndev)
 {
struct wilc_vif *vif = netdev_priv(ndev);
struct wilc *wl = vif->wilc;
+   struct wilc_priv *priv = wdev_priv(vif->ndev->ieee80211_ptr);
unsigned char mac_add[ETH_ALEN] = {0};
int ret = 0;
int i = 0;
@@ -782,6 +783,7 @@ static int wilc_mac_open(struct net_device *ndev)
 vif->frame_reg[1].reg);
netif_wake_queue(ndev);
wl->open_ifcs++;
+   priv->p2p.local_random = 0x01;
vif->mac_opened = 1;
return 0;
 }
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 1a4d262..4fd 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -137,10 +137,7 @@ struct p2p_mgmt_data {
 static u8 wlan_channel = INVALID_CHANNEL;
 static u8 curr_channel;
 static u8 p2p_oui[] = {0x50, 0x6f, 0x9A, 0x09};
-static u8 p2p_local_random = 0x01;
-static u8 p2p_recv_random;
 static u8 p2p_vendor_spec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03};
-static bool wilc_ie;
 
 static struct ieee80211_supported_band wilc_band_2ghz = {
.channels = ieee80211_2ghz_channels,
@@ -515,9 +512,9 @@ static void cfg_connect_result(enum conn_event 
conn_disconn_evt,
GFP_KERNEL);
} else if (conn_disconn_evt == CONN_DISCONN_EVENT_DISCONN_NOTIF) {
vif->obtaining_ip = false;
-   p2p_local_random = 0x01;
-   p2p_recv_random = 0x00;
-   wilc_ie = false;
+   priv->p2p.local_random = 0x01;
+   priv->p2p.recv_random = 0x00;
+   priv->p2p.is_wilc_ie = false;
eth_zero_addr(priv->associated_bss);
wilc_wlan_set_bssid(priv->dev, null_bssid, STATION_MODE);
 
@@ -829,9 +826,9 @@ static int disconnect(struct wiphy *wiphy, struct 
net_device *dev,
wlan_channel = INVALID_CHANNEL;
wilc_wlan_set_bssid(priv->dev, null_bssid, STATION_MODE);
 
-   p2p_local_random = 0x01;
-   p2p_recv_random = 0x00;
-   wilc_ie = false;
+   priv->p2p.local_random = 0x01;
+   priv->p2p.recv_random = 0x00;
+   priv->p2p.is_wilc_ie = false;
wfi_drv->p2p_timeout = 0;
 
ret = wilc_disconnect(vif, reason_code);
@@ -1330,20 +1327,21 @@ static void wilc_wfi_cfg_parse_rx_vendor_spec(struct 
wilc_priv *priv, u8 *buff,
struct wilc_vif *vif = netdev_priv(priv->dev);
 
subtype = buff[P2P_PUB_ACTION_SUBTYPE];
-   if ((subtype == GO_NEG_REQ || subtype == GO_NEG_RSP) && !wilc_ie) {
+   if ((subtype == GO_NEG_REQ || subtype == GO_NEG_RSP) &&
+   !priv->p2p.is_wilc_ie) {
for (i = P2P_PUB_ACTION_SUBTYPE; i < size; i++) {
if (!memcmp(p2p_vendor_spec, &buff[i], 6)) {
-   p2p_recv_random = buff[i + 6];
-   wilc_ie = true;
+   priv->p2p.recv_random = buff[i + 6];
+   priv->p2p.is_wilc_ie = true;
break;
}
}
}
 
-   if (p2p_local_random <= p2p_recv_random) {
+   if (priv->p2p.local_random <= priv->p2p.recv_random) {
netdev_dbg(vif->ndev,
   "PEER WILL BE GO LocaRand=%02x RecvRand %02x\n",
-  p2p_local_random, p2p_recv_random);
+  priv->p2p.local_random, priv->p2p.recv_random);
return;
}
 
@@ -1411,7 +1409,7 @@ void wilc_wfi_p2p_rx(struct net_device *dev, u8 *buff, 
u32 size)
  size);
 
if ((subtype == GO_NEG_REQ || subtype == GO_NEG_RSP) &&
-   wilc_ie)
+   priv->p2p.is_wilc_ie)
size -= 7;
 
break;
@@ -1503,7 +1501,8 @@ static int cancel_remain_on_channel(struct wiphy *wiphy,
priv->remain_on_ch_params.listen_session_id);
 }
 
-static void wilc_wfi_cfg_tx_vendor_spec(struct p

[PATCH v3 26/29] staging: wilc1000: remove unnecessary option used with ccflags-y in Makefile

2018-09-24 Thread Ajay Singh
Cleanup patch to remove -I(src) and -DWILC_ASIC_A0 option used in
ccflag-y in Makefile.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/Makefile | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/wilc1000/Makefile 
b/drivers/staging/wilc1000/Makefile
index 5718bc4..37e8560 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -4,8 +4,6 @@ obj-$(CONFIG_WILC1000) += wilc1000.o
 ccflags-y += -DFIRMWARE_1002=\"atmel/wilc1002_firmware.bin\" \
-DFIRMWARE_1003=\"atmel/wilc1003_firmware.bin\"
 
-ccflags-y += -I$(src)/ -DWILC_ASIC_A0
-
 wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \
coreconfigurator.o host_interface.o \
wilc_wlan_cfg.o wilc_wlan.o
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 23/29] staging: wilc1000: remove unnecessary memset in sdio_init() & wilc_spi_init()

2018-09-24 Thread Ajay Singh
Cleanup changes to avoid unnecessary setting 'wilc->bus_data' value to
zero as the buffer was allocated using kzalloc().

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_sdio.c | 4 +---
 drivers/staging/wilc1000/wilc_spi.c  | 3 ---
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
b/drivers/staging/wilc1000/wilc_sdio.c
index 7ef047c..ca351c9 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -689,10 +689,8 @@ static int sdio_init(struct wilc *wilc, bool resume)
int loop, ret;
u32 chipid;
 
-   if (!resume) {
-   memset(sdio_priv, 0, sizeof(struct wilc_sdio));
+   if (!resume)
sdio_priv->irq_gpio = wilc->dev_irq_num;
-   }
 
/**
 *  function 0 csa enable
diff --git a/drivers/staging/wilc1000/wilc_spi.c 
b/drivers/staging/wilc1000/wilc_spi.c
index 2559cf0..cef127b 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -838,12 +838,9 @@ static int wilc_spi_init(struct wilc *wilc, bool resume)
return 1;
}
 
-   memset(spi_priv, 0, sizeof(struct wilc_spi));
-
/*
 * configure protocol
 */
-   spi_priv->crc_off = 0;
 
/*
 * TODO: We can remove the CRC trials if there is a definite
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 25/29] staging: wilc1000: remove wilc_debugfs.c file as its not used

2018-09-24 Thread Ajay Singh
Deleted wilc_debugfs.c file as it's not used.

Earlier discussion link:
[1]. https://www.spinics.net/lists/linux-wireless/msg176076.html

Suggested-by: Greg KH 
Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/Makefile   |   5 +-
 drivers/staging/wilc1000/wilc_debugfs.c | 115 
 2 files changed, 2 insertions(+), 118 deletions(-)
 delete mode 100644 drivers/staging/wilc1000/wilc_debugfs.c

diff --git a/drivers/staging/wilc1000/Makefile 
b/drivers/staging/wilc1000/Makefile
index ee7e26b..5718bc4 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -4,12 +4,11 @@ obj-$(CONFIG_WILC1000) += wilc1000.o
 ccflags-y += -DFIRMWARE_1002=\"atmel/wilc1002_firmware.bin\" \
-DFIRMWARE_1003=\"atmel/wilc1003_firmware.bin\"
 
-ccflags-y += -I$(src)/ -DWILC_ASIC_A0 -DWILC_DEBUGFS
+ccflags-y += -I$(src)/ -DWILC_ASIC_A0
 
 wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \
coreconfigurator.o host_interface.o \
-   wilc_wlan_cfg.o wilc_debugfs.o \
-   wilc_wlan.o
+   wilc_wlan_cfg.o wilc_wlan.o
 
 obj-$(CONFIG_WILC1000_SDIO) += wilc1000-sdio.o
 wilc1000-sdio-objs += wilc_sdio.o
diff --git a/drivers/staging/wilc1000/wilc_debugfs.c 
b/drivers/staging/wilc1000/wilc_debugfs.c
deleted file mode 100644
index 8001df6..000
--- a/drivers/staging/wilc1000/wilc_debugfs.c
+++ /dev/null
@@ -1,115 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries.
- * All rights reserved.
- */
-
-#if defined(WILC_DEBUGFS)
-#include 
-#include 
-
-#include "wilc_wlan_if.h"
-
-static struct dentry *wilc_dir;
-
-#define DEBUG   BIT(0)
-#define INFOBIT(1)
-#define WRN BIT(2)
-#define ERR BIT(3)
-
-#define DBG_LEVEL_ALL  (DEBUG | INFO | WRN | ERR)
-static atomic_t WILC_DEBUG_LEVEL = ATOMIC_INIT(ERR);
-EXPORT_SYMBOL_GPL(WILC_DEBUG_LEVEL);
-
-static ssize_t wilc_debug_level_read(struct file *file, char __user *userbuf,
-size_t count, loff_t *ppos)
-{
-   char buf[128];
-   int res = 0;
-
-   /* only allow read from start */
-   if (*ppos > 0)
-   return 0;
-
-   res = scnprintf(buf, sizeof(buf), "Debug Level: %x\n",
-   atomic_read(&WILC_DEBUG_LEVEL));
-
-   return simple_read_from_buffer(userbuf, count, ppos, buf, res);
-}
-
-static ssize_t wilc_debug_level_write(struct file *filp,
- const char __user *buf, size_t count,
- loff_t *ppos)
-{
-   int flag = 0;
-   int ret;
-
-   ret = kstrtouint_from_user(buf, count, 16, &flag);
-   if (ret)
-   return ret;
-
-   if (flag > DBG_LEVEL_ALL) {
-   pr_info("%s, value (0x%08x) is out of range, stay previous flag 
(0x%08x)\n",
-   __func__, flag, atomic_read(&WILC_DEBUG_LEVEL));
-   return -EINVAL;
-   }
-
-   atomic_set(&WILC_DEBUG_LEVEL, (int)flag);
-
-   if (flag == 0)
-   pr_info("Debug-level disabled\n");
-   else
-   pr_info("Debug-level enabled\n");
-
-   return count;
-}
-
-#define FOPS(_open, _read, _write, _poll) { \
-   .owner  = THIS_MODULE, \
-   .open   = (_open), \
-   .read   = (_read), \
-   .write  = (_write), \
-   .poll   = (_poll), \
-}
-
-struct wilc_debugfs_info_t {
-   const char *name;
-   int perm;
-   unsigned int data;
-   const struct file_operations fops;
-};
-
-static struct wilc_debugfs_info_t debugfs_info[] = {
-   {
-   "wilc_debug_level",
-   0666,
-   (DEBUG | ERR),
-   FOPS(NULL, wilc_debug_level_read, wilc_debug_level_write, NULL),
-   },
-};
-
-static int __init wilc_debugfs_init(void)
-{
-   int i;
-   struct wilc_debugfs_info_t *info;
-
-   wilc_dir = debugfs_create_dir("wilc_wifi", NULL);
-   for (i = 0; i < ARRAY_SIZE(debugfs_info); i++) {
-   info = &debugfs_info[i];
-   debugfs_create_file(info->name,
-   info->perm,
-   wilc_dir,
-   &info->data,
-   &info->fops);
-   }
-   return 0;
-}
-module_init(wilc_debugfs_init);
-
-static void __exit wilc_debugfs_remove(void)
-{
-   debugfs_remove_recursive(wilc_dir);
-}
-module_exit(wilc_debugfs_remove);
-
-#endif
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 28/29] staging: wilc1000: refactor wilc_set_multicast_list() function

2018-09-24 Thread Ajay Singh
Refactor wilc_set_multicast_list() by making below changes:
o use kmalloc_array
o remove unnecessary res
o add u8 *cur_mc
o use i as index
o use '%pM' extension in netdev_dbg()

The below checkpatch issue is also resolved after code refactor.
'spaces preferred around that '/' (ctx:VxV)'

Suggested-by: Joe Perches 
Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/linux_wlan.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 695d5b2..3ac82a1 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -799,9 +799,9 @@ static void wilc_set_multicast_list(struct net_device *dev)
 {
struct netdev_hw_addr *ha;
struct wilc_vif *vif = netdev_priv(dev);
-   int i = 0;
+   int i;
u8 *mc_list;
-   int res;
+   u8 *cur_mc;
 
if (dev->flags & IFF_PROMISC)
return;
@@ -817,20 +817,20 @@ static void wilc_set_multicast_list(struct net_device 
*dev)
return;
}
 
-   mc_list = kmalloc(dev->mc.count * ETH_ALEN, GFP_KERNEL);
+   mc_list = kmalloc_array(dev->mc.count, ETH_ALEN, GFP_KERNEL);
if (!mc_list)
return;
 
+   cur_mc = mc_list;
+   i = 0;
netdev_for_each_mc_addr(ha, dev) {
-   memcpy(mc_list + i, ha->addr, ETH_ALEN);
-   netdev_dbg(dev, "Entry[%d]: %x:%x:%x:%x:%x:%x\n", i/ETH_ALEN,
-  mc_list[i], mc_list[i + 1], mc_list[i + 2],
-  mc_list[i + 3], mc_list[i + 4], mc_list[i + 5]);
-   i += ETH_ALEN;
+   memcpy(cur_mc, ha->addr, ETH_ALEN);
+   netdev_dbg(dev, "Entry[%d]: %pM\n", i, cur_mc);
+   i++;
+   cur_mc += ETH_ALEN;
}
 
-   res = wilc_setup_multicast_filter(vif, true, dev->mc.count, mc_list);
-   if (res)
+   if (wilc_setup_multicast_filter(vif, true, dev->mc.count, mc_list))
kfree(mc_list);
 }
 
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 29/29] staging: wilc1000: return exact error of register_netdev() from wilc_netdev_init()

2018-09-24 Thread Ajay Singh
Refactor wilc_netdev_init() to return the error code received from
register_netdev() during the failure condition.

Earlier discussion link
[1]. https://www.spinics.net/lists/linux-wireless/msg177304.html

Suggested-by: Claudiu Beznea 
Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/linux_wlan.c | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 3ac82a1..9ee04ea 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1065,7 +1065,8 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
if (!wl)
return -ENOMEM;
 
-   if (wilc_wlan_cfg_init(wl))
+   ret = wilc_wlan_cfg_init(wl);
+   if (ret)
goto free_wl;
 
*wilc = wl;
@@ -1077,8 +1078,10 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
INIT_LIST_HEAD(&wl->rxq_head.list);
 
wl->hif_workqueue = create_singlethread_workqueue("WILC_wq");
-   if (!wl->hif_workqueue)
+   if (!wl->hif_workqueue) {
+   ret = -ENOMEM;
goto free_cfg;
+   }
 
register_inetaddr_notifier(&g_dev_notifier);
 
@@ -1086,8 +1089,10 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
struct wireless_dev *wdev;
 
ndev = alloc_etherdev(sizeof(struct wilc_vif));
-   if (!ndev)
+   if (!ndev) {
+   ret = -ENOMEM;
goto free_ndev;
+   }
 
vif = netdev_priv(ndev);
memset(vif, 0, sizeof(struct wilc_vif));
@@ -1110,6 +1115,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
wdev = wilc_create_wiphy(ndev, dev);
if (!wdev) {
netdev_err(ndev, "Can't register WILC Wiphy\n");
+   ret = -ENOMEM;
goto free_ndev;
}
 
@@ -1151,7 +1157,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
wilc_wlan_cfg_deinit(wl);
 free_wl:
kfree(wl);
-   return -ENOMEM;
+   return ret;
 }
 EXPORT_SYMBOL_GPL(wilc_netdev_init);
 
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: feedback on mainlining wilc1000 staging driver

2018-09-26 Thread Ajay Singh
Hi Kalle,

On Thu, 23 Aug 2018 16:37:45 +0530
Kalle Valo  wrote:

> Ajay Singh  writes:
> 
> >> >>> We need help to review and identify if there are any pending
> >> >>> items for wilc1000 driver, so we can address those issues and
> >> >>> make it ready to move to the wireless subsystem.
> >> >>
> >> >> I think the best way to get that forward is to submit a patch
> >> >> (or patchset) to linux-wireless, that's the easiest for
> >> >> reviewers.
> >> >
> >> > For brcm80211 drivers we used a single patch introducing it under
> >> > the wireless drivers folder. Because it was quite a sizable
> >> > patch we parked it on the wireless wiki page. Had a few
> >> > iterations doing it like that.
> >> 
> >> Another option is to split it so that there's one patch per file,
> >> should be even pretty easy to automate that. It's just so much
> >> easier to comment on a patch submitted by email compared to the
> >> reviewer manually copying code and then commenting it, yuck.
> >>   
> >
> > Sure. I will prepare a patch per file send for review as its easy to
> > review.
> >
> > As Greg suggested, I will wait for the merge window to close and
> > after completing pending patches to staging, I will start the
> > review.
> >
> > For my understanding, the patches for review will be based on
> > wireless-testing branch.  
> 
> In this case I think wireless-drivers-next is the safest choise,
> wireless-testing also has other trees which might cause conflicts etc.

I have submitted a patch series for wilc1000 driver, single file
per patch and its based on wireless-drivers-next. 
I hope its done correctly, please provide inputs so we can
address and make this driver ready for mainline.

Regards,
Ajay

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 00/29] staging: wilc1000: avoid static variables and cleanup changes

2018-10-01 Thread Ajay Singh
Hi Dan,

On Mon, 1 Oct 2018 10:47:34 +0300
Dan Carpenter  wrote:

> On Tue, Sep 25, 2018 at 11:53:15AM +0530, Ajay Singh wrote:
> > This patch series contains changes to avoid the use of static
> > variables. Cleanup changes to fix some checkpatch issues and return
> > void for function if their return value is not used.
> > Also deleted 'wilc_debugfs.c' file as it's not used.
> > 
> > Changes since v2:
> >Included Joe's suggestion for patch#28
> > - replaced previous patch with an improved version(refactor
> > code)
> > 
> > Changes since v1:
> >Address Dan's comment for patch#29
> > - return the correct error for failure in the second iteration  
> 
> Btw, I hate re-reviewing patches and I know everyone hates sending
> them. If someone complains about a 28/29 or a 29/29, then you can
> just ask Greg to apply the first 27 and redo the others in a follow
> on patchset.
> 
Sure, I will keep this point in mind while sending the series updates.

Regards
Ajay

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: feedback on mainlining wilc1000 staging driver

2018-10-04 Thread Ajay Singh
Hi Kalle,

On Thu, 4 Oct 2018 15:27:57 +0300
Kalle Valo  wrote:

> Ajay Singh  writes:
> 
> > Hi Kalle,
> >
> > On Thu, 23 Aug 2018 16:37:45 +0530
> > Kalle Valo  wrote:
> >
> >> Ajay Singh  writes:
> >> 
> >> >> >>> We need help to review and identify if there are any pending
> >> >> >>> items for wilc1000 driver, so we can address those issues
> >> >> >>> and make it ready to move to the wireless subsystem.
> >> >> >>
> >> >> >> I think the best way to get that forward is to submit a patch
> >> >> >> (or patchset) to linux-wireless, that's the easiest for
> >> >> >> reviewers.
> >> >> >
> >> >> > For brcm80211 drivers we used a single patch introducing it
> >> >> > under the wireless drivers folder. Because it was quite a
> >> >> > sizable patch we parked it on the wireless wiki page. Had a
> >> >> > few iterations doing it like that.
> >> >> 
> >> >> Another option is to split it so that there's one patch per
> >> >> file, should be even pretty easy to automate that. It's just so
> >> >> much easier to comment on a patch submitted by email compared
> >> >> to the reviewer manually copying code and then commenting it,
> >> >> yuck. 
> >> >
> >> > Sure. I will prepare a patch per file send for review as its
> >> > easy to review.
> >> >
> >> > As Greg suggested, I will wait for the merge window to close and
> >> > after completing pending patches to staging, I will start the
> >> > review.
> >> >
> >> > For my understanding, the patches for review will be based on
> >> > wireless-testing branch.  
> >> 
> >> In this case I think wireless-drivers-next is the safest choise,
> >> wireless-testing also has other trees which might cause conflicts
> >> etc.
> >
> > I have submitted a patch series for wilc1000 driver, single file
> > per patch and its based on wireless-drivers-next. 
> > I hope its done correctly, please provide inputs so we can
> > address and make this driver ready for mainline.
> 
> Thanks, I see it in patchwork:
> 
> https://patchwork.kernel.org/project/linux-wireless/list/?series=23251&state=*&order=date
> 
> Do note that we have also another new driver (rtwlan/rtw88) under
> review so review from the wireless folks might take some time.
> 

Thanks for the update.
Btw I could see our driver was added to the pending branch. Just
curious, could you please share details about how the pending branch is
used ?

Regards,
Ajay
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 06/12] staging: wilc1000: rename wilc_enqueue_cmd() to wilc_enqueue_work()

2018-06-25 Thread Ajay Singh
Rename wilc_enqueue_cmd() to wilc_enqueue_work() because its used to
enqueue the work queue. Also removed the function header comment for
wilc_enqueue_cmd() as its not correct.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 17c20b9..6d27a9d 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -227,13 +227,7 @@ wilc_alloc_work(struct wilc_vif *vif, void 
(*work_fun)(struct work_struct *),
return msg;
 }
 
-/*!
- *  @authorsyounan
- *  @date  1 Sep 2010
- *  @note  copied from FLO glue implementatuion
- *  @version   1.0
- */
-static int wilc_enqueue_cmd(struct host_if_msg *msg)
+static int wilc_enqueue_work(struct host_if_msg *msg)
 {
INIT_WORK(&msg->work, msg->fn);
if (!hif_workqueue || !queue_work(hif_workqueue, &msg->work))
@@ -903,7 +897,7 @@ static void handle_connect(struct work_struct *work)
struct host_if_drv *hif_drv = vif->hif_drv;
 
if (msg->vif->hif_drv->usr_scan_req.scan_result) {
-   result = wilc_enqueue_cmd(msg);
+   result = wilc_enqueue_work(msg);
if (result)
goto error;
 
@@ -2353,7 +2347,7 @@ static void listen_timer_cb(struct timer_list *t)
 
msg->body.remain_on_ch.id = vif->hif_drv->remain_on_ch.id;
 
-   result = wilc_enqueue_cmd(msg);
+   result = wilc_enqueue_work(msg);
if (result) {
netdev_err(vif->ndev, "wilc_mq_send fail\n");
kfree(msg);
@@ -2521,7 +2515,7 @@ static void timer_scan_cb(struct timer_list *t)
if (IS_ERR(msg))
return;
 
-   result = wilc_enqueue_cmd(msg);
+   result = wilc_enqueue_work(msg);
if (result)
kfree(msg);
 }
@@ -2538,7 +2532,7 @@ static void timer_connect_cb(struct timer_list *t)
if (IS_ERR(msg))
return;
 
-   result = wilc_enqueue_cmd(msg);
+   result = wilc_enqueue_work(msg);
if (result)
kfree(msg);
 }
@@ -2563,7 +2557,7 @@ int wilc_remove_wep_key(struct wilc_vif *vif, u8 index)
msg->body.key_info.action = REMOVEKEY;
msg->body.key_info.attr.wep.index = index;
 
-   result = wilc_enqueue_cmd(msg);
+   result = wilc_enqueue_work(msg);
if (result)
netdev_err(vif->ndev, "Request to remove WEP key\n");
else
@@ -2593,7 +2587,7 @@ int wilc_set_wep_default_keyid(struct wilc_vif *vif, u8 
index)
msg->body.key_info.action = DEFAULTKEY;
msg->body.key_info.attr.wep.index = index;
 
-   result = wilc_enqueue_cmd(msg);
+   result = wilc_enqueue_work(msg);
if (result)
netdev_err(vif->ndev, "Default key index\n");
else
@@ -2630,7 +2624,7 @@ int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const 
u8 *key, u8 len,
msg->body.key_info.attr.wep.key_len = len;
msg->body.key_info.attr.wep.index = index;
 
-   result = wilc_enqueue_cmd(msg);
+   result = wilc_enqueue_work(msg);
if (result)
goto free_key;
 
@@ -2675,7 +2669,7 @@ int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, const 
u8 *key, u8 len,
msg->body.key_info.attr.wep.mode = mode;
msg->body.key_info.attr.wep.auth_type = auth_type;
 
-   result = wilc_enqueue_cmd(msg);
+   result = wilc_enqueue_work(msg);
if (result)
goto free_key;
 
@@ -2741,7 +2735,7 @@ int wilc_add_ptk(struct wilc_vif *vif, const u8 *ptk, u8 
ptk_key_len,
msg->body.key_info.attr.wpa.mac_addr = mac_addr;
msg->body.key_info.attr.wpa.mode = cipher_mode;
 
-   result = wilc_enqueue_cmd(msg);
+   result = wilc_enqueue_work(msg);
if (result) {
netdev_err(vif->ndev, "PTK Key\n");
goto free_key;
@@ -2821,7 +2815,7 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 
*rx_gtk, u8 gtk_key_len,
msg->body.key_info.attr.wpa.key_len = key_len;
msg->body.key_info.attr.wpa.seq_len = key_rsc_len;
 
-   result = wilc_enqueue_cmd(msg);
+   result = wilc_enqueue_work(msg);
if (result) {
netdev_err(vif->ndev, "RX GTK\n");
goto free_key;
@@ -2863,7 +2857,7 @@ int wilc_set_pmkid_info(struct wilc_vif *vif,
   &pmkid->pmkidlist[i].pmkid, PMKID_LEN);
}
 
-   result = wilc_enqueue_cmd(msg);
+   result = wilc_enqueue_work(msg);
if (result) {
netdev_err(vif->ndev, "PMKID Info\n");
kfree(msg);
@@ -2883,7 +2877,7 @@ int wilc_get_

  1   2   3   4   5   6   7   >