Re: [PATCH] staging: wilc1000: merge drv_handle and operation_mode wids

2019-08-01 Thread Adham.Abozaeid
Hi Greg

On 8/1/19 9:41 AM, Greg KH wrote:
> External E-Mail
>
>
> On Wed, Jul 31, 2019 at 08:58:19PM +, adham.aboza...@microchip.com wrote:
> This patch causes the following build error:
> drivers/staging/wilc1000/wilc_hif.c: In function wilc_deinit:
> drivers/staging/wilc1000/wilc_hif.c:1610:2: error: implicit declaration of 
> function wilc_set_wfi_drv_handler [-Werror=implicit-function-declaration]
>  1610 |  wilc_set_wfi_drv_handler(vif, 0, 0, 0);
>   |  ^~~~
>
> Always test build your patches...
>
Apologies for that!
I'll fix the error and send a new version with both patches clubbed in a patch 
series.

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


Re: [PATCH] staging: wilc1000: merge drv_handle and operation_mode wids

2019-08-01 Thread Greg KH
On Wed, Jul 31, 2019 at 08:58:19PM +, adham.aboza...@microchip.com wrote:
> From: Adham Abozaeid 
> 
> wilc_set_wfi_drv_handler and wilc_set_operation_mode sends the same
> parameters to the FW, so it's better to combine them together.
> 
> Kept wilc_set_wfi_drv_handler implementation since it sends all the
> required parameters, and renamed it to wilc_set_operation_mode to be
> more descriptive.
> 
> Signed-off-by: Adham Abozaeid 
> ---
>  drivers/staging/wilc1000/wilc_hif.c   | 29 ++-
>  drivers/staging/wilc1000/wilc_hif.h   |  5 ++--
>  drivers/staging/wilc1000/wilc_netdev.c|  6 ++--
>  .../staging/wilc1000/wilc_wfi_cfgoperations.c | 24 +++
>  drivers/staging/wilc1000/wilc_wlan_if.h   |  3 +-
>  5 files changed, 20 insertions(+), 47 deletions(-)

This patch causes the following build error:
drivers/staging/wilc1000/wilc_hif.c: In function wilc_deinit:
drivers/staging/wilc1000/wilc_hif.c:1610:2: error: implicit declaration of 
function wilc_set_wfi_drv_handler [-Werror=implicit-function-declaration]
 1610 |  wilc_set_wfi_drv_handler(vif, 0, 0, 0);
  |  ^~~~

Always test build your patches...
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: wilc1000: merge drv_handle and operation_mode wids

2019-07-31 Thread Adham.Abozaeid
From: Adham Abozaeid 

wilc_set_wfi_drv_handler and wilc_set_operation_mode sends the same
parameters to the FW, so it's better to combine them together.

Kept wilc_set_wfi_drv_handler implementation since it sends all the
required parameters, and renamed it to wilc_set_operation_mode to be
more descriptive.

Signed-off-by: Adham Abozaeid 
---
 drivers/staging/wilc1000/wilc_hif.c   | 29 ++-
 drivers/staging/wilc1000/wilc_hif.h   |  5 ++--
 drivers/staging/wilc1000/wilc_netdev.c|  6 ++--
 .../staging/wilc1000/wilc_wfi_cfgoperations.c | 24 +++
 drivers/staging/wilc1000/wilc_wlan_if.h   |  3 +-
 5 files changed, 20 insertions(+), 47 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_hif.c 
b/drivers/staging/wilc1000/wilc_hif.c
index f8646ea3b0c4..ca252a43cd8c 100644
--- a/drivers/staging/wilc1000/wilc_hif.c
+++ b/drivers/staging/wilc1000/wilc_hif.c
@@ -1409,18 +1409,15 @@ int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 
channel)
return result;
 }
 
-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, int index, u8 mode,
+   u8 ifc_id)
 {
struct wid wid;
-   struct host_if_drv *hif_drv = vif->hif_drv;
int result;
struct wilc_drv_handler drv;
 
-   if (!hif_drv)
-   return -EFAULT;
 
-   wid.id = WID_SET_DRV_HANDLER;
+   wid.id = WID_SET_OPERATION_MODE;
wid.type = WID_STR;
wid.size = sizeof(drv);
wid.val = (u8 *)
@@ -1435,26 +1432,6 @@ int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int 
index, u8 mode,
return result;
 }
 
-int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode)
-{
-   struct wid wid;
-   struct wilc_op_mode op_mode;
-   int result;
-
-   wid.id = WID_SET_OPERATION_MODE;
-   wid.type = WID_INT;
-   wid.size = sizeof(op_mode);
-   wid.val = (u8 *)_mode;
-
-   op_mode.mode = cpu_to_le32(mode);
-
-   result = wilc_send_config_pkt(vif, WILC_SET_CFG, , 1);
-   if (result)
-   netdev_err(vif->ndev, "Failed to set operation mode\n");
-
-   return result;
-}
-
 s32 wilc_get_inactive_time(struct wilc_vif *vif, const u8 *mac, u32 *out_val)
 {
struct wid wid;
diff --git a/drivers/staging/wilc1000/wilc_hif.h 
b/drivers/staging/wilc1000/wilc_hif.h
index be1d2497cde9..3bc305151651 100644
--- a/drivers/staging/wilc1000/wilc_hif.h
+++ b/drivers/staging/wilc1000/wilc_hif.h
@@ -219,9 +219,8 @@ int wilc_remain_on_channel(struct wilc_vif *vif, u64 cookie,
   void *user_arg);
 int wilc_listen_state_expired(struct wilc_vif *vif, u64 cookie);
 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);
+int wilc_set_operation_mode(struct wilc_vif *vif, int index, u8 mode,
+   u8 ifc_id);
 int wilc_get_statistics(struct wilc_vif *vif, struct rf_info *stats);
 void wilc_resolve_disconnect_aberration(struct wilc_vif *vif);
 int wilc_get_vif_idx(struct wilc_vif *vif);
diff --git a/drivers/staging/wilc1000/wilc_netdev.c 
b/drivers/staging/wilc1000/wilc_netdev.c
index 68129a0ba55f..bd848fdf7f8a 100644
--- a/drivers/staging/wilc1000/wilc_netdev.c
+++ b/drivers/staging/wilc1000/wilc_netdev.c
@@ -626,10 +626,8 @@ static int wilc_mac_open(struct net_device *ndev)
return ret;
}
 
-   wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif), vif->iftype,
-vif->idx);
-   wilc_set_operation_mode(vif, vif->iftype);
-
+   wilc_set_operation_mode(vif, wilc_get_vif_idx(vif),
+vif->iftype, vif->idx);
wilc_get_mac_address(vif, mac_add);
netdev_dbg(ndev, "Mac address: %pM\n", mac_add);
ether_addr_copy(ndev->dev_addr, mac_add);
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index e2d9efed36b0..cf661e8ab1c8 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1419,7 +1419,8 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
if (vif->iftype == WILC_AP_MODE || vif->iftype == WILC_GO_MODE)
wilc_wfi_deinit_mon_interface(wl, true);
vif->iftype = WILC_STATION_MODE;
-   wilc_set_operation_mode(vif, WILC_STATION_MODE);
+   wilc_set_operation_mode(vif, wilc_get_vif_idx(vif),
+WILC_STATION_MODE, vif->idx);
 
memset(priv->assoc_stainfo.sta_associated_bss, 0,
   WILC_MAX_NUM_STA * ETH_ALEN);
@@ -1431,8 +1432,8 @@ static int