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

staging: wilc1000: handle tx power related callback from cfg80211 context

Avoid the use of internal work queue to defer the handling of tx power
related cfg operations callback. Now issuing the wid command to firmware
directly from the caller context.
Signed-off-by: default avatarAjay Singh <ajay.kathat@microchip.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6dea3302
...@@ -117,10 +117,6 @@ struct sta_inactive_t { ...@@ -117,10 +117,6 @@ struct sta_inactive_t {
u8 mac[6]; u8 mac[6];
}; };
struct tx_power {
u8 tx_pwr;
};
union message_body { union message_body {
struct scan_attr scan_info; struct scan_attr scan_info;
struct connect_attr con_info; struct connect_attr con_info;
...@@ -145,7 +141,6 @@ union message_body { ...@@ -145,7 +141,6 @@ union message_body {
struct reg_frame reg_frame; struct reg_frame reg_frame;
char *data; char *data;
struct del_all_sta del_all_sta_info; struct del_all_sta del_all_sta_info;
struct tx_power tx_power;
}; };
struct host_if_msg { struct host_if_msg {
...@@ -2371,48 +2366,6 @@ static void handle_set_mcast_filter(struct work_struct *work) ...@@ -2371,48 +2366,6 @@ static void handle_set_mcast_filter(struct work_struct *work)
kfree(msg); kfree(msg);
} }
static void handle_set_tx_pwr(struct work_struct *work)
{
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
u8 tx_pwr = msg->body.tx_power.tx_pwr;
int ret;
struct wid wid;
wid.id = WID_TX_POWER;
wid.type = WID_CHAR;
wid.val = &tx_pwr;
wid.size = sizeof(char);
ret = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (ret)
netdev_err(vif->ndev, "Failed to set TX PWR\n");
kfree(msg);
}
/* Note: 'msg' will be free after using data */
static void handle_get_tx_pwr(struct work_struct *work)
{
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
u8 *tx_pwr = &msg->body.tx_power.tx_pwr;
int ret;
struct wid wid;
wid.id = WID_TX_POWER;
wid.type = WID_CHAR;
wid.val = (s8 *)tx_pwr;
wid.size = sizeof(char);
ret = wilc_send_config_pkt(vif, WILC_GET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (ret)
netdev_err(vif->ndev, "Failed to get TX PWR\n");
complete(&msg->work_comp);
}
static void handle_scan_timer(struct work_struct *work) static void handle_scan_timer(struct work_struct *work)
{ {
struct host_if_msg *msg = container_of(work, struct host_if_msg, work); struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
...@@ -3740,19 +3693,15 @@ int wilc_setup_multicast_filter(struct wilc_vif *vif, bool enabled, u32 count, ...@@ -3740,19 +3693,15 @@ int wilc_setup_multicast_filter(struct wilc_vif *vif, bool enabled, u32 count,
int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power) int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power)
{ {
int ret; int ret;
struct host_if_msg *msg; struct wid wid;
msg = wilc_alloc_work(vif, handle_set_tx_pwr, false);
if (IS_ERR(msg))
return PTR_ERR(msg);
msg->body.tx_power.tx_pwr = tx_power; wid.id = WID_TX_POWER;
wid.type = WID_CHAR;
wid.val = &tx_power;
wid.size = sizeof(char);
ret = wilc_enqueue_work(msg); ret = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
if (ret) { wilc_get_vif_idx(vif));
netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
kfree(msg);
}
return ret; return ret;
} }
...@@ -3760,21 +3709,15 @@ int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power) ...@@ -3760,21 +3709,15 @@ int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power)
int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power) int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power)
{ {
int ret; int ret;
struct host_if_msg *msg; struct wid wid;
msg = wilc_alloc_work(vif, handle_get_tx_pwr, true); wid.id = WID_TX_POWER;
if (IS_ERR(msg)) wid.type = WID_CHAR;
return PTR_ERR(msg); wid.val = tx_power;
wid.size = sizeof(char);
ret = wilc_enqueue_work(msg); ret = wilc_send_config_pkt(vif, WILC_GET_CFG, &wid, 1,
if (ret) { wilc_get_vif_idx(vif));
netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
} else {
wait_for_completion(&msg->work_comp);
*tx_power = msg->body.tx_power.tx_pwr;
}
/* free 'msg' after copying data */
kfree(msg);
return ret; return ret;
} }
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