staging: wilc1000: replace sem_test_disconn_block with a completion
authorAlison Schofield <amsfield22@gmail.com>
Mon, 14 Mar 2016 17:35:05 +0000 (10:35 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 28 Mar 2016 14:30:36 +0000 (07:30 -0700)
Semaphore sem_test_disconn_block is used to signal completion of its
host interface message. Since the thread locking this semaphore will
have to wait, completions are the preferred mechanism and will offer
a performance improvement.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Tested-by: Leo Kim <leo.kim@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wilc1000/host_interface.c
drivers/staging/wilc1000/host_interface.h

index 697491e8cfb276e9d75eb78746180a207f8fcf5f..ed7f011b3eca98bd5c7e141d2245e1007b1bf212 100644 (file)
@@ -1857,7 +1857,7 @@ static void Handle_Disconnect(struct wilc_vif *vif)
                }
        }
 
-       up(&hif_drv->sem_test_disconn_block);
+       complete(&hif_drv->comp_test_disconn_block);
 }
 
 void wilc_resolve_disconnect_aberration(struct wilc_vif *vif)
@@ -3099,7 +3099,7 @@ int wilc_disconnect(struct wilc_vif *vif, u16 reason_code)
        if (result)
                netdev_err(vif->ndev, "Failed to send message: disconnect\n");
 
-       down(&hif_drv->sem_test_disconn_block);
+       wait_for_completion(&hif_drv->comp_test_disconn_block);
 
        return result;
 }
@@ -3406,7 +3406,7 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
        }
 
        sema_init(&hif_drv->sem_test_key_block, 0);
-       sema_init(&hif_drv->sem_test_disconn_block, 0);
+       init_completion(&hif_drv->comp_test_disconn_block);
        init_completion(&hif_drv->comp_get_rssi);
        init_completion(&hif_drv->comp_inactive_time);
 
index 085adeeaa7673edcaa683f814c1b0988495604b9..3ab94a7ba5e90a89a97541b2bfa3d4818f501090 100644 (file)
@@ -276,7 +276,7 @@ struct host_if_drv {
 
        struct mutex cfg_values_lock;
        struct semaphore sem_test_key_block;
-       struct semaphore sem_test_disconn_block;
+       struct completion comp_test_disconn_block;
        struct completion comp_get_rssi;
        struct completion comp_inactive_time;