]> git.baikalelectronics.ru Git - kernel.git/commit
crypto: hisilicon/qm - fix the process of register algorithms to crypto
authorYang Shen <shenyang39@huawei.com>
Sat, 15 Aug 2020 09:56:17 +0000 (17:56 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 21 Aug 2020 04:47:53 +0000 (14:47 +1000)
commit20c7d2d5c39a3c332122ab092db4c6dbf47d1c9b
treef734fb1ea3fa7c266e7decb2fa0134f890024f5d
parent6a1af9fe1a6168255b39a896163e8c7f709da181
crypto: hisilicon/qm - fix the process of register algorithms to crypto

When the devices are removed or not existing, the corresponding algorithms
which are registered by 'hisi-zip' driver can't be used.

Move 'hisi_zip_register_to_crypto' from 'hisi_zip_init' to
'hisi_zip_probe'. The algorithms will be registered to crypto only when
there is device bind on the driver. And when the devices are removed,
the algorithms will be unregistered.

In the previous process, the function 'xxx_register_to_crypto' need a lock
and a static variable to judge if the registration is the first time.
Move this action into the function 'hisi_qm_alg_register'. Each device
will call 'hisi_qm_alg_register' to add itself to qm list in probe process
and registering algs when the qm list is empty.

Signed-off-by: Yang Shen <shenyang39@huawei.com>
Reviewed-by: Zhou Wang <wangzhou1@hisilicon.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/hisilicon/hpre/hpre_crypto.c
drivers/crypto/hisilicon/hpre/hpre_main.c
drivers/crypto/hisilicon/qm.c
drivers/crypto/hisilicon/qm.h
drivers/crypto/hisilicon/sec2/sec_crypto.c
drivers/crypto/hisilicon/sec2/sec_main.c
drivers/crypto/hisilicon/zip/zip_crypto.c
drivers/crypto/hisilicon/zip/zip_main.c