Commit daf0483e authored by Ajay Singh's avatar Ajay Singh Committed by Greg Kroah-Hartman

staging: wilc1000: handle station dump cfg ops from cfg80211 context

Refactor code to handle dump_station() callback from cfg80211 context.
Instead of deferring issue of wid command now send it directly from cfg
context. Also making use of wilc_get_rssi() error status in case there
is a failure to post the wid command to the firmware.
Signed-off-by: default avatarAjay Singh <ajay.kathat@microchip.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 53239171
......@@ -1678,27 +1678,6 @@ void wilc_resolve_disconnect_aberration(struct wilc_vif *vif)
wilc_disconnect(vif, 1);
}
static void handle_get_rssi(struct work_struct *work)
{
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
int result;
struct wid wid;
wid.id = WID_RSSI;
wid.type = WID_CHAR;
wid.val = msg->body.data;
wid.size = sizeof(char);
result = wilc_send_config_pkt(vif, WILC_GET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result)
netdev_err(vif->ndev, "Failed to get RSSI value\n");
complete(&msg->work_comp);
/* free 'msg' data in caller */
}
static void handle_get_statistics(struct work_struct *work)
{
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
......@@ -2620,34 +2599,22 @@ s32 wilc_get_inactive_time(struct wilc_vif *vif, const u8 *mac,
int wilc_get_rssi(struct wilc_vif *vif, s8 *rssi_level)
{
struct wid wid;
int result;
struct host_if_msg *msg;
if (!rssi_level) {
netdev_err(vif->ndev, "%s: RSSI level is NULL\n", __func__);
return -EFAULT;
}
msg = wilc_alloc_work(vif, handle_get_rssi, true);
if (IS_ERR(msg))
return PTR_ERR(msg);
msg->body.data = kzalloc(sizeof(s8), GFP_KERNEL);
if (!msg->body.data) {
kfree(msg);
return -ENOMEM;
}
result = wilc_enqueue_work(msg);
if (result) {
netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
} else {
wait_for_completion(&msg->work_comp);
*rssi_level = *msg->body.data;
}
kfree(msg->body.data);
kfree(msg);
wid.id = WID_RSSI;
wid.type = WID_CHAR;
wid.size = sizeof(char);
wid.val = rssi_level;
result = wilc_send_config_pkt(vif, WILC_GET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result)
netdev_err(vif->ndev, "Failed to get RSSI value\n");
return result;
}
......
......@@ -1659,13 +1659,16 @@ static int dump_station(struct wiphy *wiphy, struct net_device *dev,
{
struct wilc_priv *priv = wiphy_priv(wiphy);
struct wilc_vif *vif = netdev_priv(priv->dev);
int ret;
if (idx != 0)
return -ENOENT;
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL);
wilc_get_rssi(vif, &sinfo->signal);
ret = wilc_get_rssi(vif, &sinfo->signal);
if (ret)
return ret;
memcpy(mac, priv->associated_bss, ETH_ALEN);
return 0;
......
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