Commit 896802a8 authored by Chaehyun Lim's avatar Chaehyun Lim Committed by Greg Kroah-Hartman

staging: wilc1000: use mutex instead of struct semaphore hif_sema_deinit

This patch replaces struct semaphore hif_sema_deinit with struct mutex
hif_deinit_lock. It is better to use mutex because mutex gives better
performance than semaphore.
Signed-off-by: default avatarChaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5150d01e
...@@ -234,7 +234,7 @@ static struct message_queue hif_msg_q; ...@@ -234,7 +234,7 @@ static struct message_queue hif_msg_q;
static struct semaphore hif_sema_thread; static struct semaphore hif_sema_thread;
static struct semaphore hif_sema_driver; static struct semaphore hif_sema_driver;
static struct completion hif_wait_response; static struct completion hif_wait_response;
static struct semaphore hif_sema_deinit; static struct mutex hif_deinit_lock;
static struct timer_list periodic_rssi; static struct timer_list periodic_rssi;
u8 wilc_multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; u8 wilc_multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
...@@ -3402,7 +3402,7 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) ...@@ -3402,7 +3402,7 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
if (clients_count == 0) { if (clients_count == 0) {
sema_init(&hif_sema_thread, 0); sema_init(&hif_sema_thread, 0);
sema_init(&hif_sema_driver, 0); sema_init(&hif_sema_driver, 0);
sema_init(&hif_sema_deinit, 1); mutex_init(&hif_deinit_lock);
} }
init_completion(&hif_drv->comp_test_key_block); init_completion(&hif_drv->comp_test_key_block);
...@@ -3470,7 +3470,7 @@ int wilc_deinit(struct wilc_vif *vif) ...@@ -3470,7 +3470,7 @@ int wilc_deinit(struct wilc_vif *vif)
return -EFAULT; return -EFAULT;
} }
down(&hif_sema_deinit); mutex_lock(&hif_deinit_lock);
terminated_handle = hif_drv; terminated_handle = hif_drv;
...@@ -3512,7 +3512,7 @@ int wilc_deinit(struct wilc_vif *vif) ...@@ -3512,7 +3512,7 @@ int wilc_deinit(struct wilc_vif *vif)
clients_count--; clients_count--;
terminated_handle = NULL; terminated_handle = NULL;
up(&hif_sema_deinit); mutex_unlock(&hif_deinit_lock);
return result; return result;
} }
...@@ -3559,25 +3559,25 @@ void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *pu8Buffer, ...@@ -3559,25 +3559,25 @@ void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *pu8Buffer,
struct host_if_drv *hif_drv = NULL; struct host_if_drv *hif_drv = NULL;
struct wilc_vif *vif; struct wilc_vif *vif;
down(&hif_sema_deinit); mutex_lock(&hif_deinit_lock);
id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24));
vif = wilc_get_vif_from_idx(wilc, id); vif = wilc_get_vif_from_idx(wilc, id);
if (!vif) { if (!vif) {
up(&hif_sema_deinit); mutex_unlock(&hif_deinit_lock);
return; return;
} }
hif_drv = vif->hif_drv; hif_drv = vif->hif_drv;
if (!hif_drv || hif_drv == terminated_handle) { if (!hif_drv || hif_drv == terminated_handle) {
up(&hif_sema_deinit); mutex_unlock(&hif_deinit_lock);
return; return;
} }
if (!hif_drv->usr_conn_req.conn_result) { if (!hif_drv->usr_conn_req.conn_result) {
netdev_err(vif->ndev, "there is no current Connect Request\n"); netdev_err(vif->ndev, "there is no current Connect Request\n");
up(&hif_sema_deinit); mutex_unlock(&hif_deinit_lock);
return; return;
} }
...@@ -3594,7 +3594,7 @@ void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *pu8Buffer, ...@@ -3594,7 +3594,7 @@ void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *pu8Buffer,
if (result) if (result)
netdev_err(vif->ndev, "synchronous info (%d)\n", result); netdev_err(vif->ndev, "synchronous info (%d)\n", result);
up(&hif_sema_deinit); mutex_unlock(&hif_deinit_lock);
} }
void wilc_scan_complete_received(struct wilc *wilc, u8 *pu8Buffer, void wilc_scan_complete_received(struct wilc *wilc, u8 *pu8Buffer,
......
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