Commit 4b1b8b08 authored by Adham Abozaeid's avatar Adham Abozaeid Committed by Greg Kroah-Hartman

staging: wilc1000: merge drv_handle and operation_mode wids

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: default avatarAdham Abozaeid <adham.abozaeid@microchip.com>
Link: https://lore.kernel.org/r/20190801200909.12605-2-adham.abozaeid@microchip.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b7a40c32
......@@ -1409,18 +1409,14 @@ 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 *)&drv;
......@@ -1435,26 +1431,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 *)&op_mode;
op_mode.mode = cpu_to_le32(mode);
result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 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;
......@@ -1630,8 +1606,6 @@ 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);
if (hif_drv->usr_scan_req.scan_result) {
hif_drv->usr_scan_req.scan_result(SCAN_EVENT_ABORTED, NULL,
hif_drv->usr_scan_req.arg);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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 change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
priv->wdev.iftype = type;
vif->monitor_flag = 0;
vif->iftype = WILC_CLIENT_MODE;
wilc_set_operation_mode(vif, WILC_STATION_MODE);
wilc_set_operation_mode(vif, wilc_get_vif_idx(vif),
WILC_STATION_MODE, vif->idx);
break;
case NL80211_IFTYPE_AP:
......@@ -1440,18 +1441,17 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
priv->wdev.iftype = type;
vif->iftype = WILC_AP_MODE;
if (wl->initialized) {
wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif),
0, vif->idx);
wilc_set_operation_mode(vif, WILC_AP_MODE);
}
if (wl->initialized)
wilc_set_operation_mode(vif, wilc_get_vif_idx(vif),
WILC_AP_MODE, vif->idx);
break;
case NL80211_IFTYPE_P2P_GO:
wilc_set_operation_mode(vif, WILC_AP_MODE);
dev->ieee80211_ptr->iftype = type;
priv->wdev.iftype = type;
vif->iftype = WILC_GO_MODE;
wilc_set_operation_mode(vif, wilc_get_vif_idx(vif),
WILC_AP_MODE, vif->idx);
break;
default:
......@@ -1659,16 +1659,16 @@ static int del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev)
vif->monitor_flag = 0;
mutex_lock(&wl->vif_mutex);
wilc_set_wfi_drv_handler(vif, 0, 0, 0);
for (i = vif->idx; i < wl->vif_num ; i++) {
wilc_set_operation_mode(vif, 0, 0, 0);
for (i = vif->idx; i < wl->vif_num; i++) {
if ((i + 1) >= wl->vif_num) {
wl->vif[i] = NULL;
} else {
vif = wl->vif[i + 1];
vif->idx = i;
wl->vif[i] = vif;
wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif),
vif->iftype, vif->idx);
wilc_set_operation_mode(vif, wilc_get_vif_idx(vif),
vif->iftype, vif->idx);
}
}
wl->vif_num--;
......
......@@ -724,7 +724,6 @@ enum {
/* NMAC Integer WID list */
/* Custom Integer WID list */
WID_GET_INACTIVE_TIME = 0x2084,
WID_SET_OPERATION_MODE = 0X2086,
/* EMAC String WID list */
WID_SSID = 0x3000,
WID_FIRMWARE_VERSION = 0x3001,
......@@ -755,9 +754,9 @@ enum {
WID_MODEL_NAME = 0x3027, /*Added for CAPI tool */
WID_MODEL_NUM = 0x3028, /*Added for CAPI tool */
WID_DEVICE_NAME = 0x3029, /*Added for CAPI tool */
WID_SET_DRV_HANDLER = 0x3079,
/* NMAC String WID list */
WID_SET_OPERATION_MODE = 0x3079,
WID_11N_P_ACTION_REQ = 0x3080,
WID_HUT_TEST_ID = 0x3081,
WID_PMKID_INFO = 0x3082,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment