staging: wilc1000: refactor wilc_get_mac_address() to avoid deferred handling
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>
This commit is contained in:
parent
b7afe35032
commit
153068b9d1
@ -103,7 +103,6 @@ union message_body {
|
|||||||
struct rcvd_net_info net_info;
|
struct rcvd_net_info net_info;
|
||||||
struct rcvd_async_info async_info;
|
struct rcvd_async_info async_info;
|
||||||
struct set_multicast multicast_info;
|
struct set_multicast multicast_info;
|
||||||
struct get_mac_addr get_mac_info;
|
|
||||||
struct remain_ch remain_on_ch;
|
struct remain_ch remain_on_ch;
|
||||||
char *data;
|
char *data;
|
||||||
};
|
};
|
||||||
@ -208,28 +207,6 @@ static struct wilc_vif *wilc_get_vif_from_idx(struct wilc *wilc, int idx)
|
|||||||
return wilc->vif[index];
|
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)
|
static int handle_scan_done(struct wilc_vif *vif, enum scan_event evt)
|
||||||
{
|
{
|
||||||
int result = 0;
|
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 wilc_get_mac_address(struct wilc_vif *vif, u8 *mac_addr)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
struct host_if_msg *msg;
|
struct wid wid;
|
||||||
|
|
||||||
msg = wilc_alloc_work(vif, handle_get_mac_address, true);
|
wid.id = WID_MAC_ADDR;
|
||||||
if (IS_ERR(msg))
|
wid.type = WID_STR;
|
||||||
return PTR_ERR(msg);
|
wid.size = ETH_ALEN;
|
||||||
|
wid.val = mac_addr;
|
||||||
|
|
||||||
msg->body.get_mac_info.mac_addr = mac_addr;
|
result = wilc_send_config_pkt(vif, WILC_GET_CFG, &wid, 1,
|
||||||
|
wilc_get_vif_idx(vif));
|
||||||
result = wilc_enqueue_work(msg);
|
|
||||||
if (result)
|
if (result)
|
||||||
netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
|
netdev_err(vif->ndev, "Failed to get mac address\n");
|
||||||
else
|
|
||||||
wait_for_completion(&msg->work_comp);
|
|
||||||
|
|
||||||
kfree(msg);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -194,10 +194,6 @@ struct user_conn_req {
|
|||||||
void *arg;
|
void *arg;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct get_mac_addr {
|
|
||||||
u8 *mac_addr;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct remain_ch {
|
struct remain_ch {
|
||||||
u16 ch;
|
u16 ch;
|
||||||
u32 duration;
|
u32 duration;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user