crypto: engine - replace pr_xxx by dev_xxx
authorCorentin LABBE <clabbe.montjoie@gmail.com>
Tue, 6 Jun 2017 13:44:16 +0000 (15:44 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Mon, 19 Jun 2017 06:19:54 +0000 (14:19 +0800)
By adding a struct device *dev to struct engine, we could store the
device used at register time and so use all dev_xxx functions instead of
pr_xxx.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/crypto_engine.c
include/crypto/engine.h

index 727bd5c3569e3bf9d6b94e1c38b9926eb3cdda91..61e7c4e02fd264b2228da7f25a13ee317767cc87 100644 (file)
@@ -70,7 +70,7 @@ static void crypto_pump_requests(struct crypto_engine *engine,
 
                if (engine->unprepare_crypt_hardware &&
                    engine->unprepare_crypt_hardware(engine))
-                       pr_err("failed to unprepare crypt hardware\n");
+                       dev_err(engine->dev, "failed to unprepare crypt hardware\n");
 
                spin_lock_irqsave(&engine->queue_lock, flags);
                engine->idling = false;
@@ -99,7 +99,7 @@ static void crypto_pump_requests(struct crypto_engine *engine,
        if (!was_busy && engine->prepare_crypt_hardware) {
                ret = engine->prepare_crypt_hardware(engine);
                if (ret) {
-                       pr_err("failed to prepare crypt hardware\n");
+                       dev_err(engine->dev, "failed to prepare crypt hardware\n");
                        goto req_err;
                }
        }
@@ -110,14 +110,15 @@ static void crypto_pump_requests(struct crypto_engine *engine,
                if (engine->prepare_hash_request) {
                        ret = engine->prepare_hash_request(engine, hreq);
                        if (ret) {
-                               pr_err("failed to prepare request: %d\n", ret);
+                               dev_err(engine->dev, "failed to prepare request: %d\n",
+                                       ret);
                                goto req_err;
                        }
                        engine->cur_req_prepared = true;
                }
                ret = engine->hash_one_request(engine, hreq);
                if (ret) {
-                       pr_err("failed to hash one request from queue\n");
+                       dev_err(engine->dev, "failed to hash one request from queue\n");
                        goto req_err;
                }
                return;
@@ -126,19 +127,20 @@ static void crypto_pump_requests(struct crypto_engine *engine,
                if (engine->prepare_cipher_request) {
                        ret = engine->prepare_cipher_request(engine, breq);
                        if (ret) {
-                               pr_err("failed to prepare request: %d\n", ret);
+                               dev_err(engine->dev, "failed to prepare request: %d\n",
+                                       ret);
                                goto req_err;
                        }
                        engine->cur_req_prepared = true;
                }
                ret = engine->cipher_one_request(engine, breq);
                if (ret) {
-                       pr_err("failed to cipher one request from queue\n");
+                       dev_err(engine->dev, "failed to cipher one request from queue\n");
                        goto req_err;
                }
                return;
        default:
-               pr_err("failed to prepare request of unknown type\n");
+               dev_err(engine->dev, "failed to prepare request of unknown type\n");
                return;
        }
 
@@ -275,7 +277,7 @@ void crypto_finalize_cipher_request(struct crypto_engine *engine,
                    engine->unprepare_cipher_request) {
                        ret = engine->unprepare_cipher_request(engine, req);
                        if (ret)
-                               pr_err("failed to unprepare request\n");
+                               dev_err(engine->dev, "failed to unprepare request\n");
                }
                spin_lock_irqsave(&engine->queue_lock, flags);
                engine->cur_req = NULL;
@@ -312,7 +314,7 @@ void crypto_finalize_hash_request(struct crypto_engine *engine,
                    engine->unprepare_hash_request) {
                        ret = engine->unprepare_hash_request(engine, req);
                        if (ret)
-                               pr_err("failed to unprepare request\n");
+                               dev_err(engine->dev, "failed to unprepare request\n");
                }
                spin_lock_irqsave(&engine->queue_lock, flags);
                engine->cur_req = NULL;
@@ -384,7 +386,7 @@ int crypto_engine_stop(struct crypto_engine *engine)
        spin_unlock_irqrestore(&engine->queue_lock, flags);
 
        if (ret)
-               pr_warn("could not stop engine\n");
+               dev_warn(engine->dev, "could not stop engine\n");
 
        return ret;
 }
@@ -411,6 +413,7 @@ struct crypto_engine *crypto_engine_alloc_init(struct device *dev, bool rt)
        if (!engine)
                return NULL;
 
+       engine->dev = dev;
        engine->rt = rt;
        engine->running = false;
        engine->busy = false;
index 1bf600fc99f7b87907108e2296a47825e988940f..dd04c1699b5186cbf8331b0f34006977b5ccde57 100644 (file)
@@ -58,6 +58,7 @@ struct crypto_engine {
        struct list_head        list;
        spinlock_t              queue_lock;
        struct crypto_queue     queue;
+       struct device           *dev;
 
        bool                    rt;