crypto: algboss - Don't create test kthread when CONFIG_CRYPTO_MANAGER_DISABLE_TESTS

When CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y, it is no need to create
kthread cryptomgr_test, which almost do nothing but crypto_alg_tested().
Just call crypto_alg_tested() in cryptomgr_schedule_test() directly.

Save boot time about 7ms on rk3126-bnd-d708 board.

Change-Id: If465f8419dba4ea955df157b3405f3267a96c7d6
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
This commit is contained in:
Tao Huang
2020-03-19 19:16:35 +08:00
parent 642282b0bb
commit bc8460e54a

View File

@@ -207,6 +207,7 @@ err:
return NOTIFY_OK;
}
#ifndef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS
static int cryptomgr_test(void *data)
{
struct crypto_test_param *param = data;
@@ -228,10 +229,13 @@ skiptest:
kfree(param);
module_put_and_exit(0);
}
#endif /* CONFIG_CRYPTO_MANAGER_DISABLE_TESTS */
static int cryptomgr_schedule_test(struct crypto_alg *alg)
{
#ifndef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS
struct task_struct *thread;
#endif
struct crypto_test_param *param;
u32 type;
@@ -252,14 +256,23 @@ static int cryptomgr_schedule_test(struct crypto_alg *alg)
param->type = type;
#ifndef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS
thread = kthread_run(cryptomgr_test, param, "cryptomgr_test");
if (IS_ERR(thread))
goto err_free_param;
#else
crypto_alg_tested(param->driver, 0);
kfree(param);
module_put(THIS_MODULE);
#endif
return NOTIFY_STOP;
#ifndef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS
err_free_param:
kfree(param);
#endif
err_put_module:
module_put(THIS_MODULE);
err: