]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: wilc1000: replace semaphore sem_get_rssi with a completion
authorAlison Schofield <amsfield22@gmail.com>
Mon, 14 Mar 2016 17:34:39 +0000 (10:34 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 28 Mar 2016 14:30:36 +0000 (07:30 -0700)
Semaphore sem_get_rssi 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 2f14370b3ecc7c5db903ad32c9785ed37533ea2e..697491e8cfb276e9d75eb78746180a207f8fcf5f 100644 (file)
@@ -1886,7 +1886,7 @@ static void Handle_GetRssi(struct wilc_vif *vif)
                result = -EFAULT;
        }
 
-       up(&vif->hif_drv->sem_get_rssi);
+       complete(&vif->hif_drv->comp_get_rssi);
 }
 
 static s32 Handle_GetStatistics(struct wilc_vif *vif,
@@ -3244,7 +3244,7 @@ int wilc_get_rssi(struct wilc_vif *vif, s8 *rssi_level)
                return -EFAULT;
        }
 
-       down(&hif_drv->sem_get_rssi);
+       wait_for_completion(&hif_drv->comp_get_rssi);
 
        if (!rssi_level) {
                netdev_err(vif->ndev, "RSS pointer value is null\n");
@@ -3407,7 +3407,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);
-       sema_init(&hif_drv->sem_get_rssi, 0);
+       init_completion(&hif_drv->comp_get_rssi);
        init_completion(&hif_drv->comp_inactive_time);
 
        if (clients_count == 0) {
index 68852b3404d2a70dc9d453f9576d6c37c2b67b8e..085adeeaa7673edcaa683f814c1b0988495604b9 100644 (file)
@@ -277,7 +277,7 @@ struct host_if_drv {
        struct mutex cfg_values_lock;
        struct semaphore sem_test_key_block;
        struct semaphore sem_test_disconn_block;
-       struct semaphore sem_get_rssi;
+       struct completion comp_get_rssi;
        struct completion comp_inactive_time;
 
        struct timer_list scan_timer;