crypto: inside-secure - only dequeue when needed
authorAntoine Ténart <antoine.tenart@free-electrons.com>
Thu, 15 Jun 2017 07:56:27 +0000 (09:56 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Tue, 20 Jun 2017 03:21:47 +0000 (11:21 +0800)
This force the need_dequeue flag to be unset whenever the dequeue
function is called, to avoid calling it when it is not necessary.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/inside-secure/safexcel.c

index 8f195e0319385146dec7e177058ca5f094b5b915..e7f87ac126858519a0477c1254dc9e02424146a9 100644 (file)
@@ -429,6 +429,8 @@ void safexcel_dequeue(struct safexcel_crypto_priv *priv, int ring)
        struct safexcel_request *request;
        int ret, nreq = 0, cdesc = 0, rdesc = 0, commands, results;
 
+       priv->ring[ring].need_dequeue = false;
+
        do {
                spin_lock_bh(&priv->ring[ring].queue_lock);
                backlog = crypto_get_backlog(&priv->ring[ring].queue);
@@ -631,10 +633,8 @@ static void safexcel_handle_result_work(struct work_struct *work)
 
        safexcel_handle_result_descriptor(priv, data->ring);
 
-       if (priv->ring[data->ring].need_dequeue) {
-               priv->ring[data->ring].need_dequeue = false;
+       if (priv->ring[data->ring].need_dequeue)
                safexcel_dequeue(data->priv, data->ring);
-       }
 }
 
 struct safexcel_ring_irq_data {