staging: wilc1000: refactor wilc_get_mac_address() to avoid deferred handling
authorAjay Singh <ajay.kathat@microchip.com>
Sun, 2 Dec 2018 18:03:17 +0000 (18:03 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Dec 2018 08:49:45 +0000 (09:49 +0100)
Avoid handling of WID_MAC_ADDR wid command in deferred approach. Instead
of posting the wid to workqueue now handle directly from the caller
context.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wilc1000/host_interface.c
drivers/staging/wilc1000/host_interface.h

index 71395d8a93b12c0e8800a9a49da46ae58577f596..dc02561fc640420d7537781a98d3642482c5c3d0 100644 (file)
@@ -103,7 +103,6 @@ union message_body {
        struct rcvd_net_info net_info;
        struct rcvd_async_info async_info;
        struct set_multicast multicast_info;
-       struct get_mac_addr get_mac_info;
        struct remain_ch remain_on_ch;
        char *data;
 };
@@ -208,28 +207,6 @@ static struct wilc_vif *wilc_get_vif_from_idx(struct wilc *wilc, int idx)
        return wilc->vif[index];
 }
 
-static void handle_get_mac_address(struct work_struct *work)
-{
-       struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
-       struct wilc_vif *vif = msg->vif;
-       struct get_mac_addr *get_mac_addr = &msg->body.get_mac_info;
-       int ret;
-       struct wid wid;
-
-       wid.id = WID_MAC_ADDR;
-       wid.type = WID_STR;
-       wid.val = get_mac_addr->mac_addr;
-       wid.size = ETH_ALEN;
-
-       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 mac address\n");
-       complete(&msg->work_comp);
-       /* free 'msg' data later, in caller */
-}
-
 static int handle_scan_done(struct wilc_vif *vif, enum scan_event evt)
 {
        int result = 0;
@@ -1934,21 +1911,17 @@ int wilc_set_pmkid_info(struct wilc_vif *vif, struct wilc_pmkid_attr *pmkid)
 int wilc_get_mac_address(struct wilc_vif *vif, u8 *mac_addr)
 {
        int result;
-       struct host_if_msg *msg;
-
-       msg = wilc_alloc_work(vif, handle_get_mac_address, true);
-       if (IS_ERR(msg))
-               return PTR_ERR(msg);
+       struct wid wid;
 
-       msg->body.get_mac_info.mac_addr = mac_addr;
+       wid.id = WID_MAC_ADDR;
+       wid.type = WID_STR;
+       wid.size = ETH_ALEN;
+       wid.val = mac_addr;
 
-       result = wilc_enqueue_work(msg);
+       result = wilc_send_config_pkt(vif, WILC_GET_CFG, &wid, 1,
+                                     wilc_get_vif_idx(vif));
        if (result)
-               netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
-       else
-               wait_for_completion(&msg->work_comp);
-
-       kfree(msg);
+               netdev_err(vif->ndev, "Failed to get mac address\n");
 
        return result;
 }
index d2f29ea80745c2cd55744214650d6e44ed7aed86..953f0ea891119aeadef6c779341e37f121913604 100644 (file)
@@ -194,10 +194,6 @@ struct user_conn_req {
        void *arg;
 };
 
-struct get_mac_addr {
-       u8 *mac_addr;
-};
-
 struct remain_ch {
        u16 ch;
        u32 duration;