summaryrefslogtreecommitdiffstats
path: root/drivers/staging/wilc1000
diff options
context:
space:
mode:
authorAjay Singh2018-12-02 19:02:28 +0100
committerGreg Kroah-Hartman2018-12-05 09:48:45 +0100
commit430d0ec49db657801a36a3559a3e90124599acc5 (patch)
tree80b6b6ecbd49205a335c78e89e7988e11abb4fb6 /drivers/staging/wilc1000
parentstaging: wilc1000: use mutex lock to synchronized sending 'wid' cmd to firmware (diff)
downloadkernel-qcow2-linux-430d0ec49db657801a36a3559a3e90124599acc5.tar.gz
kernel-qcow2-linux-430d0ec49db657801a36a3559a3e90124599acc5.tar.xz
kernel-qcow2-linux-430d0ec49db657801a36a3559a3e90124599acc5.zip
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: Ajay Singh <ajay.kathat@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/wilc1000')
-rw-r--r--drivers/staging/wilc1000/host_interface.c85
1 files changed, 14 insertions, 71 deletions
diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index e179a8e5814c..88d90108659f 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -117,10 +117,6 @@ struct sta_inactive_t {
u8 mac[6];
};
-struct tx_power {
- u8 tx_pwr;
-};
-
union message_body {
struct scan_attr scan_info;
struct connect_attr con_info;
@@ -145,7 +141,6 @@ union message_body {
struct reg_frame reg_frame;
char *data;
struct del_all_sta del_all_sta_info;
- struct tx_power tx_power;
};
struct host_if_msg {
@@ -2371,48 +2366,6 @@ error:
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)
{
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,
int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power)
{
int ret;
- struct host_if_msg *msg;
-
- msg = wilc_alloc_work(vif, handle_set_tx_pwr, false);
- if (IS_ERR(msg))
- return PTR_ERR(msg);
+ struct wid wid;
- 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);
- if (ret) {
- netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
- kfree(msg);
- }
+ ret = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
+ wilc_get_vif_idx(vif));
return ret;
}
@@ -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 ret;
- struct host_if_msg *msg;
+ struct wid wid;
- msg = wilc_alloc_work(vif, handle_get_tx_pwr, true);
- if (IS_ERR(msg))
- return PTR_ERR(msg);
+ wid.id = WID_TX_POWER;
+ wid.type = WID_CHAR;
+ wid.val = tx_power;
+ wid.size = sizeof(char);
- ret = wilc_enqueue_work(msg);
- if (ret) {
- 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;
- }
+ ret = wilc_send_config_pkt(vif, WILC_GET_CFG, &wid, 1,
+ wilc_get_vif_idx(vif));
- /* free 'msg' after copying data */
- kfree(msg);
return ret;
}